grape 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grape might be problematic. Click here for more details.

Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +23 -80
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +27 -0
  5. data/Gemfile +1 -1
  6. data/Guardfile +1 -1
  7. data/LICENSE +1 -1
  8. data/README.md +131 -30
  9. data/Rakefile +1 -1
  10. data/UPGRADING.md +110 -1
  11. data/gemfiles/rails_3.gemfile +1 -1
  12. data/gemfiles/rails_4.gemfile +1 -1
  13. data/grape.gemspec +4 -4
  14. data/lib/grape.rb +92 -62
  15. data/lib/grape/api.rb +10 -10
  16. data/lib/grape/cookies.rb +1 -1
  17. data/lib/grape/dsl/configuration.rb +7 -7
  18. data/lib/grape/dsl/helpers.rb +3 -3
  19. data/lib/grape/dsl/inside_route.rb +50 -21
  20. data/lib/grape/dsl/parameters.rb +25 -6
  21. data/lib/grape/dsl/request_response.rb +1 -1
  22. data/lib/grape/dsl/routing.rb +11 -10
  23. data/lib/grape/dsl/settings.rb +1 -1
  24. data/lib/grape/endpoint.rb +21 -19
  25. data/lib/grape/error_formatter/json.rb +1 -1
  26. data/lib/grape/exceptions/base.rb +1 -1
  27. data/lib/grape/exceptions/validation.rb +1 -1
  28. data/lib/grape/exceptions/validation_errors.rb +2 -2
  29. data/lib/grape/formatter/base.rb +1 -1
  30. data/lib/grape/formatter/json.rb +1 -1
  31. data/lib/grape/formatter/serializable_hash.rb +4 -4
  32. data/lib/grape/formatter/txt.rb +1 -1
  33. data/lib/grape/formatter/xml.rb +1 -1
  34. data/lib/grape/http/headers.rb +27 -0
  35. data/lib/grape/http/request.rb +1 -1
  36. data/lib/grape/middleware/error.rb +10 -4
  37. data/lib/grape/middleware/formatter.rb +13 -9
  38. data/lib/grape/middleware/globals.rb +2 -1
  39. data/lib/grape/middleware/versioner/accept_version_header.rb +2 -2
  40. data/lib/grape/middleware/versioner/header.rb +4 -4
  41. data/lib/grape/middleware/versioner/param.rb +2 -2
  42. data/lib/grape/middleware/versioner/path.rb +1 -1
  43. data/lib/grape/namespace.rb +2 -1
  44. data/lib/grape/parser/json.rb +1 -1
  45. data/lib/grape/parser/xml.rb +1 -1
  46. data/lib/grape/path.rb +3 -3
  47. data/lib/grape/presenters/presenter.rb +9 -0
  48. data/lib/grape/validations/params_scope.rb +3 -3
  49. data/lib/grape/validations/validators/allow_blank.rb +1 -1
  50. data/lib/grape/validations/validators/coerce.rb +6 -5
  51. data/lib/grape/validations/validators/default.rb +2 -2
  52. data/lib/grape/validations/validators/multiple_params_base.rb +1 -0
  53. data/lib/grape/validations/validators/regexp.rb +1 -1
  54. data/lib/grape/version.rb +1 -1
  55. data/spec/grape/api/custom_validations_spec.rb +47 -0
  56. data/spec/grape/api/deeply_included_options_spec.rb +56 -0
  57. data/spec/grape/api_spec.rb +64 -42
  58. data/spec/grape/dsl/configuration_spec.rb +2 -2
  59. data/spec/grape/dsl/helpers_spec.rb +1 -1
  60. data/spec/grape/dsl/inside_route_spec.rb +75 -19
  61. data/spec/grape/dsl/parameters_spec.rb +59 -10
  62. data/spec/grape/dsl/request_response_spec.rb +62 -2
  63. data/spec/grape/dsl/routing_spec.rb +116 -18
  64. data/spec/grape/endpoint_spec.rb +57 -5
  65. data/spec/grape/entity_spec.rb +1 -1
  66. data/spec/grape/exceptions/body_parse_errors_spec.rb +5 -5
  67. data/spec/grape/exceptions/invalid_accept_header_spec.rb +32 -32
  68. data/spec/grape/exceptions/validation_errors_spec.rb +1 -1
  69. data/spec/grape/integration/rack_spec.rb +4 -3
  70. data/spec/grape/middleware/auth/strategies_spec.rb +2 -2
  71. data/spec/grape/middleware/base_spec.rb +2 -2
  72. data/spec/grape/middleware/error_spec.rb +1 -1
  73. data/spec/grape/middleware/exception_spec.rb +5 -5
  74. data/spec/grape/middleware/formatter_spec.rb +10 -10
  75. data/spec/grape/middleware/globals_spec.rb +27 -0
  76. data/spec/grape/middleware/versioner/accept_version_header_spec.rb +1 -1
  77. data/spec/grape/middleware/versioner/header_spec.rb +1 -1
  78. data/spec/grape/middleware/versioner/param_spec.rb +1 -1
  79. data/spec/grape/middleware/versioner/path_spec.rb +1 -1
  80. data/spec/grape/path_spec.rb +6 -4
  81. data/spec/grape/presenters/presenter_spec.rb +70 -0
  82. data/spec/grape/util/inheritable_values_spec.rb +1 -1
  83. data/spec/grape/util/stackable_values_spec.rb +1 -1
  84. data/spec/grape/util/strict_hash_configuration_spec.rb +1 -1
  85. data/spec/grape/validations/params_scope_spec.rb +64 -0
  86. data/spec/grape/validations/validators/allow_blank_spec.rb +10 -0
  87. data/spec/grape/validations/validators/coerce_spec.rb +48 -18
  88. data/spec/grape/validations/validators/default_spec.rb +110 -20
  89. data/spec/grape/validations/validators/presence_spec.rb +41 -3
  90. data/spec/grape/validations/validators/regexp_spec.rb +7 -2
  91. data/spec/grape/validations_spec.rb +20 -1
  92. data/spec/support/file_streamer.rb +11 -0
  93. data/spec/support/versioned_helpers.rb +1 -1
  94. metadata +14 -2
