Skip to content

Commit 707a429

Browse files
committed
Added pame evaluations
1 parent bd1853c commit 707a429

File tree

592 files changed

+226826
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

592 files changed

+226826
-53
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/test/tmp/
1010
/test/version_tmp/
1111
/tmp/
12-
/log
12+
/log/*.log
1313

1414
## Specific to RubyMotion:
1515
.dat*

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.3.1

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ gem "grape", "~> 0.17.0"
55
gem "grape-rabl", "~> 0.4.1"
66
gem "grape-kaminari", "~> 0.1.8"
77
gem "grape_logging", '~> 1.3.0'
8+
gem "kaminari", "0.16.3"
89
gem "sinatra", "~> 1.4.6"
910
gem "kramdown", "~> 1.9.0"
1011

@@ -33,6 +34,7 @@ gem "activesupport", "~> 4.2.5"
3334

3435
# Testing
3536
group :test, :development do
37+
gem "rack-console", '~> 1.3.1'
3638
gem "minitest"
3739
gem "minitest-around", "~> 0.3.2"
3840
gem "database_cleaner", "~> 1.5.1"
@@ -42,7 +44,7 @@ end
4244

4345
# Deploy
4446
group :development do
45-
gem 'capistrano', '~> 3.4', require: false
47+
gem 'capistrano', '~> 3.4.1', require: false
4648
gem 'capistrano-bundler', '~> 1.1.4', require: false
4749
gem 'capistrano-rvm', '~> 0.1', require: false
4850
gem 'capistrano-maintenance', '~> 1.0', require: false

Gemfile.lock

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ GEM
3434
activemodel (= 4.2.5.1)
3535
activesupport (= 4.2.5.1)
3636
arel (~> 6.0)
37-
activerecord-postgis-adapter (3.1.4)
37+
activerecord-postgis-adapter (3.1.5)
3838
activerecord (~> 4.2)
3939
rgeo-activerecord (>= 4.0.4)
4040
activesupport (4.2.5.1)
@@ -43,26 +43,26 @@ GEM
4343
minitest (~> 5.1)
4444
thread_safe (~> 0.3, >= 0.3.4)
4545
tzinfo (~> 1.1)
46-
appsignal (1.1.0.beta.5)
46+
appsignal (1.1.9)
4747
rack
4848
thread_safe
49-
arel (6.0.3)
49+
arel (6.0.4)
5050
axiom-types (0.1.1)
5151
descendants_tracker (~> 0.0.4)
5252
ice_nine (~> 0.11.0)
5353
thread_safe (~> 0.3, >= 0.3.1)
54-
builder (3.2.2)
54+
builder (3.2.3)
5555
byebug (3.1.2)
5656
columnize (~> 0.8)
5757
debugger-linecache (~> 1.2)
58-
capistrano (3.4.0)
58+
capistrano (3.4.1)
5959
i18n
6060
rake (>= 10.0.0)
6161
sshkit (~> 1.3)
6262
capistrano-bundler (1.1.4)
6363
capistrano (~> 3.1)
6464
sshkit (~> 1.2)
65-
capistrano-maintenance (1.0.0)
65+
capistrano-maintenance (1.2.0)
6666
capistrano (>= 3.0)
6767
capistrano-passenger (0.2.0)
6868
capistrano (~> 3.0)
@@ -72,21 +72,23 @@ GEM
7272
coercible (1.0.0)
7373
descendants_tracker (~> 0.0.1)
7474
columnize (0.9.0)
75-
database_cleaner (1.5.1)
75+
concurrent-ruby (1.0.5)
76+
crass (1.0.4)
77+
database_cleaner (1.5.3)
7678
debugger-linecache (1.2.0)
7779
descendants_tracker (0.0.4)
7880
thread_safe (~> 0.3, >= 0.3.1)
79-
dotenv (2.1.0)
80-
enumerable-lazy (0.0.1)
81+
dotenv (2.1.2)
82+
enumerable-lazy (0.0.2)
8183
equalizer (0.0.11)
8284
erubis (2.7.0)
8385
exception_notification (4.1.4)
8486
actionmailer (~> 4.0)
8587
activesupport (~> 4.0)
86-
factory_girl (4.5.0)
88+
factory_girl (4.9.0)
8789
activesupport (>= 3.0.0)
88-
globalid (0.3.6)
89-
activesupport (>= 4.1.0)
90+
globalid (0.4.1)
91+
activesupport (>= 4.2.0)
9092
grape (0.17.0)
9193
activesupport
9294
builder
@@ -97,87 +99,92 @@ GEM
9799
rack (>= 1.3.0)
98100
rack-accept
99101
virtus (>= 1.0.0)
100-
grape-kaminari (0.1.8)
102+
grape-kaminari (0.1.9)
101103
grape
102104
kaminari
103-
grape-rabl (0.4.1)
105+
grape-rabl (0.4.3)
104106
grape
105107
i18n
106108
rabl
107109
tilt
108110
grape_logging (1.3.0)
109111
grape
110-
hashie (3.4.6)
111-
i18n (0.7.0)
112+
hashie (3.5.7)
113+
i18n (0.9.5)
114+
concurrent-ruby (~> 1.0)
112115
ice_nine (0.11.2)
113-
json (1.8.3)
116+
json (1.8.6)
114117
kaminari (0.16.3)
115118
actionpack (>= 3.0.0)
116119
activesupport (>= 3.0.0)
117120
kramdown (1.9.0)
118-
loofah (2.0.3)
121+
loofah (2.2.2)
122+
crass (~> 1.0.2)
119123
nokogiri (>= 1.5.9)
120-
mail (2.6.3)
121-
mime-types (>= 1.16, < 3)
122-
mime-types (2.99)
123-
mini_portile2 (2.0.0)
124-
minitest (5.9.0)
124+
mail (2.7.0)
125+
mini_mime (>= 0.1.1)
126+
mini_mime (1.0.0)
127+
mini_portile2 (2.3.0)
128+
minitest (5.11.3)
125129
minitest-around (0.3.2)
126130
minitest (~> 5.0)
127-
multi_json (1.12.1)
128-
multi_xml (0.5.5)
131+
multi_json (1.13.1)
132+
multi_xml (0.6.0)
129133
mustermann19 (0.4.4)
130134
enumerable-lazy
131135
net-scp (1.2.1)
132136
net-ssh (>= 2.6.5)
133-
net-ssh (3.0.2)
134-
nokogiri (1.6.7.2)
135-
mini_portile2 (~> 2.0.0.rc2)
137+
net-ssh (4.2.0)
138+
nokogiri (1.8.3)
139+
mini_portile2 (~> 2.3.0)
136140
pg (0.18.4)
137-
pony (1.11)
141+
pony (1.12)
138142
mail (>= 2.0)
139-
rabl (0.11.8)
143+
rabl (0.13.1)
140144
activesupport (>= 2.3.14)
141-
rack (1.6.4)
145+
rack (1.6.10)
142146
rack-accept (0.4.5)
143147
rack (>= 0.4)
144-
rack-cors (0.4.0)
145-
rack-protection (1.5.3)
148+
rack-console (1.3.1)
149+
rack (>= 1.1)
150+
rack-test
151+
rack-cors (1.0.2)
152+
rack-protection (1.5.5)
146153
rack
147154
rack-test (0.6.3)
148155
rack (>= 1.0)
149156
rack_csrf (2.5.0)
150157
rack (>= 1.1.0)
151158
rails-deprecated_sanitizer (1.0.3)
152159
activesupport (>= 4.2.0.alpha)
153-
rails-dom-testing (1.0.7)
154-
activesupport (>= 4.2.0.beta, < 5.0)
155-
nokogiri (~> 1.6.0)
160+
rails-dom-testing (1.0.9)
161+
activesupport (>= 4.2.0, < 5.0)
162+
nokogiri (~> 1.6)
156163
rails-deprecated_sanitizer (>= 1.0.1)
157-
rails-html-sanitizer (1.0.3)
158-
loofah (~> 2.0)
164+
rails-html-sanitizer (1.0.4)
165+
loofah (~> 2.2, >= 2.2.2)
159166
railties (4.2.5.1)
160167
actionpack (= 4.2.5.1)
161168
activesupport (= 4.2.5.1)
162169
rake (>= 0.8.7)
163170
thor (>= 0.18.1, < 2.0)
164171
rake (10.5.0)
165-
rgeo (0.5.2)
172+
rgeo (0.6.0)
166173
rgeo-activerecord (4.0.5)
167174
activerecord (~> 4.2)
168175
rgeo (~> 0.3)
169-
sinatra (1.4.7)
176+
sinatra (1.4.8)
170177
rack (~> 1.5)
171178
rack-protection (~> 1.4)
172179
tilt (>= 1.3, < 3)
173180
slack-notifier (1.5.1)
174-
sshkit (1.8.1)
181+
sshkit (1.16.1)
175182
net-scp (>= 1.1.2)
176183
net-ssh (>= 2.8.0)
177-
thor (0.19.1)
178-
thread_safe (0.3.5)
179-
tilt (2.0.2)
180-
tzinfo (1.2.2)
184+
thor (0.20.0)
185+
thread_safe (0.3.6)
186+
tilt (2.0.8)
187+
tzinfo (1.2.5)
181188
thread_safe (~> 0.1)
182189
virtus (1.0.5)
183190
axiom-types (~> 0.1)
@@ -195,7 +202,7 @@ DEPENDENCIES
195202
activesupport (~> 4.2.5)
196203
appsignal (~> 1.1.0.beta.5)
197204
byebug (~> 3.1.2)
198-
capistrano (~> 3.4)
205+
capistrano (~> 3.4.1)
199206
capistrano-bundler (~> 1.1.4)
200207
capistrano-maintenance (~> 1.0)
201208
capistrano-passenger (~> 0.2.0)
@@ -208,11 +215,13 @@ DEPENDENCIES
208215
grape-kaminari (~> 0.1.8)
209216
grape-rabl (~> 0.4.1)
210217
grape_logging (~> 1.3.0)
218+
kaminari (= 0.16.3)
211219
kramdown (~> 1.9.0)
212220
minitest
213221
minitest-around (~> 0.3.2)
214222
pg (~> 0.18.4)
215223
pony (~> 1.11)
224+
rack-console (~> 1.3.1)
216225
rack-cors
217226
rack-test (~> 0.6.3)
218227
rack_csrf (~> 2.5.0)
@@ -221,4 +230,4 @@ DEPENDENCIES
221230
slack-notifier (~> 1.5.1)
222231

223232
BUNDLED WITH
224-
1.11.2
233+
1.16.2

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,21 @@ $ rackup
4040
```
4141

4242
Now fire up your browser at `localhost:9292`!
43+
44+
## Development
45+
46+
The `rails c` of the rack world...
47+
48+
```
49+
bundle exec rack-console
50+
```
51+
52+
Then make an api user (assuming you also have the PP database set up)
53+
54+
```
55+
user = ApiUser.create(email: "[email protected]", full_name: "Test")
56+
user.activate!
57+
```
58+
59+
Retrieve your token with `user.token`
60+

api/v3/views/protected_area.rabl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ if @current_user.access_to?(ProtectedArea, :designation)
7070
end
7171
end
7272

73+
if @current_user.access_to?(ProtectedArea, :pame_evaluations)
74+
child :pame_evaluations, object_root: false do
75+
attributes :id, :method, :year
76+
end
77+
end
78+
7379
if @current_user.access_to?(ProtectedArea, :no_take_status)
7480
child :no_take_status, object_root: false do
7581
attributes :id, :name, :area

config/deploy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# config valid only for current version of Capistrano
2-
lock '3.4.0'
2+
lock '3.4.1'
33

44
set :application, 'protectedplanet-api'
55
set :repo_url, '[email protected]:unepwcmc/protectedplanet-api.git'

lib/mailer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'erb'
2+
13
module Mailer
24
NEW_REQUEST_TEMPLATE = ERB.new(File.read("lib/templates/new_request_notification.erb"))
35
def self.send_new_request_notification api_user, activation_url

models/pame_evaluation.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class PameEvaluation < ActiveRecord::Base
2+
belongs_to :protected_area
3+
end

models/protected_area.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ProtectedArea < ActiveRecord::Base
1515
:legal_status, :legal_status_updated_at,
1616
:management_plan, :management_authority,
1717
:governance, :reported_area, :reported_marine_area,
18-
:owner_type
18+
:owner_type, :pame_evaluations
1919
]
2020

2121
belongs_to :iucn_category
@@ -26,6 +26,7 @@ class ProtectedArea < ActiveRecord::Base
2626
belongs_to :management_authority
2727
has_and_belongs_to_many :countries, -> { select(:id, :name, :iso_3) }
2828
has_and_belongs_to_many :sub_locations
29+
has_many :pame_evaluations
2930

3031
delegate :jurisdiction, to: :designation, allow_nil: true
3132

0 commit comments

Comments
 (0)