grape-route-helpers 1.2.2 → 2.0.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
  SHA1:
3
- metadata.gz: a436c5306eca86f756921e38c26141ad09b9ab2d
4
- data.tar.gz: 69dd431b336b391cb402bc14775027e69cc6e2c8
3
+ metadata.gz: 83b55766476f52f66e8ca85e84cbb3982cc30ffc
4
+ data.tar.gz: 4e95656ec76aec7d9c61c09ed5f8d3ecf9d82992
5
5
  SHA512:
6
- metadata.gz: c60ff91c855a14e6102130b36872503dbe03846eedff32e4814116f7a766afca8ad0bf0e79bd66ea964d3f2442c1069e4a41133b7cdeebc525fcd5793db47895
7
- data.tar.gz: 8f0066969692d5b96fde60b43eaf39665473bfc6af49ac43d3be0d9506cfe8f00eea3f0115f1a3efd41dfe61202b6213034db98da7c2451edcb49610ae7986c0
6
+ metadata.gz: b0e423a706e7c000da1c40203dfa482e38582189521917dfa271ba5f024c9e3c9efc67d66dbaeff1651e2b15ab7655534d99ae5bc4035f00cf294478844df0b5
7
+ data.tar.gz: 87182c670bca69856919540aba66c97d965d2c17c2da71cc94763561bc881e4ded309a9cf5d13e2846c875d62d512ebf0f657950351786a8c807acfb8b78a219
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## April 28 2016
4
+
5
+ * Release 2.0.0
6
+ * Fix incompatibility between grape-route-helpers and grape 0.16.0
7
+
3
8
  ## April 11 2016
4
9
 
5
10
  * Release 1.2.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-route-helpers (1.2.2)
4
+ grape-route-helpers (2.0.0)
5
5
  activesupport
6
6
  grape
7
7
  rake
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (4.2.3)
12
+ activesupport (4.2.6)
13
13
  i18n (~> 0.7)
14
14
  json (~> 1.7, >= 1.7.7)
15
15
  minitest (~> 5.1)
@@ -29,25 +29,28 @@ GEM
29
29
  descendants_tracker (0.0.4)
30
30
  thread_safe (~> 0.3, >= 0.3.1)
31
31
  diff-lcs (1.2.5)
32
+ enumerable-lazy (0.0.1)
32
33
  equalizer (0.0.11)
33
- grape (0.12.0)
34
+ grape (0.16.2)
34
35
  activesupport
35
36
  builder
36
37
  hashie (>= 2.1.0)
37
38
  multi_json (>= 1.3.2)
38
39
  multi_xml (>= 0.5.2)
40
+ mustermann19 (~> 0.4.3)
39
41
  rack (>= 1.3.0)
40
42
  rack-accept
41
- rack-mount
42
43
  virtus (>= 1.0.0)
43
- hashie (3.4.2)
44
+ hashie (3.4.3)
44
45
  i18n (0.7.0)
45
- ice_nine (0.11.1)
46
+ ice_nine (0.11.2)
46
47
  json (1.8.3)
47
48
  method_source (0.8.2)
48
- minitest (5.8.3)
49
- multi_json (1.11.2)
49
+ minitest (5.8.4)
50
+ multi_json (1.11.3)
50
51
  multi_xml (0.5.5)
52
+ mustermann19 (0.4.3)
53
+ enumerable-lazy
51
54
  parser (2.3.0.pre.2)
52
55
  ast (>= 1.1, < 3.0)
53
56
  powerpack (0.1.1)
@@ -58,8 +61,6 @@ GEM
58
61
  rack (1.6.4)
59
62
  rack-accept (0.4.5)
60
63
  rack (>= 0.4)
61
- rack-mount (0.8.3)
62
- rack (>= 1.0.0)
63
64
  rainbow (2.0.0)
64
65
  rake (10.4.2)
65
66
  rspec (3.3.0)