data/Rakefile CHANGED
@@ -52,7 +52,7 @@ begin
52
52
  end
53
53
 
54
54
  desc 'Generate and publish YARD docs to GitHub pages.'
55
- task :publish => ['doc:pages:checkout', 'doc:pages'] do
55
+ task publish: ['doc:pages:checkout', 'doc:pages'] do
56
56
  Dir.chdir(File.dirname(__FILE__) + '/../grape.doc') do
57
57
  system('git checkout gh-pages')
58
58
  system('git add .')
data/UPGRADING.md CHANGED
@@ -1,9 +1,118 @@
1
1
  Upgrading Grape
2
2
  ===============
3
3
 
4
+ ### Upgrading to >= 0.12.0
5
+
6
+ #### Changes in middleware
7
+
8
+ The Rack response object is no longer converted to an array by the formatter, enabling streaming. If your custom middleware is accessing `@app_response`, update it to expect a `Rack::Response` instance instead of an array.
9
+
10
+ For example,
11
+
12
+ ```ruby
13
+ class CacheBusterMiddleware < Grape::Middleware::Base
14
+ def after
15
+ @app_response[1]['Expires'] = Time.at(0).utc.to_s
16
+ @app_response
17
+ end
18
+ end
19
+ ```
20
+
21
+ becomes
22
+
23
+ ```ruby
24
+ class CacheBusterMiddleware < Grape::Middleware::Base
25
+ def after
26
+ @app_response.headers['Expires'] = Time.at(0).utc.to_s
27
+ @app_response
28
+ end
29
+ end
30
+ ```
31
+
32
+ See [#1029](https://github.com/intridea/grape/pull/1029) for more information.
33
+
34
+ #### Changes in present
35
+
36
+ Using `present` with objects that responded to `merge` would cause early evaluation of the represented object, with unexpected side-effects, such as missing parameters or environment within rendering code. Grape now only merges represented objects with a previously rendered body, usually when multiple `present` calls are made in the same route.
37
+
38
+ See [grape-with-roar#5](https://github.com/dblock/grape-with-roar/issues/5) and [#1023](https://github.com/intridea/grape/issues/1023).
39
+
40
+ #### Changes to regexp validator
41
+
42
+ Parameters with `nil` value will now pass `regexp` validation. To disallow `nil` value for an endpoint, add `allow_blank: false`.
43
+
44
+ ```ruby
45
+ params do
46
+ requires :email, allow_blank: false, regexp: /.+@.+/
47
+ end
48
+ ```
49
+
50
+ See [#957](https://github.com/intridea/grape/pull/957) for more information.
51
+
52
+ #### Replace error_response with error! in rescue_from blocks
53
+
54
+ Note: `error_response` is being deprecated, not removed.
55
+
56
+ ```ruby
57
+ def error!(message, status = options[:default_status], headers = {}, backtrace = [])
58
+ headers = { 'Content-Type' => content_type }.merge(headers)
59
+ rack_response(format_message(message, backtrace), status, headers)
60
+ end
61
+ ```
62
+
63
+ For example,
64
+
65
+ ```
66
+ error_response({ message: { message: 'No such page.', id: 'missing_page' }, status: 404, headers: { 'Content-Type' => 'api/error' })
67
+ ```
68
+
69
+ becomes
70
+
71
+ ```
72
+ error!({ message: 'No such page.', id: 'missing_page' }, 404, { 'Content-Type' => 'api/error' })
73
+ ```
74
+
75
+ `error!` also supports just passing a message. `error!('Server error.')` and `format: :json` returns the following JSON response
76
+
77
+ ```
78
+ { 'error': 'Server error. }
79
+ ```
80
+
81
+ with a status code of 500 and a Content Type of text/error.
82
+
83
+ Optionally, also replace `Rack::Response.new` with `error!.`
84
+ The following are equivalent:
85
+
86
+ ```
87
+ Rack::Response.new([ e.message ], 500, { "Content-type" => "text/error" }).finish
88
+ error!(e)
89
+ ```
90
+
91
+ See [#889](https://github.com/intridea/grape/issues/889) for more information.
92
+
93
+ #### Changes to routes when using `format`
94
+
95
+ Version 0.10.0 has introduced a change via [#809](https://github.com/intridea/grape/pull/809) whereas routes no longer got file-type suffixes added if you declared a single API `format`. This has been reverted, it's now again possible to call API with proper suffix when single `format` is defined:
96
+
97
+ ```ruby
98
+ class API < Grape::API
99
+ format :json
100
+
101
+ get :hello do
102
+ { hello: 'world' }
103
+ end
104
+ end
105
+ ```
106
+
107
+ Will respond with JSON to `/hello` **and** `/hello.json`.
108
+
109
+ Will respond with 404 to `/hello.xml`, `/hello.txt` etc.
110
+
111
+ See the [#1001](https://github.com/intridea/grape/pull/1001) and [#914](https://github.com/intridea/grape/issues/914) for more info.
112
+
4
113
  ### Upgrading to >= 0.11.0
5
114
 
6
- #### Added Rack 1.6.0 Support
115
+ #### Added Rack 1.6.0 support
7
116
 
8
117
  Grape now supports, but doesn't require Rack 1.6.0. If you encounter an issue with parsing requests larger than 128KB, explictly require Rack 1.6.0 in your Gemfile.
9
118
 
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  gem 'rails', '3.2.19'
6
6
 
7
7
  group :development, :test do
8
- gem 'rubocop', '~> 0.28.0'
8
+ gem 'rubocop', '~> 0.31.0'
9
9
  gem 'guard'
10
10
  gem 'guard-rspec'
11
11
  gem 'guard-rubocop'
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  gem 'rails', '4.1.6'
6
6
 
7
7
  group :development, :test do
8
- gem 'rubocop', '~> 0.28.0'
8
+ gem 'rubocop', '~> 0.31.0'
9
9
  gem 'guard'
10
10
  gem 'guard-rspec'
11
11
  gem 'guard-rubocop'
data/grape.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- $:.push File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
2
  require 'grape/version'
3
3
 
4
4
  Gem::Specification.new do |s|
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ['Michael Bleigh']
9
9
  s.email = ['michael@intridea.com']
10
10
  s.homepage = 'https://github.com/intridea/grape'
11
- s.summary = %q{A simple Ruby framework for building REST-like APIs.}
12
- s.description = %q{A Ruby framework for rapid API development with great conventions.}
11
+ s.summary = 'A simple Ruby framework for building REST-like APIs.'
12
+ s.description = 'A Ruby framework for rapid API development with great conventions.'
13
13
  s.license = 'MIT'
14
14
 
15
15
  s.rubyforge_project = 'grape'
@@ -38,6 +38,6 @@ Gem::Specification.new do |s|
38
38
 
39
39
  s.files = `git ls-files`.split("\n")
40
40
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
41
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
41
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
42
42
  s.require_paths = ['lib']
43
43
  end
data/lib/grape.rb CHANGED
@@ -20,6 +20,7 @@ require 'active_support/ordered_hash'
20
20
  require 'active_support/core_ext/object/conversions'
21
21
  require 'active_support/core_ext/array/extract_options'
22
22
  require 'active_support/core_ext/hash/deep_merge'
23
+ require 'active_support/dependencies/autoload'
23
24
  require 'grape/util/content_types'
24
25
  require 'multi_json'
25
26
  require 'multi_xml'
@@ -30,102 +31,131 @@ require 'thread'
30
31
  I18n.load_path << File.expand_path('../grape/locale/en.yml', __FILE__)
31
32
 
32
33
  module Grape
33
- autoload :API, 'grape/api'
34
- autoload :Endpoint, 'grape/endpoint'
34
+ extend ActiveSupport::Autoload
35
35
 
36
- autoload :Route, 'grape/route'
37
- autoload :Namespace, 'grape/namespace'
36
+ eager_autoload do
37
+ autoload :API
38
+ autoload :Endpoint
38
39
 
39
- autoload :Path, 'grape/path'
40
+ autoload :Route
41
+ autoload :Namespace
40
42
 
41
- autoload :Cookies, 'grape/cookies'
42
- autoload :Validations, 'grape/validations'
43
- autoload :Request, 'grape/http/request'
43
+ autoload :Path
44
+
45
+ autoload :Cookies
46
+ autoload :Validations
47
+ autoload :Request, 'grape/http/request'
48
+ end
49
+
50
+ module Http
51
+ extend ActiveSupport::Autoload
52
+ eager_autoload do
53
+ autoload :Headers
54
+ end
55
+ end
44
56
 
45
57
  module Exceptions
46
- autoload :Base, 'grape/exceptions/base'
47
- autoload :Validation, 'grape/exceptions/validation'
48
- autoload :ValidationErrors, 'grape/exceptions/validation_errors'
49
- autoload :MissingVendorOption, 'grape/exceptions/missing_vendor_option'
50
- autoload :MissingMimeType, 'grape/exceptions/missing_mime_type'
51
- autoload :MissingOption, 'grape/exceptions/missing_option'
52
- autoload :InvalidFormatter, 'grape/exceptions/invalid_formatter'
53
- autoload :InvalidVersionerOption, 'grape/exceptions/invalid_versioner_option'
54
- autoload :UnknownValidator, 'grape/exceptions/unknown_validator'
55
- autoload :UnknownOptions, 'grape/exceptions/unknown_options'
56
- autoload :InvalidWithOptionForRepresent, 'grape/exceptions/invalid_with_option_for_represent'
57
- autoload :IncompatibleOptionValues, 'grape/exceptions/incompatible_option_values'
58
+ extend ActiveSupport::Autoload
59
+ autoload :Base
60
+ autoload :Validation
61
+ autoload :ValidationErrors
62
+ autoload :MissingVendorOption
63
+ autoload :MissingMimeType
64
+ autoload :MissingOption
65
+ autoload :InvalidFormatter
66
+ autoload :InvalidVersionerOption
67
+ autoload :UnknownValidator
68
+ autoload :UnknownOptions
69
+ autoload :InvalidWithOptionForRepresent
70
+ autoload :IncompatibleOptionValues
58
71
  autoload :MissingGroupTypeError, 'grape/exceptions/missing_group_type'
59
72
  autoload :UnsupportedGroupTypeError, 'grape/exceptions/unsupported_group_type'
60
- autoload :InvalidMessageBody, 'grape/exceptions/invalid_message_body'
61
- autoload :InvalidAcceptHeader, 'grape/exceptions/invalid_accept_header'
73
+ autoload :InvalidMessageBody
74
+ autoload :InvalidAcceptHeader
62
75
  end
63
76
 
64
77
  module ErrorFormatter
65
- autoload :Base, 'grape/error_formatter/base'
66
- autoload :Json, 'grape/error_formatter/json'
67
- autoload :Txt, 'grape/error_formatter/txt'
68
- autoload :Xml, 'grape/error_formatter/xml'
78
+ extend ActiveSupport::Autoload
79
+ autoload :Base
80
+ autoload :Json
81
+ autoload :Txt
82
+ autoload :Xml
69
83
  end
70
84
 
71
85
  module Formatter
72
- autoload :Base, 'grape/formatter/base'
73
- autoload :Json, 'grape/formatter/json'
74
- autoload :SerializableHash, 'grape/formatter/serializable_hash'
75
- autoload :Txt, 'grape/formatter/txt'
76
- autoload :Xml, 'grape/formatter/xml'
86
+ extend ActiveSupport::Autoload
87
+ autoload :Base
88
+ autoload :Json
89
+ autoload :SerializableHash
90
+ autoload :Txt
91
+ autoload :Xml
77
92
  end
78
93
 
79
94
  module Parser
80
- autoload :Base, 'grape/parser/base'
81
- autoload :Json, 'grape/parser/json'
82
- autoload :Xml, 'grape/parser/xml'
95
+ extend ActiveSupport::Autoload
96
+ autoload :Base
97
+ autoload :Json
98
+ autoload :Xml
83
99
  end
84
100
 
85
101
  module Middleware
86
- autoload :Base, 'grape/middleware/base'
87
- autoload :Versioner, 'grape/middleware/versioner'
88
- autoload :Formatter, 'grape/middleware/formatter'
89
- autoload :Error, 'grape/middleware/error'
102
+ extend ActiveSupport::Autoload
103
+ autoload :Base
104
+ autoload :Versioner
105
+ autoload :Formatter
106
+ autoload :Error
107
+ autoload :Globals
90
108
 
91
109
  module Auth
92
- autoload :Base, 'grape/middleware/auth/base'
93
- autoload :DSL, 'grape/middleware/auth/dsl'
94
- autoload :StrategyInfo, 'grape/middleware/auth/strategy_info'
95
- autoload :Strategies, 'grape/middleware/auth/strategies'
110
+ extend ActiveSupport::Autoload
111
+ autoload :Base
112
+ autoload :DSL
113
+ autoload :StrategyInfo
114
+ autoload :Strategies
96
115
  end
97
116
 
98
117
  module Versioner
99
- autoload :Path, 'grape/middleware/versioner/path'
100
- autoload :Header, 'grape/middleware/versioner/header'
101
- autoload :Param, 'grape/middleware/versioner/param'
102
- autoload :AcceptVersionHeader, 'grape/middleware/versioner/accept_version_header'
118
+ extend ActiveSupport::Autoload
119
+ autoload :Path
120
+ autoload :Header
121
+ autoload :Param
122
+ autoload :AcceptVersionHeader
103
123
  end
104
124
  end
105
125
 
106
126
  module Util
107
- autoload :InheritableValues, 'grape/util/inheritable_values'
108
- autoload :StackableValues, 'grape/util/stackable_values'
109
- autoload :InheritableSetting, 'grape/util/inheritable_setting'
110
- autoload :StrictHashConfiguration, 'grape/util/strict_hash_configuration'
127
+ extend ActiveSupport::Autoload
128
+ autoload :InheritableValues
129
+ autoload :StackableValues
130
+ autoload :InheritableSetting
131
+ autoload :StrictHashConfiguration
111
132
  end
112
133
 
113
134
  module DSL
114
- autoload :API, 'grape/dsl/api'
115
- autoload :Callbacks, 'grape/dsl/callbacks'
116
- autoload :Settings, 'grape/dsl/settings'
117
- autoload :Configuration, 'grape/dsl/configuration'
118
- autoload :InsideRoute, 'grape/dsl/inside_route'
119
- autoload :Helpers, 'grape/dsl/helpers'
120
- autoload :Middleware, 'grape/dsl/middleware'
121
- autoload :Parameters, 'grape/dsl/parameters'
122
- autoload :RequestResponse, 'grape/dsl/request_response'
123
- autoload :Routing, 'grape/dsl/routing'
124
- autoload :Validations, 'grape/dsl/validations'
135
+ extend ActiveSupport::Autoload
136
+ eager_autoload do
137
+ autoload :API
138
+ autoload :Callbacks
139
+ autoload :Settings
140
+ autoload :Configuration
141
+ autoload :InsideRoute
142
+ autoload :Helpers
143
+ autoload :Middleware
144
+ autoload :Parameters
145
+ autoload :RequestResponse
146
+ autoload :Routing
147
+ autoload :Validations
148
+ end
125
149
  end
126
150
 
127
151
  class API
128
- autoload :Helpers, 'grape/api/helpers'
152
+ extend ActiveSupport::Autoload
153
+ autoload :Helpers
154
+ end
155
+
156
+ module Presenters
157
+ extend ActiveSupport::Autoload
158
+ autoload :Presenter
129
159
  end
130
160
  end
131
161
 
data/lib/grape/api.rb CHANGED
@@ -36,7 +36,7 @@ module Grape
36
36
  # Create a scope without affecting the URL.
37
37
  #
38
38
  # @param name [Symbol] Purely placebo, just allows to name the scope to make the code more readable.
39
- def scope(name = nil, &block)
39
+ def scope(_name = nil, &block)
40
40
  within_namespace do
41
41
  nest(block)
42
42
  end
@@ -95,9 +95,9 @@ module Grape
95
95
  end
96
96
 
97
97
  def call(env)
98
- status, headers, body = @route_set.call(env)
99
- headers.delete('X-Cascade') unless cascade?
100
- [status, headers, body]
98
+ result = @route_set.call(env)
99
+ result[1].delete(Grape::Http::Headers::X_CASCADE) unless cascade?
100
+ result
101
101
  end
102
102
 
103
103
  # Some requests may return a HTTP 404 error if grape cannot find a matching
@@ -142,12 +142,12 @@ module Grape
142
142
  methods_per_path.each do |path, methods|
143
143
  allowed_methods = methods.dup
144
144
  unless self.class.namespace_inheritable(:do_not_route_head)
145
- allowed_methods |= ['HEAD'] if allowed_methods.include?('GET')
145
+ allowed_methods |= [Grape::Http::Headers::HEAD] if allowed_methods.include?(Grape::Http::Headers::GET)
146
146
  end
147
147
 
148
- allow_header = (['OPTIONS'] | allowed_methods).join(', ')
148
+ allow_header = ([Grape::Http::Headers::OPTIONS] | allowed_methods).join(', ')
149
149
  unless self.class.namespace_inheritable(:do_not_route_options)
150
- unless allowed_methods.include?('OPTIONS')
150
+ unless allowed_methods.include?(Grape::Http::Headers::OPTIONS)
151
151
  self.class.options(path, {}) do
152
152
  header 'Allow', allow_header
153
153
  status 204
@@ -157,7 +157,7 @@ module Grape
157
157
  end
158
158
 
159
159
  not_allowed_methods = %w(GET PUT POST DELETE PATCH HEAD) - allowed_methods
160
- not_allowed_methods << 'OPTIONS' if self.class.namespace_inheritable(:do_not_route_options)
160
+ not_allowed_methods << Grape::Http::Headers::OPTIONS if self.class.namespace_inheritable(:do_not_route_options)
161
161
  self.class.route(not_allowed_methods, path) do
162
162
  header 'Allow', allow_header
163
163
  status 405
@@ -168,7 +168,7 @@ module Grape
168
168
  end
169
169
  end
170
170
 
171
- def without_versioning(&block)
171
+ def without_versioning(&_block)
172
172
  old_version = self.class.namespace_inheritable(:version)
173
173
  old_version_options = self.class.namespace_inheritable(:version_options)
174
174
 
@@ -181,7 +181,7 @@ module Grape
181
181
  self.class.namespace_inheritable(:version_options, old_version_options)
182
182
  end
183
183
 
184
- def without_root_prefix(&block)
184
+ def without_root_prefix(&_block)
185
185
  old_prefix = self.class.namespace_inheritable(:root_prefix)
186
186
 
187
187
  self.class.namespace_inheritable_to_nil(:root_prefix)
data/lib/grape/cookies.rb CHANGED
@@ -12,7 +12,7 @@ module Grape
12
12
  end
13
13
 
14
14
  def write(header)
15
- @cookies.select { |key, value| @send_cookies[key] == true }.each do |name, value|
15
+ @cookies.select { |key, _value| @send_cookies[key] == true }.each do |name, value|
16
16
  cookie_value = value.is_a?(Hash) ? value : { value: value }
17
17
  Rack::Utils.set_cookie_header! header, name, cookie_value
18
18
  end