introspective_grape 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +23 -0
  3. data/.github/workflows/test.yml +18 -0
  4. data/.rubocop.yml +84 -1173
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +19 -0
  7. data/Gemfile +3 -5
  8. data/README.md +95 -63
  9. data/Rakefile +1 -6
  10. data/introspective_grape.gemspec +63 -51
  11. data/lib/introspective_grape/api.rb +167 -136
  12. data/lib/introspective_grape/camel_snake.rb +5 -3
  13. data/lib/introspective_grape/create_helpers.rb +3 -5
  14. data/lib/introspective_grape/doc.rb +19 -5
  15. data/lib/introspective_grape/filters.rb +98 -83
  16. data/lib/introspective_grape/formatter/camel_json.rb +2 -3
  17. data/lib/introspective_grape/helpers.rb +55 -48
  18. data/lib/introspective_grape/snake_params.rb +1 -2
  19. data/lib/introspective_grape/traversal.rb +33 -31
  20. data/lib/introspective_grape/validators.rb +23 -23
  21. data/lib/introspective_grape/version.rb +3 -1
  22. data/spec/dummy/Gemfile +5 -4
  23. data/spec/dummy/app/api/api_helpers.rb +1 -1
  24. data/spec/dummy/app/api/dummy/company_api.rb +1 -1
  25. data/spec/dummy/app/api/dummy/project_api.rb +1 -0
  26. data/spec/dummy/app/api/dummy/sessions.rb +1 -1
  27. data/spec/dummy/app/api/dummy_api.rb +8 -2
  28. data/spec/dummy/app/assets/config/manifest.js +4 -0
  29. data/spec/dummy/app/models/user.rb +1 -1
  30. data/spec/dummy/config/database.yml +1 -1
  31. data/spec/rails_helper.rb +1 -1
  32. metadata +147 -42
  33. data/.coveralls.yml +0 -2
  34. data/.travis.yml +0 -40
  35. data/bin/rails +0 -12
  36. data/gemfiles/Gemfile.rails.5.0.0 +0 -14
  37. data/gemfiles/Gemfile.rails.5.0.1 +0 -14
  38. data/gemfiles/Gemfile.rails.5.1.0 +0 -14
  39. data/gemfiles/Gemfile.rails.5.2.0 +0 -14
  40. data/gemfiles/Gemfile.rails.master +0 -14
metadata CHANGED
@@ -1,63 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: introspective_grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Buermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-29 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">"
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: schema_validations
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
25
32
  - !ruby/object:Gem::Version
26
- version: 5.0.0
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rack
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "<"
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 2.0.9
47
+ version: '0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "<"
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 2.0.9
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: grape
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 1.2.0
48
- - - "<"
59
+ - - ">="
49
60
  - !ruby/object:Gem::Version
50
- version: 1.2.5
61
+ version: '0'
51
62
  type: :runtime
52
63
  prerelease: false
53
64
  version_requirements: !ruby/object:Gem::Requirement
54
65
  requirements:
55
- - - "~>"
66
+ - - ">="
56
67
  - !ruby/object:Gem::Version
57
- version: 1.2.0
58
- - - "<"
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dry-types
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
59
74
  - !ruby/object:Gem::Version
60
- version: 1.2.5
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
61
83
  - !ruby/object:Gem::Dependency
62
84
  name: grape-entity
63
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +122,20 @@ dependencies:
100
122
  - - ">="
101
123
  - !ruby/object:Gem::Version
102
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: grape-kaminari
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
103
139
  - !ruby/object:Gem::Dependency
104
140
  name: pundit
105
141
  requirement: !ruby/object:Gem::Requirement
@@ -132,16 +168,16 @@ dependencies:
132
168
  name: sqlite3
133
169
  requirement: !ruby/object:Gem::Requirement
134
170
  requirements:
135
- - - "<"
171
+ - - ">="
136
172
  - !ruby/object:Gem::Version
137
- version: 1.4.0
173
+ version: '0'
138
174
  type: :development
139
175
  prerelease: false
140
176
  version_requirements: !ruby/object:Gem::Requirement
141
177
  requirements:
142
- - - "<"
178
+ - - ">="
143
179
  - !ruby/object:Gem::Version
144
- version: 1.4.0
180
+ version: '0'
145
181
  - !ruby/object:Gem::Dependency
146
182
  name: rspec-rails
147
183
  requirement: !ruby/object:Gem::Requirement
@@ -157,7 +193,7 @@ dependencies:
157
193
  - !ruby/object:Gem::Version
