grape-path-helpers 1.5.0 → 1.6.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/.gitlab-ci.yml +2 -2
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +19 -22
- data/lib/grape-path-helpers/named_route_matcher.rb +14 -6
- data/lib/grape-path-helpers/version.rb +1 -1
- data/spec/grape_path_helpers/named_route_matcher_spec.rb +4 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40792c146fc9c26dd609bc8dd99adce92b010820e3c2ca9644144f3493dd06ec
|
4
|
+
data.tar.gz: aed680f63272f1e61467787e0d374bb8a8145b61979c18b5c61e332763472cd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff06e53d14f8d46a398cc14754fbc61e7e1a1e28179aa83a27bbca47698c117daaf064f62d3e03e1a385112fea2c0dd076b102e64e4c2f1ffa3c4d4fae7d3279
|
7
|
+
data.tar.gz: 82fde6483c7ad996189c59ab9c79969495e642fb0274d9e209228b6633e6c6c731066a4bf24effa6e00e990f3fc82b94eca8084b469f64aad15e8f9a5f486728
|
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape-path-helpers (1.
|
4
|
+
grape-path-helpers (1.6.0)
|
5
5
|
activesupport
|
6
6
|
grape (~> 1.3)
|
7
7
|
rake (> 12)
|
@@ -9,32 +9,30 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
18
|
ast (2.4.0)
|
19
19
|
builder (3.2.4)
|
20
20
|
coderay (1.1.2)
|
21
21
|
concurrent-ruby (1.1.7)
|
22
22
|
diff-lcs (1.3)
|
23
|
-
dry-configurable (0.
|
23
|
+
dry-configurable (0.12.0)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
|
-
dry-core (~> 0.
|
26
|
-
dry-equalizer (~> 0.2)
|
25
|
+
dry-core (~> 0.5, >= 0.5.0)
|
27
26
|
dry-container (0.7.2)
|
28
27
|
concurrent-ruby (~> 1.0)
|
29
28
|
dry-configurable (~> 0.1, >= 0.1.3)
|
30
|
-
dry-core (0.
|
29
|
+
dry-core (0.5.0)
|
31
30
|
concurrent-ruby (~> 1.0)
|
32
31
|
dry-equalizer (0.3.0)
|
33
32
|
dry-inflector (0.2.0)
|
34
|
-
dry-logic (1.0
|
33
|
+
dry-logic (1.1.0)
|
35
34
|
concurrent-ruby (~> 1.0)
|
36
|
-
dry-core (~> 0.
|
37
|
-
dry-equalizer (~> 0.2)
|
35
|
+
dry-core (~> 0.5, >= 0.5)
|
38
36
|
dry-types (1.4.0)
|
39
37
|
concurrent-ruby (~> 1.0)
|
40
38
|
dry-container (~> 0.3)
|
@@ -42,17 +40,17 @@ GEM
|
|
42
40
|
dry-equalizer (~> 0.3)
|
43
41
|
dry-inflector (~> 0.1, >= 0.1.2)
|
44
42
|
dry-logic (~> 1.0, >= 1.0.2)
|
45
|
-
grape (1.5.
|
43
|
+
grape (1.5.1)
|
46
44
|
activesupport
|
47
45
|
builder
|
48
46
|
dry-types (>= 1.1)
|
49
47
|
mustermann-grape (~> 1.0.0)
|
50
48
|
rack (>= 1.3.0)
|
51
49
|
rack-accept
|
52
|
-
i18n (1.8.
|
50
|
+
i18n (1.8.7)
|
53
51
|
concurrent-ruby (~> 1.0)
|
54
52
|
method_source (0.9.0)
|
55
|
-
minitest (5.14.
|
53
|
+
minitest (5.14.3)
|
56
54
|
mustermann (1.1.1)
|
57
55
|
ruby2_keywords (~> 0.0.1)
|
58
56
|
mustermann-grape (1.0.1)
|
@@ -68,7 +66,7 @@ GEM
|
|
68
66
|
rack-accept (0.4.5)
|
69
67
|
rack (>= 0.4)
|
70
68
|
rainbow (3.0.0)
|
71
|
-
rake (13.0.
|
69
|
+
rake (13.0.3)
|
72
70
|
rspec (3.7.0)
|
73
71
|
rspec-core (~> 3.7.0)
|
74
72
|
rspec-expectations (~> 3.7.0)
|
@@ -91,11 +89,10 @@ GEM
|
|
91
89
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
92
90
|
ruby-progressbar (1.9.0)
|
93
91
|
ruby2_keywords (0.0.2)
|
94
|
-
|
95
|
-
|
96
|
-
thread_safe (~> 0.1)
|
92
|
+
tzinfo (2.0.4)
|
93
|
+
concurrent-ruby (~> 1.0)
|
97
94
|
unicode-display_width (1.3.3)
|
98
|
-
zeitwerk (2.4.
|
95
|
+
zeitwerk (2.4.2)
|
99
96
|
|
100
97
|
PLATFORMS
|
101
98
|
ruby
|
@@ -107,4 +104,4 @@ DEPENDENCIES
|
|
107
104
|
rubocop (~> 0.56)
|
108
105
|
|
109
106
|
BUNDLED WITH
|
110
|
-
2.
|
107
|
+
2.2.3
|
@@ -3,20 +3,28 @@ module GrapePathHelpers
|
|
3
3
|
# to unknown methods will look for a route with a matching
|
4
4
|
# helper function name
|
5
5
|
module NamedRouteMatcher
|
6
|
-
def method_missing(method_id, *
|
6
|
+
def method_missing(method_id, *args, **kwargs)
|
7
7
|
return super unless method_id.to_s =~ /_path$/
|
8
8
|
|
9
|
+
success, result = call_path_method(method_id, *args, **kwargs)
|
10
|
+
|
11
|
+
if success
|
12
|
+
result
|
13
|
+
else
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def call_path_method(method_id, *arguments)
|
9
19
|
segments = arguments.first || {}
|
10
20
|
|
11
21
|
route = Grape::API::Instance.decorated_routes.detect do |r|
|
12
22
|
route_match?(r, method_id, segments)
|
13
23
|
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
super
|
19
|
-
end
|
25
|
+
return false unless route
|
26
|
+
|
27
|
+
[true, route.send(method_id, *arguments)]
|
20
28
|
end
|
21
29
|
|
22
30
|
def respond_to_missing?(method_name, _include_private = false)
|
@@ -30,8 +30,8 @@ describe GrapePathHelpers::NamedRouteMatcher do
|
|
30
30
|
fake_class = Class.new do
|
31
31
|
prepend GrapePathHelpers::NamedRouteMatcher
|
32
32
|
|
33
|
-
def method_missing(
|
34
|
-
|
33
|
+
def method_missing(method_id, *args, **kwargs)
|
34
|
+
[method_id, args, kwargs] || super
|
35
35
|
end
|
36
36
|
|
37
37
|
def respond_to_missing?(_method_name, _include_private = false)
|
@@ -46,7 +46,8 @@ describe GrapePathHelpers::NamedRouteMatcher do
|
|
46
46
|
it 'returns super method_missing if the method does not end with path' do
|
47
47
|
expect(Grape::API::Instance).not_to receive(:decorated_routes)
|
48
48
|
|
49
|
-
helper_class.test_method
|
49
|
+
expect(helper_class.test_method(:arg1, kwarg1: :kwarg1))
|
50
|
+
.to eq([:test_method, [:arg1], { kwarg1: :kwarg1 }])
|
50
51
|
end
|
51
52
|
|
52
53
|
it 'search for the route if the method ends with path' do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-path-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drew Blessing
|
8
8
|
- Harper Henn
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -131,7 +131,7 @@ homepage: https://gitlab.com/gitlab-org/grape-path-helpers
|
|
131
131
|
licenses:
|
132
132
|
- MIT
|
133
133
|
metadata: {}
|
134
|
-
post_install_message:
|
134
|
+
post_install_message:
|
135
135
|
rdoc_options: []
|
136
136
|
require_paths:
|
137
137
|
- lib
|
@@ -146,8 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
149
|
+
rubygems_version: 3.2.3
|
150
|
+
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Route path helpers for Grape
|
153
153
|
test_files: []
|