introspective_grape 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/introspective_grape.gemspec +1 -1
- data/lib/introspective_grape/api.rb +9 -4
- data/lib/introspective_grape/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 241e7c16a1bb6c575a8dcf5af51190a9c02057e8a425d3b9df0c7004bd336263
|
4
|
+
data.tar.gz: bdb1de6b44a6be36418df88f3e1211969a8a0827a1f0bbc37e82b2b401899b2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97473f518ec0abc2dcb61fa9bfa733d988b930ea99f2fd032dade1f0e6d4b50624f9aba110e14ea17598a3a949b47fa9d88f5adc7cb344b0e4e391c09582036
|
7
|
+
data.tar.gz: 7a03151630d57796582eef585fe6ed767eb51c0eccd05fd470812c905add8017980552523c78f623844838b32af11f503caf75f94156c88b694c9d715caf01a8
|
data/CHANGELOG.md
CHANGED
data/introspective_grape.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.files = `git ls-files`.split("\n").sort
|
23
23
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
24
24
|
|
25
|
-
s.required_ruby_version = '
|
25
|
+
s.required_ruby_version = '> 2.5'
|
26
26
|
|
27
27
|
s.add_runtime_dependency 'rails', '~> 5.2'
|
28
28
|
s.add_runtime_dependency 'schema_validations'
|
@@ -99,13 +99,15 @@ module IntrospectiveGrape
|
|
99
99
|
# As routes are nested keep track of the routes, we are preventing siblings from
|
100
100
|
# appending to the routes array here:
|
101
101
|
routes = build_routes(routes, model)
|
102
|
-
define_routes(routes, whitelist)
|
103
102
|
|
104
103
|
# Top level declaration of the Grape::API namespace for the resource:
|
105
104
|
resource routes.first.name.pluralize do
|
106
|
-
# yield to
|
105
|
+
# yield to prepend user-defined routes under the root namespace first,
|
107
106
|
yield if block_given?
|
108
107
|
end
|
108
|
+
|
109
|
+
# Then define IntrospectiveGrape's routes:
|
110
|
+
define_routes(routes, whitelist)
|
109
111
|
end
|
110
112
|
|
111
113
|
def define_routes(routes, api_params)
|
@@ -209,12 +211,15 @@ module IntrospectiveGrape
|
|
209
211
|
end
|
210
212
|
|
211
213
|
# rubocop:enable Metrics/AbcSize
|
212
|
-
def define_destroy(dsl, routes,
|
214
|
+
def define_destroy(dsl, routes, model, _api_params)
|
213
215
|
klass = routes.first.klass
|
214
|
-
name
|
216
|
+
name = routes.last.name.singularize
|
215
217
|
dsl.desc "destroy a #{name}" do
|
216
218
|
detail klass.destroy_documentation(name)
|
217
219
|
end
|
220
|
+
dsl.params do
|
221
|
+
requires routes.last.swagger_key, type: klass.param_type(model, model.primary_key)
|
222
|
+
end
|
218
223
|
dsl.delete ":#{routes.last.swagger_key}" do
|
219
224
|
authorize @model, :destroy?
|
220
225
|
present status: (klass.find_leaf(routes, @model, params).destroy ? true : false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: introspective_grape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -531,7 +531,7 @@ require_paths:
|
|
531
531
|
- lib
|
532
532
|
required_ruby_version: !ruby/object:Gem::Requirement
|
533
533
|
requirements:
|
534
|
-
- - "
|
534
|
+
- - ">"
|
535
535
|
- !ruby/object:Gem::Version
|
536
536
|
version: '2.5'
|
537
537
|
required_rubygems_version: !ruby/object:Gem::Requirement
|