data/README.md CHANGED
@@ -2,10 +2,14 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/reprah/grape-route-helpers.svg)](https://travis-ci.org/reprah/grape-route-helpers)
4
4
 
5
- Provides named route helpers for Grape APIs, similar to [Rails' route helpers](http://edgeguides.rubyonrails.org/routing.html#path-and-url-helpers).
5
+ Provides named route helpers for Grape APIs, similar to [Rails' route helpers](http://edgeguides.rubyonrails.org/routing.html#path-and-url-helpers).
6
6
 
7
7
  ### Installation
8
8
 
9
+ #### Compatibility with Grape
10
+
11
+ If you're using grape 0.16.0 or higher, you'll need version 2.0.0 or higher of grape-route-helpers.
12
+
9
13
  #### Rails
10
14
 
11
15
  1.) Add the gem to your Gemfile.
@@ -132,7 +136,7 @@ This results in creating a helper called `is_the_server_running_path`.
132
136
 
133
137
  #### Testing
134
138
 
135
- You can you the route helpers in our API tests by including the `GrapeRouteHelpers::NamedRouteMatcher` module inside your specs. Here's an example:
139
+ You can use route helpers in your API tests by including the `GrapeRouteHelpers::NamedRouteMatcher` module inside your specs. Here's an example:
136
140
 
137
141
  ```ruby
138
142
  require 'spec_helper'
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
12
12
  gem.homepage = 'https://github.com/reprah/grape-route-helpers'
13
13
 
14
- gem.add_runtime_dependency 'grape'
14
+ gem.add_runtime_dependency 'grape', '~> 0.16', '>= 0.16.0'
15
15
  gem.add_runtime_dependency 'activesupport'
16
16
  gem.add_runtime_dependency 'rake'
17
17
 
@@ -10,10 +10,7 @@ module GrapeRouteHelpers
10
10
 
11
11
  def all_routes
12
12
  routes = subclasses.flat_map { |s| s.send(:prepare_routes) }
13
- # delete duplicate routes
14
- routes.uniq do |route|
15
- route.instance_variable_get( :@options )
16
- end
13
+ routes.uniq(&:options)
17
14
  end
18
15
  end
19
16
  end
@@ -10,7 +10,7 @@ module GrapeRouteHelpers
10
10
 
11
11
  def initialize(route)
12
12
  @route = route
13
- @route_options = route.instance_variable_get(:@options)
13
+ @route_options = route.options
14
14
  @helper_names = []
15
15
  @helper_arguments = required_helper_segments
16
16
  @extension = default_extension
@@ -64,16 +64,17 @@ module GrapeRouteHelpers
64
64
  end
65
65
 
66
66
  def route_versions
67
+ version_pattern = /[^\[",\]\s]+/
67
68
  if route_version
68
- route_version.split('|')
69
+ route_version.scan(version_pattern)
69
70
  else
70
71
  [nil]
71
72
  end
72
73
  end
73
74
 
74
75
  def path_helper_name(opts = {})
75
- if route.route_as
76
- name = route.route_as.to_s
76
+ if route_options[:as]
77
+ name = route_options[:as].to_s
77
78
  else
78
79
  segments = path_segments_with_values(opts)
79
80
 
@@ -90,7 +91,7 @@ module GrapeRouteHelpers
90
91
 
91
92
  def segment_to_value(segment, opts = {})
92
93
  options = HashWithIndifferentAccess.new(
93
- route_options.merge(opts)
94
+ route.options.merge(opts)
94
95
  )
95
96
 
96
97
  if dynamic_segment?(segment)
@@ -124,7 +125,7 @@ module GrapeRouteHelpers
124
125
 
125
126
  def required_helper_segments
126
127
  segments_in_options = dynamic_path_segments.select do |segment|
127
- route_options[segment.to_sym]
128
+ route.options[segment.to_sym]
128
129
  end
129
130
  dynamic_path_segments - segments_in_options
130
131
  end
@@ -144,19 +145,19 @@ module GrapeRouteHelpers
144
145
  end
145
146
 
146
147
  def route_path
147
- route_options[:path]
148
+ route.path
148
149
  end
149
150
 
150
151
  def route_version
151
- route_options[:version]
152
+ route.version
152
153
  end
153
154
 
154
155
  def route_namespace
155
- route_options[:namespace]
156
+ route.namespace
156
157
  end
157
158
 
158
159
  def route_method
159
- route_options[:method]
160
+ route.request_method
160
161
  end
161
162
  end
162
163
  end
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module GrapeRouteHelpers
3
- VERSION = '1.2.2'
3
+ VERSION = '2.0.0'
4
4
  end
@@ -21,7 +21,6 @@ describe GrapeRouteHelpers::AllRoutes do
21
21
 
22
22
  expect(duplicates).to be_empty
23
23
  expect(all_route_options.size).to eq(7)
24
-
25
24
  end
26
25
  end
27
26
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-route-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harper Henn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.16'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: '0'
22
+ version: 0.16.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.16'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: '0'
32
+ version: 0.16.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement