infinum_json_api_setup 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +45 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +48 -15
- data/Gemfile +1 -0
- data/Gemfile.lock +1 -0
- data/README.md +8 -0
- data/Rakefile +3 -0
- data/base.gemfile +14 -0
- data/infinum_json_api_setup.gemspec +11 -16
- data/lib/generators/infinum_json_api_setup/templates/config/locales/json_api.en.yml +1 -0
- data/lib/infinum_json_api_setup/json_api/content_negotiation.rb +2 -2
- data/lib/infinum_json_api_setup/json_api/locale_negotiation.rb +45 -0
- data/lib/infinum_json_api_setup/rspec/helpers/response_helper.rb +4 -4
- data/lib/infinum_json_api_setup/rspec/matchers/have_empty_data.rb +1 -1
- data/lib/infinum_json_api_setup/rspec/matchers/have_error_pointer.rb +1 -1
- data/lib/infinum_json_api_setup/rspec/matchers/have_resource_count_of.rb +1 -1
- data/lib/infinum_json_api_setup/version.rb +1 -1
- data/lib/infinum_json_api_setup.rb +3 -0
- data/rails.7.1.gemfile +8 -0
- data/rails.7.1.gemfile.lock +361 -0
- data/rails.8.0.gemfile +7 -0
- data/rails.8.0.gemfile.lock +380 -0
- data/spec/dummy/app/controllers/api/v1/base_controller.rb +1 -0
- data/spec/dummy/app/controllers/api/v1/hello_controller.rb +11 -0
- data/spec/dummy/app/controllers/api/v1/locations_controller.rb +7 -13
- data/spec/dummy/app/models/location.rb +1 -1
- data/spec/dummy/config/database.yml +3 -0
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/initializers/i18n.rb +3 -0
- data/spec/dummy/config/locales/de.yml +2 -0
- data/spec/dummy/config/locales/json_api.de.yml +22 -0
- data/spec/dummy/config/locales/json_api.en.yml +1 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/infinum_json_api_setup/rspec/helpers/response_helper_spec.rb +234 -0
- data/spec/infinum_json_api_setup/rspec/matchers/have_empty_data_spec.rb +3 -2
- data/spec/rails_helper.rb +2 -6
- data/spec/requests/api/v1/content_negotiation_spec.rb +10 -2
- data/spec/requests/api/v1/error_handling_spec.rb +37 -19
- data/spec/requests/api/v1/locale_negotiation_spec.rb +66 -0
- data/spec/requests/api/v1/responder_spec.rb +1 -1
- data/spec/requests/api/v1/serializer_options_spec.rb +1 -1
- metadata +46 -99
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -268
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
infinum_json_api_setup (0.1.0)
|
|
5
|
+
accept_language (~> 2.0)
|
|
6
|
+
json_schemer (>= 0.2, < 3)
|
|
7
|
+
jsonapi-query_builder
|
|
8
|
+
jsonapi-serializer
|
|
9
|
+
jsonapi_parameters
|
|
10
|
+
ostruct
|
|
11
|
+
pagy (~> 8.0)
|
|
12
|
+
rails
|
|
13
|
+
responders
|
|
14
|
+
|
|
15
|
+
GEM
|
|
16
|
+
remote: https://rubygems.org/
|
|
17
|
+
specs:
|
|
18
|
+
accept_language (2.0.8)
|
|
19
|
+
actioncable (8.0.2.1)
|
|
20
|
+
actionpack (= 8.0.2.1)
|
|
21
|
+
activesupport (= 8.0.2.1)
|
|
22
|
+
nio4r (~> 2.0)
|
|
23
|
+
websocket-driver (>= 0.6.1)
|
|
24
|
+
zeitwerk (~> 2.6)
|
|
25
|
+
actionmailbox (8.0.2.1)
|
|
26
|
+
actionpack (= 8.0.2.1)
|
|
27
|
+
activejob (= 8.0.2.1)
|
|
28
|
+
activerecord (= 8.0.2.1)
|
|
29
|
+
activestorage (= 8.0.2.1)
|
|
30
|
+
activesupport (= 8.0.2.1)
|
|
31
|
+
mail (>= 2.8.0)
|
|
32
|
+
actionmailer (8.0.2.1)
|
|
33
|
+
actionpack (= 8.0.2.1)
|
|
34
|
+
actionview (= 8.0.2.1)
|
|
35
|
+
activejob (= 8.0.2.1)
|
|
36
|
+
activesupport (= 8.0.2.1)
|
|
37
|
+
mail (>= 2.8.0)
|
|
38
|
+
rails-dom-testing (~> 2.2)
|
|
39
|
+
actionpack (8.0.2.1)
|
|
40
|
+
actionview (= 8.0.2.1)
|
|
41
|
+
activesupport (= 8.0.2.1)
|
|
42
|
+
nokogiri (>= 1.8.5)
|
|
43
|
+
rack (>= 2.2.4)
|
|
44
|
+
rack-session (>= 1.0.1)
|
|
45
|
+
rack-test (>= 0.6.3)
|
|
46
|
+
rails-dom-testing (~> 2.2)
|
|
47
|
+
rails-html-sanitizer (~> 1.6)
|
|
48
|
+
useragent (~> 0.16)
|
|
49
|
+
actiontext (8.0.2.1)
|
|
50
|
+
actionpack (= 8.0.2.1)
|
|
51
|
+
activerecord (= 8.0.2.1)
|
|
52
|
+
activestorage (= 8.0.2.1)
|
|
53
|
+
activesupport (= 8.0.2.1)
|
|
54
|
+
globalid (>= 0.6.0)
|
|
55
|
+
nokogiri (>= 1.8.5)
|
|
56
|
+
actionview (8.0.2.1)
|
|
57
|
+
activesupport (= 8.0.2.1)
|
|
58
|
+
builder (~> 3.1)
|
|
59
|
+
erubi (~> 1.11)
|
|
60
|
+
rails-dom-testing (~> 2.2)
|
|
61
|
+
rails-html-sanitizer (~> 1.6)
|
|
62
|
+
activejob (8.0.2.1)
|
|
63
|
+
activesupport (= 8.0.2.1)
|
|
64
|
+
globalid (>= 0.3.6)
|
|
65
|
+
activemodel (8.0.2.1)
|
|
66
|
+
activesupport (= 8.0.2.1)
|
|
67
|
+
activerecord (8.0.2.1)
|
|
68
|
+
activemodel (= 8.0.2.1)
|
|
69
|
+
activesupport (= 8.0.2.1)
|
|
70
|
+
timeout (>= 0.4.0)
|
|
71
|
+
activestorage (8.0.2.1)
|
|
72
|
+
actionpack (= 8.0.2.1)
|
|
73
|
+
activejob (= 8.0.2.1)
|
|
74
|
+
activerecord (= 8.0.2.1)
|
|
75
|
+
activesupport (= 8.0.2.1)
|
|
76
|
+
marcel (~> 1.0)
|
|
77
|
+
activesupport (8.0.2.1)
|
|
78
|
+
base64
|
|
79
|
+
benchmark (>= 0.3)
|
|
80
|
+
bigdecimal
|
|
81
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
82
|
+
connection_pool (>= 2.2.5)
|
|
83
|
+
drb
|
|
84
|
+
i18n (>= 1.6, < 2)
|
|
85
|
+
logger (>= 1.4.2)
|
|
86
|
+
minitest (>= 5.1)
|
|
87
|
+
securerandom (>= 0.3)
|
|
88
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
89
|
+
uri (>= 0.13.1)
|
|
90
|
+
ast (2.4.3)
|
|
91
|
+
base64 (0.3.0)
|
|
92
|
+
benchmark (0.4.1)
|
|
93
|
+
bigdecimal (3.2.3)
|
|
94
|
+
builder (3.3.0)
|
|
95
|
+
bundler-audit (0.9.2)
|
|
96
|
+
bundler (>= 1.2.0, < 3)
|
|
97
|
+
thor (~> 1.0)
|
|
98
|
+
childprocess (5.1.0)
|
|
99
|
+
logger (~> 1.5)
|
|
100
|
+
coderay (1.1.3)
|
|
101
|
+
concurrent-ruby (1.3.5)
|
|
102
|
+
connection_pool (2.5.4)
|
|
103
|
+
crass (1.0.6)
|
|
104
|
+
date (3.4.1)
|
|
105
|
+
diff-lcs (1.6.2)
|
|
106
|
+
docile (1.4.1)
|
|
107
|
+
drb (2.2.3)
|
|
108
|
+
erb (5.0.2)
|
|
109
|
+
erubi (1.13.1)
|
|
110
|
+
factory_bot (6.5.5)
|
|
111
|
+
activesupport (>= 6.1.0)
|
|
112
|
+
faker (2.23.0)
|
|
113
|
+
i18n (>= 1.8.11, < 2)
|
|
114
|
+
gemika (1.0.0)
|
|
115
|
+
globalid (1.2.1)
|
|
116
|
+
activesupport (>= 6.1)
|
|
117
|
+
hana (1.3.7)
|
|
118
|
+
i18n (1.14.7)
|
|
119
|
+
concurrent-ruby (~> 1.0)
|
|
120
|
+
iniparse (1.5.0)
|
|
121
|
+
io-console (0.8.1)
|
|
122
|
+
irb (1.15.2)
|
|
123
|
+
pp (>= 0.6.0)
|
|
124
|
+
rdoc (>= 4.0.0)
|
|
125
|
+
reline (>= 0.4.2)
|
|
126
|
+
json (2.13.2)
|
|
127
|
+
json_schemer (2.4.0)
|
|
128
|
+
bigdecimal
|
|
129
|
+
hana (~> 1.3)
|
|
130
|
+
regexp_parser (~> 2.0)
|
|
131
|
+
simpleidn (~> 0.2)
|
|
132
|
+
jsonapi-query_builder (0.3.0)
|
|
133
|
+
activerecord (>= 5)
|
|
134
|
+
pagy (>= 3.5)
|
|
135
|
+
jsonapi-serializer (2.2.0)
|
|
136
|
+
activesupport (>= 4.2)
|
|
137
|
+
jsonapi_parameters (2.3.0)
|
|
138
|
+
actionpack (>= 4.1.8)
|
|
139
|
+
activesupport (>= 4.1.8)
|
|
140
|
+
language_server-protocol (3.17.0.5)
|
|
141
|
+
lint_roller (1.1.0)
|
|
142
|
+
logger (1.7.0)
|
|
143
|
+
loofah (2.24.1)
|
|
144
|
+
crass (~> 1.0.2)
|
|
145
|
+
nokogiri (>= 1.12.0)
|
|
146
|
+
mail (2.8.1)
|
|
147
|
+
mini_mime (>= 0.1.1)
|
|
148
|
+
net-imap
|
|
149
|
+
net-pop
|
|
150
|
+
net-smtp
|
|
151
|
+
marcel (1.0.4)
|
|
152
|
+
method_source (1.1.0)
|
|
153
|
+
mini_mime (1.1.5)
|
|
154
|
+
minitest (5.25.5)
|
|
155
|
+
net-imap (0.5.10)
|
|
156
|
+
date
|
|
157
|
+
net-protocol
|
|
158
|
+
net-pop (0.1.2)
|
|
159
|
+
net-protocol
|
|
160
|
+
net-protocol (0.2.2)
|
|
161
|
+
timeout
|
|
162
|
+
net-smtp (0.5.1)
|
|
163
|
+
net-protocol
|
|
164
|
+
nio4r (2.7.4)
|
|
165
|
+
nokogiri (1.18.9-aarch64-linux-gnu)
|
|
166
|
+
racc (~> 1.4)
|
|
167
|
+
nokogiri (1.18.9-aarch64-linux-musl)
|
|
168
|
+
racc (~> 1.4)
|
|
169
|
+
nokogiri (1.18.9-arm-linux-gnu)
|
|
170
|
+
racc (~> 1.4)
|
|
171
|
+
nokogiri (1.18.9-arm-linux-musl)
|
|
172
|
+
racc (~> 1.4)
|
|
173
|
+
nokogiri (1.18.9-arm64-darwin)
|
|
174
|
+
racc (~> 1.4)
|
|
175
|
+
nokogiri (1.18.9-x86_64-darwin)
|
|
176
|
+
racc (~> 1.4)
|
|
177
|
+
nokogiri (1.18.9-x86_64-linux-gnu)
|
|
178
|
+
racc (~> 1.4)
|
|
179
|
+
nokogiri (1.18.9-x86_64-linux-musl)
|
|
180
|
+
racc (~> 1.4)
|
|
181
|
+
ostruct (0.6.3)
|
|
182
|
+
overcommit (0.68.0)
|
|
183
|
+
childprocess (>= 0.6.3, < 6)
|
|
184
|
+
iniparse (~> 1.4)
|
|
185
|
+
rexml (>= 3.3.9)
|
|
186
|
+
pagy (8.6.3)
|
|
187
|
+
parallel (1.27.0)
|
|
188
|
+
parser (3.3.9.0)
|
|
189
|
+
ast (~> 2.4.1)
|
|
190
|
+
racc
|
|
191
|
+
pg (1.6.1)
|
|
192
|
+
pg (1.6.1-aarch64-linux)
|
|
193
|
+
pg (1.6.1-aarch64-linux-musl)
|
|
194
|
+
pg (1.6.1-arm64-darwin)
|
|
195
|
+
pg (1.6.1-x86_64-darwin)
|
|
196
|
+
pg (1.6.1-x86_64-linux)
|
|
197
|
+
pg (1.6.1-x86_64-linux-musl)
|
|
198
|
+
pp (0.6.2)
|
|
199
|
+
prettyprint
|
|
200
|
+
prettyprint (0.2.0)
|
|
201
|
+
prism (1.4.0)
|
|
202
|
+
pry (0.15.2)
|
|
203
|
+
coderay (~> 1.1)
|
|
204
|
+
method_source (~> 1.0)
|
|
205
|
+
pry-rails (0.3.11)
|
|
206
|
+
pry (>= 0.13.0)
|
|
207
|
+
psych (5.2.6)
|
|
208
|
+
date
|
|
209
|
+
stringio
|
|
210
|
+
pundit (2.5.0)
|
|
211
|
+
activesupport (>= 3.0.0)
|
|
212
|
+
racc (1.8.1)
|
|
213
|
+
rack (3.2.4)
|
|
214
|
+
rack-session (2.1.1)
|
|
215
|
+
base64 (>= 0.1.0)
|
|
216
|
+
rack (>= 3.0.0)
|
|
217
|
+
rack-test (2.2.0)
|
|
218
|
+
rack (>= 1.3)
|
|
219
|
+
rackup (2.2.1)
|
|
220
|
+
rack (>= 3)
|
|
221
|
+
rails (8.0.2.1)
|
|
222
|
+
actioncable (= 8.0.2.1)
|
|
223
|
+
actionmailbox (= 8.0.2.1)
|
|
224
|
+
actionmailer (= 8.0.2.1)
|
|
225
|
+
actionpack (= 8.0.2.1)
|
|
226
|
+
actiontext (= 8.0.2.1)
|
|
227
|
+
actionview (= 8.0.2.1)
|
|
228
|
+
activejob (= 8.0.2.1)
|
|
229
|
+
activemodel (= 8.0.2.1)
|
|
230
|
+
activerecord (= 8.0.2.1)
|
|
231
|
+
activestorage (= 8.0.2.1)
|
|
232
|
+
activesupport (= 8.0.2.1)
|
|
233
|
+
bundler (>= 1.15.0)
|
|
234
|
+
railties (= 8.0.2.1)
|
|
235
|
+
rails-dom-testing (2.3.0)
|
|
236
|
+
activesupport (>= 5.0.0)
|
|
237
|
+
minitest
|
|
238
|
+
nokogiri (>= 1.6)
|
|
239
|
+
rails-html-sanitizer (1.6.2)
|
|
240
|
+
loofah (~> 2.21)
|
|
241
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
242
|
+
railties (8.0.2.1)
|
|
243
|
+
actionpack (= 8.0.2.1)
|
|
244
|
+
activesupport (= 8.0.2.1)
|
|
245
|
+
irb (~> 1.13)
|
|
246
|
+
rackup (>= 1.0.0)
|
|
247
|
+
rake (>= 12.2)
|
|
248
|
+
thor (~> 1.0, >= 1.2.2)
|
|
249
|
+
zeitwerk (~> 2.6)
|
|
250
|
+
rainbow (3.1.1)
|
|
251
|
+
rake (13.3.0)
|
|
252
|
+
rdoc (6.14.2)
|
|
253
|
+
erb
|
|
254
|
+
psych (>= 4.0.0)
|
|
255
|
+
regexp_parser (2.11.2)
|
|
256
|
+
reline (0.6.2)
|
|
257
|
+
io-console (~> 0.5)
|
|
258
|
+
responders (3.1.1)
|
|
259
|
+
actionpack (>= 5.2)
|
|
260
|
+
railties (>= 5.2)
|
|
261
|
+
rexml (3.4.2)
|
|
262
|
+
rspec-core (3.13.5)
|
|
263
|
+
rspec-support (~> 3.13.0)
|
|
264
|
+
rspec-expectations (3.13.5)
|
|
265
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
266
|
+
rspec-support (~> 3.13.0)
|
|
267
|
+
rspec-mocks (3.13.5)
|
|
268
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
269
|
+
rspec-support (~> 3.13.0)
|
|
270
|
+
rspec-rails (8.0.2)
|
|
271
|
+
actionpack (>= 7.2)
|
|
272
|
+
activesupport (>= 7.2)
|
|
273
|
+
railties (>= 7.2)
|
|
274
|
+
rspec-core (~> 3.13)
|
|
275
|
+
rspec-expectations (~> 3.13)
|
|
276
|
+
rspec-mocks (~> 3.13)
|
|
277
|
+
rspec-support (~> 3.13)
|
|
278
|
+
rspec-support (3.13.5)
|
|
279
|
+
rubocop (1.80.1)
|
|
280
|
+
json (~> 2.3)
|
|
281
|
+
language_server-protocol (~> 3.17.0.2)
|
|
282
|
+
lint_roller (~> 1.1.0)
|
|
283
|
+
parallel (~> 1.10)
|
|
284
|
+
parser (>= 3.3.0.2)
|
|
285
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
286
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
287
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
|
288
|
+
ruby-progressbar (~> 1.7)
|
|
289
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
290
|
+
rubocop-ast (1.46.0)
|
|
291
|
+
parser (>= 3.3.7.2)
|
|
292
|
+
prism (~> 1.4)
|
|
293
|
+
rubocop-factory_bot (2.27.1)
|
|
294
|
+
lint_roller (~> 1.1)
|
|
295
|
+
rubocop (~> 1.72, >= 1.72.1)
|
|
296
|
+
rubocop-infinum (1.0.0)
|
|
297
|
+
lint_roller
|
|
298
|
+
rubocop (>= 1.72.1)
|
|
299
|
+
rubocop-factory_bot (>= 2.27.1)
|
|
300
|
+
rubocop-performance (>= 1.24.0)
|
|
301
|
+
rubocop-rails (>= 2.30.0)
|
|
302
|
+
rubocop-rspec (>= 3.5.0)
|
|
303
|
+
rubocop-rspec_rails (>= 2.31.0)
|
|
304
|
+
rubocop-performance (1.25.0)
|
|
305
|
+
lint_roller (~> 1.1)
|
|
306
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
307
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
|
308
|
+
rubocop-rails (2.33.3)
|
|
309
|
+
activesupport (>= 4.2.0)
|
|
310
|
+
lint_roller (~> 1.1)
|
|
311
|
+
rack (>= 1.1)
|
|
312
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
313
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
|
314
|
+
rubocop-rake (0.7.1)
|
|
315
|
+
lint_roller (~> 1.1)
|
|
316
|
+
rubocop (>= 1.72.1)
|
|
317
|
+
rubocop-rspec (3.7.0)
|
|
318
|
+
lint_roller (~> 1.1)
|
|
319
|
+
rubocop (~> 1.72, >= 1.72.1)
|
|
320
|
+
rubocop-rspec_rails (2.31.0)
|
|
321
|
+
lint_roller (~> 1.1)
|
|
322
|
+
rubocop (~> 1.72, >= 1.72.1)
|
|
323
|
+
rubocop-rspec (~> 3.5)
|
|
324
|
+
ruby-progressbar (1.13.0)
|
|
325
|
+
securerandom (0.4.1)
|
|
326
|
+
simplecov (0.22.0)
|
|
327
|
+
docile (~> 1.1)
|
|
328
|
+
simplecov-html (~> 0.11)
|
|
329
|
+
simplecov_json_formatter (~> 0.1)
|
|
330
|
+
simplecov-html (0.13.2)
|
|
331
|
+
simplecov_json_formatter (0.1.4)
|
|
332
|
+
simpleidn (0.2.3)
|
|
333
|
+
stringio (3.1.7)
|
|
334
|
+
thor (1.4.0)
|
|
335
|
+
timeout (0.4.3)
|
|
336
|
+
tzinfo (2.0.6)
|
|
337
|
+
concurrent-ruby (~> 1.0)
|
|
338
|
+
unicode-display_width (3.1.5)
|
|
339
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
340
|
+
unicode-emoji (4.0.4)
|
|
341
|
+
uri (1.0.3)
|
|
342
|
+
useragent (0.16.11)
|
|
343
|
+
websocket-driver (0.8.0)
|
|
344
|
+
base64
|
|
345
|
+
websocket-extensions (>= 0.1.0)
|
|
346
|
+
websocket-extensions (0.1.5)
|
|
347
|
+
zeitwerk (2.7.3)
|
|
348
|
+
|
|
349
|
+
PLATFORMS
|
|
350
|
+
aarch64-linux
|
|
351
|
+
aarch64-linux-gnu
|
|
352
|
+
aarch64-linux-musl
|
|
353
|
+
arm-linux-gnu
|
|
354
|
+
arm-linux-musl
|
|
355
|
+
arm64-darwin
|
|
356
|
+
x86_64-darwin
|
|
357
|
+
x86_64-linux
|
|
358
|
+
x86_64-linux-gnu
|
|
359
|
+
x86_64-linux-musl
|
|
360
|
+
|
|
361
|
+
DEPENDENCIES
|
|
362
|
+
bundler-audit
|
|
363
|
+
factory_bot (~> 6.2)
|
|
364
|
+
faker (~> 2.18)
|
|
365
|
+
gemika
|
|
366
|
+
infinum_json_api_setup!
|
|
367
|
+
overcommit (~> 0.58)
|
|
368
|
+
pg
|
|
369
|
+
pry-rails
|
|
370
|
+
pundit
|
|
371
|
+
rails (~> 8.0.0)
|
|
372
|
+
rake
|
|
373
|
+
rspec-rails (~> 8.0)
|
|
374
|
+
rubocop (~> 1.0)
|
|
375
|
+
rubocop-infinum
|
|
376
|
+
rubocop-rake
|
|
377
|
+
simplecov
|
|
378
|
+
|
|
379
|
+
BUNDLED WITH
|
|
380
|
+
2.6.5
|
|
@@ -3,6 +3,7 @@ module Api
|
|
|
3
3
|
class BaseController < ApplicationController
|
|
4
4
|
include InfinumJsonApiSetup::JsonApi::ErrorHandling
|
|
5
5
|
include InfinumJsonApiSetup::JsonApi::ContentNegotiation
|
|
6
|
+
include InfinumJsonApiSetup::JsonApi::LocaleNegotiation
|
|
6
7
|
|
|
7
8
|
self.responder = InfinumJsonApiSetup::JsonApi::Responder
|
|
8
9
|
respond_to :json_api
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
module Api
|
|
2
2
|
module V1
|
|
3
3
|
class LocationsController < BaseController
|
|
4
|
-
include Pundit
|
|
5
|
-
|
|
6
|
-
around_action :with_locale
|
|
4
|
+
include Pundit::Authorization
|
|
7
5
|
|
|
8
6
|
# GET /api/v1/locations
|
|
9
7
|
def index
|
|
@@ -12,16 +10,16 @@ module Api
|
|
|
12
10
|
respond_with q.results, pagination_details: q.pagination_details
|
|
13
11
|
end
|
|
14
12
|
|
|
15
|
-
# GET /api/v1/locations
|
|
16
|
-
def
|
|
17
|
-
location = Location.
|
|
13
|
+
# GET /api/v1/locations/:id
|
|
14
|
+
def show
|
|
15
|
+
location = authorize(Location.find(params[:id]))
|
|
18
16
|
|
|
19
17
|
respond_with location
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
# GET /api/v1/locations
|
|
23
|
-
def
|
|
24
|
-
location =
|
|
20
|
+
# GET /api/v1/locations
|
|
21
|
+
def create
|
|
22
|
+
location = Location.create(permitted_params)
|
|
25
23
|
|
|
26
24
|
respond_with location
|
|
27
25
|
end
|
|
@@ -44,10 +42,6 @@ module Api
|
|
|
44
42
|
|
|
45
43
|
private
|
|
46
44
|
|
|
47
|
-
def with_locale(&block)
|
|
48
|
-
I18n.with_locale(params.fetch(:locale, :en), &block)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
45
|
def permitted_params
|
|
52
46
|
params.require(:location).permit(:latitude, :longitude)
|
|
53
47
|
end
|
|
@@ -11,7 +11,7 @@ class Location < ApplicationRecord
|
|
|
11
11
|
X_AXIS = :x_axis
|
|
12
12
|
Y_AXIS = :y_axis
|
|
13
13
|
|
|
14
|
-
has_many :labels, class_name: 'LocationLabel'
|
|
14
|
+
has_many :labels, class_name: 'LocationLabel', dependent: :destroy
|
|
15
15
|
validates :latitude, numericality: { greater_than_or_equal_to: MIN_LATITUDE,
|
|
16
16
|
less_than_or_equal_to: MAX_LATITUDE }
|
|
17
17
|
validates :longitude, numericality: { greater_than_or_equal_to: MIN_LONGITUDE,
|
|
@@ -75,7 +75,7 @@ Rails.application.configure do
|
|
|
75
75
|
config.active_support.disallowed_deprecation_warnings = []
|
|
76
76
|
|
|
77
77
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
78
|
-
config.log_formatter =
|
|
78
|
+
config.log_formatter = Logger::Formatter.new
|
|
79
79
|
|
|
80
80
|
# Use a different logger for distributed setups.
|
|
81
81
|
# require "syslog/logger"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
de:
|
|
2
|
+
json_api:
|
|
3
|
+
errors:
|
|
4
|
+
bad_request:
|
|
5
|
+
title: Ungültige Anfrage
|
|
6
|
+
detail: Ungültige Anfrage
|
|
7
|
+
invalid_locale: Ungültige Sprache
|
|
8
|
+
not_found:
|
|
9
|
+
title: Nicht gefunden
|
|
10
|
+
detail: Ressource nicht gefunden
|
|
11
|
+
forbidden:
|
|
12
|
+
title: Verboten
|
|
13
|
+
detail: Sie dürfen diese Aktion nicht ausführen
|
|
14
|
+
unauthorized:
|
|
15
|
+
title: Nicht autorisiert
|
|
16
|
+
detail: Sie müssen angemeldet sein, um diese Aktion auszuführen
|
|
17
|
+
unprocessable_entity:
|
|
18
|
+
title: Nicht verarbeitbar
|
|
19
|
+
detail: Anfrage kann nicht verarbeitet werden
|
|
20
|
+
internal_server_error:
|
|
21
|
+
title: Interner Fehler
|
|
22
|
+
detail: Ein interner Fehler ist aufgetreten
|