158
194
  version: '3.0'
159
195
  - !ruby/object:Gem::Dependency
160
- name: devise
196
+ name: coveralls_reborn
161
197
  requirement: !ruby/object:Gem::Requirement
162
198
  requirements:
163
199
  - - ">="
@@ -171,19 +207,75 @@ dependencies:
171
207
  - !ruby/object:Gem::Version
172
208
  version: '0'
173
209
  - !ruby/object:Gem::Dependency
174
- name: paperclip
210
+ name: simplecov
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: bundler-audit
175
225
  requirement: !ruby/object:Gem::Requirement
176
226
  requirements:
177
227
  - - ">="
178
228
  - !ruby/object:Gem::Version
179
- version: 5.2.0
229
+ version: '0'
180
230
  type: :development
181
231
  prerelease: false
182
232
  version_requirements: !ruby/object:Gem::Requirement
183
233
  requirements:
184
234
  - - ">="
185
235
  - !ruby/object:Gem::Version
186
- version: 5.2.0
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: brakeman
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rubocop
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: byebug
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
187
279
  - !ruby/object:Gem::Dependency
188
280
  name: machinist_redux
189
281
  requirement: !ruby/object:Gem::Requirement
@@ -199,7 +291,7 @@ dependencies:
199
291
  - !ruby/object:Gem::Version
200
292
  version: '0'
201
293
  - !ruby/object:Gem::Dependency
202
- name: simplecov
294
+ name: paperclip
203
295
  requirement: !ruby/object:Gem::Requirement
204
296
  requirements:
205
297
  - - ">="
@@ -226,19 +318,36 @@ dependencies:
226
318
  - - ">="
227
319
  - !ruby/object:Gem::Version
228
320
  version: '0'
229
- description: Introspectively configure deeply nested RESTful Grape APIs for ActiveRecord
230
- models.
321
+ - !ruby/object:Gem::Dependency
322
+ name: devise
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - ">="
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
335
+ description: |2
336
+ IntrospectiveGrape provides handling for deeply nested relations according to the models'
337
+ `accepts_nested_attributes_for` declarations, generating all the necessary
338
+ boilerplate for flexible and consistent bulk endpoints on plural associations,
339
+ and building nested routes for the same.
231
340
  email:
232
341
  - buermann@gmail.com
233
342
  executables: []
234
343
  extensions: []
235
344
  extra_rdoc_files: []
236
345
  files:
237
- - ".coveralls.yml"
346
+ - ".github/workflows/lint.yml"
347
+ - ".github/workflows/test.yml"
238
348
  - ".gitignore"
239
349
  - ".rubocop.yml"
240
350
  - ".ruby-version"
241
- - ".travis.yml"
242
351
  - CHANGELOG.md
243
352
  - Gemfile
244
353
  - MIT-LICENSE
@@ -251,12 +360,6 @@ files:
251
360
  - app/mailers/.keep
252
361
  - app/models/.keep
253
362
  - app/views/.keep
254
- - bin/rails
255
- - gemfiles/Gemfile.rails.5.0.0
256
- - gemfiles/Gemfile.rails.5.0.1
257
- - gemfiles/Gemfile.rails.5.1.0
258
- - gemfiles/Gemfile.rails.5.2.0
259
- - gemfiles/Gemfile.rails.master
260
363
  - introspective_grape.gemspec
261
364
  - lib/introspective_grape.rb
262
365
  - lib/introspective_grape/api.rb
@@ -287,6 +390,7 @@ files:
287
390
  - spec/dummy/app/api/dummy_api.rb
288
391
  - spec/dummy/app/api/error_handlers.rb
289
392
  - spec/dummy/app/api/permissions_helper.rb
393
+ - spec/dummy/app/assets/config/manifest.js
290
394
  - spec/dummy/app/assets/images/.keep
291
395
  - spec/dummy/app/assets/javascripts/application.js
292
396
  - spec/dummy/app/assets/stylesheets/application.css
@@ -427,18 +531,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
427
531
  requirements:
428
532
  - - ">="
429
533
  - !ruby/object:Gem::Version
430
- version: '2.3'
534
+ version: '2.5'
431
535
  required_rubygems_version: !ruby/object:Gem::Requirement
432
536
  requirements:
433
537
  - - ">="
434
538
  - !ruby/object:Gem::Version
435
539
  version: '0'
436
540
  requirements: []
