Skip to content

Commit

Permalink
Merge branch 'release-0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Levia committed Feb 18, 2020
2 parents a91f201 + 7c535c6 commit cccec23
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 46 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.3.0

* Remove obsolete fields returned by the endpoints
* Fix sidebar search endopoint link and add BIOPAMA link
* Add BIOPAMA endpoint to documentation

### 0.2.0

**Features**
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,3 @@ DEPENDENCIES
rake (~> 10.5.0)
sinatra (~> 1.4.6)
slack-notifier (~> 1.5.1)

BUNDLED WITH
1.11.2
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,16 @@ $ rackup
```

Now fire up your browser at `localhost:9292`!

## Further hints

This example demonstrates accessing an api_user from the terminal using irb.
```
$ RAILS_ENV=development bundle exec irb
> $LOAD_PATH.unshift("#{File.dirname(__FILE__)}"); require 'config/environment.rb'; require 'lib/mailer.rb'
=> true
2.3.0 :002 > ApiUser.first
```
13 changes: 7 additions & 6 deletions api/v3/views/country.rabl
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ end
# Relations
if @current_user.access_to?(Country, :country_statistic)
child :country_statistic => :statistics do
attributes :pa_area, :percentage_cover_pas, :eez_area,
:ts_area, :pa_land_area, :pa_marine_area, :percentage_pa_land_cover,
:percentage_pa_eez_cover, :percentage_pa_ts_cover, :land_area, :percentage_pa_cover,
:pa_eez_area, :pa_ts_area, :percentage_pa_marine_cover, :marine_area,
attributes :pa_land_area, :pa_marine_area,
:land_area, :percentage_pa_land_cover,
:percentage_pa_marine_cover, :marine_area,
:polygons_count, :points_count
end
end

if @current_user.access_to?(Country, :pame_statistic)
child :pame_statistic => :pame_statistics do
attributes :assessments, :assessed_pas,
:average_score, :total_area_assessed,
:percentage_area_assessed
:pame_pa_land_area,
:pame_percentage_pa_land_cover,
:pame_pa_marine_area,
:pame_percentage_pa_marine_cover
end
end

Expand Down
3 changes: 2 additions & 1 deletion web/views/documentation/_sidebar.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<div>
<a href="#get-v3protectedareas" class="filter-bar__value filter-bar__value--smaller">GET /v3/protected_areas</a>
<a href="#get-v3protectedareaswdpaid" class="filter-bar__value filter-bar__value--smaller">GET /v3/protected_areas/:wdpa_id</a>
<a href="#get-v3protectedareaswdpaid" class="filter-bar__value filter-bar__value--smaller">GET /v3/protected_areas/search</a>
<a href="#get-v3protectedareassearch" class="filter-bar__value filter-bar__value--smaller">GET /v3/protected_areas/search</a>
<a href="#get-v3protectedareasbiopama" class="filter-bar__value filter-bar__value--smaller">GET /v3/protected_areas/biopama</a>
</div>
</div>
</div>
Expand Down
48 changes: 12 additions & 36 deletions web/views/documentation/countries.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,10 @@ Sample response:
"pas_regional_count": 0,
"pas_international_count": 11,
"statistics": {
"pa_area": 51844.34889409,
"percentage_cover_pas": null,
"eez_area": null,
"ts_area": 298762.86,
"pa_land_area": 32739.84,
"pa_marine_area": 19104.50889409,
"percentage_pa_land_cover": 10.96,
"percentage_pa_eez_cover": null,
"percentage_pa_ts_cover": null,
"land_area": 298762.86,
"percentage_pa_cover": 12,
"pa_eez_area": null,
"pa_ts_area": null,
"percentage_pa_marine_cover": 1.04,
"marine_area": 1829405.068391,
"polygons_count": 16,
Expand All @@ -57,9 +48,10 @@ Sample response:
"pame_statistics": {
"assessments": 39,
"assessed_pas": 18,
"average_score": 0.496317020061398,
"total_area_assessed": 9884.5502680511,
"percentage_area_assessed": 13.1224063174949
"pame_pa_land_area": 5807.692147,
"pame_percentage_pa_land_cover": 1.943835,
"pame_pa_marine_area": 1523.50019,
"pame_percentage_pa_marine_cover": 0.083023
},
"region": {
"name": "Asia",
Expand Down Expand Up @@ -126,19 +118,10 @@ Sample response:
"pas_regional_count": 0,
"pas_international_count": 11,
"statistics": {
"pa_area": 4104.71,
"percentage_cover_pas": null,
"eez_area": null,
"ts_area": 41355.27,
"pa_land_area": 4104.71,
"pa_marine_area": null,
"percentage_pa_land_cover": 9.93,
"percentage_pa_eez_cover": null,
"percentage_pa_ts_cover": null,
"land_area": 41355.27,
"percentage_pa_cover": 9.93,
"pa_eez_area": null,
"pa_ts_area": null,
"percentage_pa_marine_cover": null,
"marine_area": null,
"polygons_count": 0,
Expand All @@ -147,9 +130,10 @@ Sample response:
"pame_statistics": {
"assessments": 20,
"assessed_pas": 14,
"average_score": 0.780597953216374,
"total_area_assessed": 1266.50166158781,
"percentage_area_assessed": 21.5681993197221
"pame_pa_land_area": 2610.795789,
"pame_percentage_pa_land_cover": 6.313091,
"pame_pa_marine_area": 0,
"pame_percentage_pa_marine_cover": 0
},
"region": {
"name": "Europe",
Expand Down Expand Up @@ -239,19 +223,10 @@ Sample response:
}
},
"statistics": {
"pa_area": 2565883.979754,
"percentage_cover_pas": null,
"eez_area": null,
"ts_area": 9336666.44,
"pa_land_area": 1294475.95,
"pa_marine_area": 1271408.029754,
"percentage_pa_land_cover": 13.86,
"percentage_pa_eez_cover": null,
"percentage_pa_ts_cover": null,
"land_area": 9336666.44,
"percentage_pa_cover": 26.32,
"pa_eez_area": null,
"pa_ts_area": null,
"percentage_pa_marine_cover": 12.46,
"marine_area": 10201208.33913,
"polygons_count": 1,
Expand All @@ -260,9 +235,10 @@ Sample response:
"pame_statistics": {
"assessments": 101,
"assessed_pas": 79,
"average_score": 0.621947365828616,
"total_area_assessed": 517805.948887391,
"percentage_area_assessed": 18.834276817517
"pame_pa_land_area": 154799.8198,
"pame_percentage_pa_land_cover": 1.631122,
"pame_pa_marine_area": 1537642.023,
"pame_percentage_pa_marine_cover": 17.89726
},
"region": {
"name": "North America",
Expand Down
94 changes: 94 additions & 0 deletions web/views/documentation/protected_areas.md
Original file line number Diff line number Diff line change
Expand Up @@ -924,3 +924,97 @@ Sample response:
]
}
~~~
---

## `GET /v3/protected_areas/biopama`
Returns all protected areas within the BIOPAMA ACP countries which have PAME Evaluations.
Accepts a `with_geometry` parameter.

The accepted parameters are:

~~~
with_geometry (Boolean)
If set, returns the geojson representation of the geometry of the protected areas.
Defaults to false.
~~~

Sample response:

~~~
{
"protected_areas": [
{
"id": 24,
"name": "Inagua National Park",
"original_name": "Inagua National Park",
"wdpa_id": 24,
"marine": false,
"reported_marine_area": "0.0",
"reported_area": "773.430147925",
"management_plan": "http://www.bnt.bs//_m1731/The-National-Parks-of-The-Bahamas/Inagua-National-Park",
"is_green_list": false,
"owner_type": "Not Reported",
"countries": [
{
"name": "Bahamas",
"iso_3": "BHS",
"id": "BHS"
}
],
"iucn_category": {
"id": 8,
"name": "Not Reported"
},
"designation": {
"id": 4,
"name": "National Park",
"jurisdiction": {
"id": 1,
"name": "National"
}
},
"no_take_status": {
"id": 21,
"name": "Not Applicable",
"area": "0.0"
},
"legal_status": {
"id": 1,
"name": "Designated"
},
"management_authority": {
"id": 4,
"name": "Bahamas National Trust"
},
"governance": {
"id": 2,
"governance_type": "Not Reported"
},
"pame_evaluations": [
{
"id": 9829,
"metadata_id": 25,
"url": "Not reported",
"year": 2018,
"methodology": "METT-RAPPAM",
"source": {
"data_title": "The Bahamas management effectiveness information",
"resp_party": "Department of Marine Resources",
"year": 2018,
"language": "English"
}
}
],
"links": {
"protected_planet": "http://protectedplanet.net/24"
},
"legal_status_updated_at": "01/01/1997"
},
{
"id": 180,
"name": "Cotubanamá (Del Este)",
"original_name": "Cotubanamá (Del Este)"
}
]
}
~~~

0 comments on commit cccec23

Please sign in to comment.