Skip to content

Commit bd1853c

Browse files
author
Ferdinando Primerano
committed
Merge branch 'release-0.1.0'
2 parents be1db1e + 52730f1 commit bd1853c

File tree

4 files changed

+78
-27
lines changed

4 files changed

+78
-27
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### 0.1.0
2+
3+
**Add new fields to Protected Areas JSON**
4+
5+
* Added governance
6+
* Added no_take_status area
7+
* Added reported_area
8+
* Added reported_marine_area
9+
* Added owner_type
10+
* Improved documentation

api/v3/views/protected_area.rabl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,15 @@ if @current_user.access_to?(ProtectedArea, :geometry)
1616
end
1717

1818
if @current_user.access_to?(ProtectedArea, :marine)
19-
node :marine do |pa|
20-
pa.marine
21-
end
19+
attribute :marine
2220
end
2321

2422
if @current_user.access_to?(ProtectedArea, :reported_marine_area)
25-
node :reported_marine_area do |pa|
26-
pa.reported_marine_area
27-
end
23+
attribute :reported_marine_area
2824
end
2925

3026
if @current_user.access_to?(ProtectedArea, :reported_area)
31-
node :reported_area do |pa|
32-
pa.reported_area
33-
end
27+
attribute :reported_area
3428
end
3529

3630
if @current_user.access_to?(ProtectedArea, :legal_status_updated_at)
@@ -40,15 +34,11 @@ if @current_user.access_to?(ProtectedArea, :legal_status_updated_at)
4034
end
4135

4236
if @current_user.access_to?(ProtectedArea, :management_plan)
43-
node :management_plan do |pa|
44-
pa.management_plan
45-
end
37+
attribute :management_plan
4638
end
4739

4840
if @current_user.access_to?(ProtectedArea, :is_green_list)
49-
node :is_green_list do |pa|
50-
pa.is_green_list
51-
end
41+
attribute :is_green_list
5242
end
5343

5444
# Relations
@@ -82,7 +72,7 @@ end
8272

8373
if @current_user.access_to?(ProtectedArea, :no_take_status)
8474
child :no_take_status, object_root: false do
85-
attributes :id, :name
75+
attributes :id, :name, :area
8676
end
8777
end
8878

@@ -97,3 +87,13 @@ if @current_user.access_to?(ProtectedArea, :management_authority)
9787
attributes :id, :name
9888
end
9989
end
90+
91+
if @current_user.access_to?(ProtectedArea, :governance)
92+
child :governance, object_root: false do
93+
attributes :id, :governance_type
94+
end
95+
end
96+
97+
if @current_user.access_to?(ProtectedArea, :owner_type)
98+
attribute :owner_type
99+
end

models/protected_area.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ class ProtectedArea < ActiveRecord::Base
1313
:iucn_category, :designation,
1414
:link_to_pp, :no_take_status,
1515
:legal_status, :legal_status_updated_at,
16-
:management_plan, :management_authority
16+
:management_plan, :management_authority,
17+
:governance, :reported_area, :reported_marine_area,
18+
:owner_type
1719
]
1820

1921
belongs_to :iucn_category

web/views/documentation/protected_areas.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,22 @@ Sample response:
5252
name: "National"
5353
}
5454
},
55-
"marine": false
55+
"no_take_status": {
56+
id: 11851,
57+
name: "Not Applicable",
58+
area: "0.0"
59+
}
60+
"marine": false,
61+
"reported_area": "0.3933",
62+
"reported_marine_area": "0.0",
63+
"legal_status_updated_at": "01/01/1998",
64+
"management_plan": "Not Reported",
65+
"is_green_list": false,
66+
"governance": {
67+
"id": 1,
68+
"governance_type": "Governance by Government"
69+
},
70+
"owner_type": "Not Reported"
5671
},
5772
{
5873
"id": 64700,
@@ -83,8 +98,9 @@ Sample response:
8398
}
8499
},
85100
"no_take_status": {
86-
"id": 11874,
87-
"name": "Not Applicable"
101+
"id": 13537,
102+
"name": "Not Applicable",
103+
"area": "0.0"
88104
},
89105
"legal_status": {
90106
"id": 1,
@@ -95,9 +111,16 @@ Sample response:
95111
"name": "Not Reported"
96112
},
97113
"marine": false,
98-
"legal_status_updated_at": "01/01/1998",
114+
"reported_area": "5.1867",
115+
"reported_marine_area": "0.0",
116+
"legal_status_updated_at": "01/01/1948",
99117
"management_plan": "Not Reported",
100-
"is_green_list": false
118+
"is_green_list": false,
119+
"governance": {
120+
"id": 1,
121+
"governance_type": "Governance by Government"
122+
},
123+
"owner_type": "Not Reported"
101124
}
102125
]
103126
}
@@ -173,7 +196,8 @@ Sample response:
173196
},
174197
"no_take_status": {
175198
"id": 11874,
176-
"name": "Not Applicable"
199+
"name": "Not Applicable",
200+
"area": "0.0"
177201
},
178202
"legal_status": {
179203
"id": 1,
@@ -184,9 +208,16 @@ Sample response:
184208
"name": "Not Reported"
185209
},
186210
"marine": false,
211+
"reported_area": "106.25",
212+
"reported_marine_area": "0.0",
187213
"legal_status_updated_at": "01/01/1998",
188214
"management_plan": "Not Reported",
189-
"is_green_list": false
215+
"is_green_list": false,
216+
"governance": {
217+
"id": 1,
218+
"governance_type": "Governance by Government"
219+
},
220+
"owner_type": "Not Reported"
190221
}
191222
}
192223
~~~
@@ -305,8 +336,9 @@ Sample response:
305336
}
306337
},
307338
"no_take_status": {
308-
"id": 11874,
339+
"id": 2634,
309340
"name": "Not Applicable"
341+
"area": "0.0"
310342
},
311343
"legal_status": {
312344
"id": 1,
@@ -317,9 +349,16 @@ Sample response:
317349
"name": "Not Reported"
318350
},
319351
"marine": false,
320-
"legal_status_updated_at": "01/01/1998",
352+
"reported_area": "230.46",
353+
"reported_marine_area": "46.66",
354+
"legal_status_updated_at": "01/01/1977",
321355
"management_plan": "Not Reported",
322-
"is_green_list": false
356+
"is_green_list": false,
357+
"governance": {
358+
"id": 2,
359+
"governance_type": "Not Reported"
360+
},
361+
"owner_type: "Not Reported"
323362
}
324363
]
325364
}

0 commit comments

Comments
 (0)