grape-path-helpers 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0bb904ceffcf1cf4e877c5f97558f9d44883675269b20f6b8b76e74ba030fb0
4
- data.tar.gz: ddf94c3bc25ef08377160f78298ae9905b6b83099cfaacec4e50202723582e5c
3
+ metadata.gz: 40792c146fc9c26dd609bc8dd99adce92b010820e3c2ca9644144f3493dd06ec
4
+ data.tar.gz: aed680f63272f1e61467787e0d374bb8a8145b61979c18b5c61e332763472cd5
5
5
  SHA512:
6
- metadata.gz: ded4e9c49e798b3127ca4169b269c09a68890c498d079d6bca2a9ca06532b0bacb2f09615b82f04646fc988a4bfcfa995623c9e93e5ec7a6e52e4df69698cf07
7
- data.tar.gz: 93eaa299b50943cd6d8bcfd72f48f97da3d89ac557cabab44f6976297e275bb6fc2cf684ec6b9aa36fa8774980097c825a22978e19a86294a9944edac61b3559
6
+ metadata.gz: ff06e53d14f8d46a398cc14754fbc61e7e1a1e28179aa83a27bbca47698c117daaf064f62d3e03e1a385112fea2c0dd076b102e64e4c2f1ffa3c4d4fae7d3279
7
+ data.tar.gz: 82fde6483c7ad996189c59ab9c79969495e642fb0274d9e209228b6633e6c6c731066a4bf24effa6e00e990f3fc82b94eca8084b469f64aad15e8f9a5f486728
@@ -1,9 +1,9 @@
1
- image: "ruby:2.7-alpine"
1
+ image: "ruby:3.0-alpine"
2
2
 
3
3
  cache:
4
4
  paths:
5
5
  - vendor/ruby
6
- key: ruby-2.7
6
+ key: ruby-3.0
7
7
 
8
8
  before_script:
9
9
  - apk add --update git
@@ -8,3 +8,7 @@ Metrics/MethodLength:
8
8
 
9
9
  Style/FileName:
10
10
  Enabled: false
11
+
12
+ # Removed in newer versions of Rubocop
13
+ Lint/SplatKeywordArguments:
14
+ Enabled: false
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0
4
+
5
+ * [Extract kwargs to fix 2.7 warnings](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/29)
6
+
3
7
  ## 1.5.0
4
8
 
5
9
  * [Relax rake dependency](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/27)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-path-helpers (1.5.0)
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.0.3.4)
12
+ activesupport (6.1.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.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.11.6)
23
+ dry-configurable (0.12.0)
24
24
  concurrent-ruby (~> 1.0)
25
- dry-core (~> 0.4, >= 0.4.7)
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.4.9)
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.8)
33
+ dry-logic (1.1.0)
35
34
  concurrent-ruby (~> 1.0)
36
- dry-core (~> 0.2)
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.0)
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.5)
50
+ i18n (1.8.7)
53
51
  concurrent-ruby (~> 1.0)
54
52
  method_source (0.9.0)
55
- minitest (5.14.2)
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.1)
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
- thread_safe (0.3.6)
95
- tzinfo (1.2.7)
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.1)
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.1.4
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, *arguments)
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
- if route
16
- route.send(method_id, *arguments)
17
- else
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)
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module GrapePathHelpers
3
- VERSION = '1.5.0'.freeze
3
+ VERSION = '1.6.0'.freeze
4
4
  end
@@ -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(_method_id, *_args)
34
- 'whatever' || super
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.5.0
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: 2020-11-07 00:00:00.000000000 Z
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.1.4
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: []