437
- rubygems_version: 3.1.2
541
+ rubyforge_project:
542
+ rubygems_version: 2.7.3
438
543
  signing_key:
439
544
  specification_version: 4
440
- summary: Introspectively configure deeply nested RESTful Grape APIs for ActiveRecord
441
- models.
545
+ summary: Quickly configure Grape APIs around your database schema and models.
442
546
  test_files:
443
547
  - spec/dummy/Gemfile
444
548
  - spec/dummy/README.rdoc
@@ -455,6 +559,7 @@ test_files:
455
559
  - spec/dummy/app/api/dummy_api.rb
456
560
  - spec/dummy/app/api/error_handlers.rb
457
561
  - spec/dummy/app/api/permissions_helper.rb
562
+ - spec/dummy/app/assets/config/manifest.js
458
563
  - spec/dummy/app/assets/images/.keep
459
564
  - spec/dummy/app/assets/javascripts/application.js
460
565
  - spec/dummy/app/assets/stylesheets/application.css
data/.coveralls.yml DELETED
@@ -1,2 +0,0 @@
1
- service_name: travis-ci
2
-
data/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem install bundler -v 1.17.3
4
- install: bundle install --jobs=1 --retry=1
5
- script:
6
- - bundle install
7
- - bundle exec rspec
8
-
9
- rvm:
10
- - 2.3.1
11
- - 2.4.0
12
- - 2.5.0
13
- - ruby-head
14
- - jruby-head
15
- gemfile:
16
- - gemfiles/Gemfile.rails.5.0.1
17
- - gemfiles/Gemfile.rails.5.1.0
18
- - gemfiles/Gemfile.rails.5.2.0
19
- - gemfiles/Gemfile.rails.master
20
-
21
- matrix:
22
- exclude:
23
- - rvm: jruby-9.0.4.0
24
- gemfile: gemfiles/Gemfile.rails.5.0.1
25
- - rvm: jruby-9.0.4.0
26
- gemfile: gemfiles/Gemfile.rails.master
27
- allow_failures:
28
- - rvm: ruby-head
29
- - rvm: jruby-head
30
-
31
- env:
32
- global:
33
- - JRUBY_OPTS="-J-Xmx1024m --debug"
34
-
35
- notifications:
36
- email:
37
- recipients:
38
- - buermann@gmail.com
39
- on_success: change
40
- on_failure: always
data/bin/rails DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
-
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/introspective_grape/engine', __FILE__)
6
-
7
- # Set up gems listed in the Gemfile.
8
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
-
11
- require 'rails/all'
12
- require 'rails/engine/commands'
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec :path => '../'
4
-
5
- gem 'rails', '5.0.0'
6
- gem 'grape'
7
- gem 'grape-kaminari', :github => 'alexey-klimuk/grape-kaminari'
8
- gem 'grape-swagger'
9
- gem 'nokogiri'
10
- gem 'coveralls', require: false
11
-
12
- group :development,:test do
13
- gem 'rspec'
14
- end
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec :path => '../'
4
-
5
- gem 'rails', '5.0.1'
6
- gem 'grape'
7
- gem 'grape-kaminari', :github => 'alexey-klimuk/grape-kaminari'
8
- gem 'grape-swagger'
9
- gem 'nokogiri'
10
- gem 'coveralls', require: false
11
-
12
- group :development,:test do
13
- gem 'rspec'
14
- end
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec :path => '../'
4
-
5
- gem 'rails', '5.1.0'
6
- gem 'grape'
7
- gem 'grape-kaminari', :github => 'alexey-klimuk/grape-kaminari'
8
- gem 'grape-swagger'
9
- gem 'nokogiri'
10
- gem 'coveralls', require: false
11
-
12
- group :development,:test do
13
- gem 'rspec'
14
- end
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec :path => '../'
4
-
5
- gem 'rails', '5.2.0'
6
- gem 'grape'
7
- gem 'grape-kaminari', :github => 'alexey-klimuk/grape-kaminari'
8
- gem 'grape-swagger'
9
- gem 'nokogiri'
10
- gem 'coveralls', require: false
11
-
12
- group :development,:test do
13
- gem 'rspec'
14
- end
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec :path => '../'
4
-
5
- gem 'rails'
6
- gem 'grape'
7
- gem 'grape-kaminari', :github => 'alexey-klimuk/grape-kaminari'
8
- gem 'grape-swagger'
9
- gem 'nokogiri'
10
- gem 'coveralls', require: false
11
-
12
- group :development,:test do
13
- gem 'rspec'
14
- end