grape 0.16.2 → 0.17.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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +4 -0
  3. data/CHANGELOG.md +54 -27
  4. data/Dangerfile +80 -0
  5. data/Gemfile +23 -0
  6. data/Gemfile.lock +61 -27
  7. data/README.md +135 -7
  8. data/Rakefile +34 -30
  9. data/UPGRADING.md +21 -0
  10. data/gemfiles/rack_1.5.2.gemfile +21 -0
  11. data/gemfiles/rails_3.gemfile +22 -1
  12. data/gemfiles/rails_4.gemfile +21 -0
  13. data/gemfiles/rails_5.gemfile +34 -0
  14. data/grape.gemspec +0 -14
  15. data/lib/grape.rb +2 -0
  16. data/lib/grape/api.rb +9 -2
  17. data/lib/grape/dsl/headers.rb +1 -1
  18. data/lib/grape/dsl/inside_route.rb +15 -17
  19. data/lib/grape/dsl/middleware.rb +15 -1
  20. data/lib/grape/dsl/parameters.rb +16 -14
  21. data/lib/grape/dsl/request_response.rb +24 -20
  22. data/lib/grape/dsl/routing.rb +11 -10
  23. data/lib/grape/dsl/settings.rb +16 -0
  24. data/lib/grape/endpoint.rb +77 -60
  25. data/lib/grape/exceptions/validation.rb +5 -2
  26. data/lib/grape/exceptions/validation_array_errors.rb +11 -0
  27. data/lib/grape/formatter/xml.rb +1 -1
  28. data/lib/grape/middleware/error.rb +34 -25
  29. data/lib/grape/middleware/formatter.rb +9 -9
  30. data/lib/grape/middleware/stack.rb +110 -0
  31. data/lib/grape/middleware/versioner.rb +1 -1
  32. data/lib/grape/middleware/versioner/accept_version_header.rb +1 -1
  33. data/lib/grape/middleware/versioner/header.rb +3 -3
  34. data/lib/grape/path.rb +10 -2
  35. data/lib/grape/request.rb +1 -1
  36. data/lib/grape/router.rb +10 -19
  37. data/lib/grape/router/pattern.rb +2 -2
  38. data/lib/grape/router/route.rb +3 -3
  39. data/lib/grape/util/content_types.rb +1 -1
  40. data/lib/grape/util/inheritable_setting.rb +7 -2
  41. data/lib/grape/util/reverse_stackable_values.rb +45 -0
  42. data/lib/grape/util/stackable_values.rb +10 -11
  43. data/lib/grape/validations/attributes_iterator.rb +32 -7
  44. data/lib/grape/validations/params_scope.rb +33 -21
  45. data/lib/grape/validations/types.rb +4 -4
  46. data/lib/grape/validations/types/build_coercer.rb +9 -1
  47. data/lib/grape/validations/validators/all_or_none.rb +2 -2
  48. data/lib/grape/validations/validators/allow_blank.rb +10 -11
  49. data/lib/grape/validations/validators/at_least_one_of.rb +1 -1
  50. data/lib/grape/validations/validators/base.rb +16 -6
  51. data/lib/grape/validations/validators/coerce.rb +3 -6
  52. data/lib/grape/validations/validators/default.rb +26 -1
  53. data/lib/grape/validations/validators/exactly_one_of.rb +1 -1
  54. data/lib/grape/validations/validators/mutual_exclusion.rb +1 -1
  55. data/lib/grape/validations/validators/presence.rb +1 -1
  56. data/lib/grape/validations/validators/regexp.rb +1 -1
  57. data/lib/grape/validations/validators/values.rb +1 -1
  58. data/lib/grape/version.rb +1 -1
  59. data/spec/grape/api/custom_validations_spec.rb +3 -3
  60. data/spec/grape/api/parameters_modification_spec.rb +41 -0
  61. data/spec/grape/api_spec.rb +335 -108
  62. data/spec/grape/dsl/logger_spec.rb +1 -1
  63. data/spec/grape/dsl/middleware_spec.rb +25 -5
  64. data/spec/grape/dsl/request_response_spec.rb +20 -6
  65. data/spec/grape/dsl/validations_spec.rb +1 -1
  66. data/spec/grape/endpoint_spec.rb +166 -23
  67. data/spec/grape/entity_spec.rb +0 -2
  68. data/spec/grape/exceptions/body_parse_errors_spec.rb +37 -0
  69. data/spec/grape/exceptions/validation_errors_spec.rb +5 -5
  70. data/spec/grape/exceptions/validation_spec.rb +10 -0
  71. data/spec/grape/integration/global_namespace_function_spec.rb +1 -1
  72. data/spec/grape/integration/rack_spec.rb +1 -1
  73. data/spec/grape/middleware/base_spec.rb +1 -1
  74. data/spec/grape/middleware/exception_spec.rb +2 -2
  75. data/spec/grape/middleware/formatter_spec.rb +4 -4
  76. data/spec/grape/middleware/stack_spec.rb +123 -0
  77. data/spec/grape/middleware/versioner/header_spec.rb +6 -6
  78. data/spec/grape/request_spec.rb +22 -22
  79. data/spec/grape/util/inheritable_setting_spec.rb +23 -0
  80. data/spec/grape/util/reverse_stackable_values_spec.rb +131 -0
  81. data/spec/grape/validations/params_scope_spec.rb +88 -1
  82. data/spec/grape/validations/validators/allow_blank_spec.rb +5 -0
  83. data/spec/grape/validations/validators/coerce_spec.rb +5 -5
  84. data/spec/grape/validations/validators/default_spec.rb +44 -0
  85. data/spec/grape/validations/validators/values_spec.rb +1 -1
  86. data/spec/grape/validations_spec.rb +36 -17
  87. data/spec/spec_helper.rb +1 -8
  88. data/spec/support/versioned_helpers.rb +3 -3
  89. metadata +13 -188
  90. data/gemfiles/rails_3.gemfile.lock +0 -225
  91. data/pkg/grape-0.16.1.gem +0 -0
  92. data/pkg/patch.diff +0 -24
  93. data/tmp/Gemfile.lock +0 -63
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c0353f686611ae4c8f0b58a8cbe67a8a75517b2
4
- data.tar.gz: 4df3e13972d076ebc707112bc5a8a837a022ef77
3
+ metadata.gz: 19ace46ada09b1ab69918bf173940735acde0bbe
4
+ data.tar.gz: 58f1a9cc4503974439dc28d496ecaab1668d0479
5
5
  SHA512:
6
- metadata.gz: 5617f40d20408389c2cac83277cf87865bf3103d7606fff84c0dfd6349d577fe3aea9b1649dc716b929e4631d1a45ad15df96a4e8d1766f8c16e66333a97668c
7
- data.tar.gz: c761206de05d16b81b4875dd3c57aa62b5ea5b0c0e301b53321f308ff45ba19c2e9437734020d0ad3a52c7f56763cb81a390f82fb50dc70d537c0cb0edfee883
6
+ metadata.gz: ead945737e0a4e6acf57803f1a86c19c43b999ea58c71cd7a07a8dc30e826e25515017ccf60714992c7a2a0e66a0f58789bcbff549bb65c92bc8fef4d06c762d
7
+ data.tar.gz: 6d509b5dc49fd2f083cdb5a97e70fa17a43ad5bb6f282afa3e7ce23bd0fa73f85cf5417d6ed703e1747111b5ab3491376748a73d007df9387d9c2f5ace3ac553
data/Appraisals CHANGED
@@ -7,6 +7,10 @@ appraise 'rails-4' do
7
7
  gem 'rails', '4.1.6'
8
8
  end
9
9
 
10
+ appraise 'rails-5' do
11
+ gem 'rails', '5.0.0'
12
+ end
13
+
10
14
  appraise 'rack-1.5.2' do
11
15
  gem 'rack', '1.5.2'
12
16
  end
@@ -1,3 +1,31 @@
1
+ 0.17.0 (7/29/2016)
2
+ ==================
3
+
4
+ #### Features
5
+
6
+ * [#1393](https://github.com/ruby-grape/grape/pull/1393): Middleware can be inserted before or after default Grape middleware - [@ridiculous](https://github.com/ridiculous).
7
+ * [#1390](https://github.com/ruby-grape/grape/pull/1390): Allow inserting middleware at arbitrary points in the middleware stack - [@Rosa](https://github.com/Rosa).
8
+ * [#1366](https://github.com/ruby-grape/grape/pull/1366): Store `message_key` on `Grape::Exceptions::Validation` - [@mkou](https://github.com/mkou).
9
+ * [#1398](https://github.com/ruby-grape/grape/pull/1398): Add `rescue_from :grape_exceptions` - allow Grape to use the built-in `Grape::Exception` handing and use `rescue :all` behavior for everything else - [@mmclead](https://github.com/mmclead).
10
+ * [#1443](https://github.com/ruby-grape/grape/pull/1443): Extend `given` to receive a `Proc` - [@glaucocustodio](https://github.com/glaucocustodio).
11
+ * [#1455](https://github.com/ruby-grape/grape/pull/1455): Add an automated PR linter - [@orta](https://github.com/orta).
12
+
13
+ #### Fixes
14
+
15
+ * [#1463](https://github.com/ruby-grape/grape/pull/1463): Fix array indicies in error messages - [@ffloyd](https://github.com/ffloyd).
16
+ * [#1465](https://github.com/ruby-grape/grape/pull/1465): Fix 'before' being called twice when using not allowed method - [@jsteinberg](https://github.com/jsteinberg).
17
+ * [#1446](https://github.com/ruby-grape/grape/pull/1446): Fix for `env` inside `before` when using not allowed method - [@leifg](https://github.com/leifg).
18
+ * [#1438](https://github.com/ruby-grape/grape/pull/1439): Try to dup non-frozen default params with each use - [@jlfaber](https://github.com/jlfaber).
19
+ * [#1430](https://github.com/ruby-grape/grape/pull/1430): Fix for `declared(params)` inside `route_param` - [@Arkanain](https://github.com/Arkanain).
20
+ * [#1405](https://github.com/ruby-grape/grape/pull/1405): Fix priority of `rescue_from` clauses applying - [@hedgesky](https://github.com/hedgesky).
21
+ * [#1365](https://github.com/ruby-grape/grape/pull/1365): Fix finding exception handler in error middleware - [@ktimothy](https://github.com/ktimothy).
22
+ * [#1380](https://github.com/ruby-grape/grape/pull/1380): Fix `allow_blank: false` for `Time` attributes with valid values causes `NoMethodError` - [@ipkes](https://github.com/ipkes).
23
+ * [#1384](https://github.com/ruby-grape/grape/pull/1384): Fix parameter validation with an empty optional nested `Array` - [@ipkes](https://github.com/ipkes).
24
+ * [#1414](https://github.com/ruby-grape/grape/pull/1414): Fix multiple version definitions for path versioning - [@304](https://github.com/304).
25
+ * [#1415](https://github.com/ruby-grape/grape/pull/1415): Fix `declared(params, include_parent_namespaces: false)` - [@304](https://github.com/304).
26
+ * [#1421](https://github.com/ruby-grape/grape/pull/1421): Avoid polluting `Grape::Middleware::Error` - [@namusyaka](https://github.com/namusyaka).
27
+ * [#1422](https://github.com/ruby-grape/grape/pull/1422): Concat parent declared params with current one - [@plukevdh](https://github.com/plukevdh), [@rnubel](https://github.com/rnubel), [@namusyaka](https://github.com/namusyaka).
28
+
1
29
  0.16.2 (4/12/2016)
2
30
  ==================
3
31
 
@@ -92,7 +120,7 @@
92
120
  * [#1039](https://github.com/ruby-grape/grape/pull/1039): Added support for custom parameter types - [@rnubel](https://github.com/rnubel).
93
121
  * [#1047](https://github.com/ruby-grape/grape/pull/1047): Adds `given` to DSL::Parameters, allowing for dependent params - [@rnubel](https://github.com/rnubel).
94
122
  * [#1064](https://github.com/ruby-grape/grape/pull/1064): Add public `Grape::Exception::ValidationErrors#full_messages` - [@romanlehnert](https://github.com/romanlehnert).
95
- * [#1079](https://github.com/ruby-grape/grape/pull/1079): Added `stream` method to take advantage of `Rack::Chunked` [@zbelzer](https://github.com/zbelzer).
123
+ * [#1079](https://github.com/ruby-grape/grape/pull/1079): Added `stream` method to take advantage of `Rack::Chunked` - [@zbelzer](https://github.com/zbelzer).
96
124
  * [#1086](https://github.com/ruby-grape/grape/pull/1086): Added `ActiveSupport::Notifications` instrumentation - [@wagenet](https://github.com/wagenet).
97
125
 
98
126
  #### Fixes
@@ -101,7 +129,7 @@
101
129
  * [#1038](https://github.com/ruby-grape/grape/pull/1038): Avoid dup-ing the `String` class when used in inherited params - [@rnubel](https://github.com/rnubel).
102
130
  * [#1042](https://github.com/ruby-grape/grape/issues/1042): Fix coercion of complex arrays - [@dim](https://github.com/dim).
103
131
  * [#1045](https://github.com/ruby-grape/grape/pull/1045): Do not convert `Rack::Response` to `Rack::Response` in middleware - [@dmitry](https://github.com/dmitry).
104
- * [#1048](https://github.com/ruby-grape/grape/pull/1048): Only dup `InheritableValues`, remove support for `deep_dup` - [@toddmazierski](https://github.com/toddmazierski/).
132
+ * [#1048](https://github.com/ruby-grape/grape/pull/1048): Only dup `InheritableValues`, remove support for `deep_dup` - [@toddmazierski](https://github.com/toddmazierski).
105
133
  * [#1052](https://github.com/ruby-grape/grape/pull/1052): Reset `description[:params]` when resetting validations - [@marshall-lee](https://github.com/marshall-lee).
106
134
  * [#1088](https://github.com/ruby-grape/grape/pull/1088): Support ActiveSupport 3.x by explicitly requiring `Hash#except` - [@wagenet](https://github.com/wagenet).
107
135
  * [#1096](https://github.com/ruby-grape/grape/pull/1096): Fix coercion on booleans - [@towanda](https://github.com/towanda).
@@ -117,7 +145,7 @@
117
145
  * [#974](https://github.com/ruby-grape/grape/pull/974): Added `error!` to `rescue_from` blocks - [@whatasunnyday](https://github.com/whatasunnyday).
118
146
  * [#950](https://github.com/ruby-grape/grape/pull/950): Status method can now accept one of Rack::Utils status code symbols (:ok, :found, :bad_request, etc.) - [@dabrorius](https://github.com/dabrorius).
119
147
  * [#952](https://github.com/ruby-grape/grape/pull/952): Status method now raises error when called with invalid status code - [@dabrorius](https://github.com/dabrorius).
120
- * [#957](https://github.com/ruby-grape/grape/pull/957): Regexp validator now supports `allow_blank`, `nil` value behavior changed - [@calfzhou](https://giihub.com/calfzhou).
148
+ * [#957](https://github.com/ruby-grape/grape/pull/957): Regexp validator now supports `allow_blank`, `nil` value behavior changed - [@calfzhou](https://github.com/calfzhou).
121
149
  * [#962](https://github.com/ruby-grape/grape/pull/962): The `default` attribute with `false` value is documented now - [@ajvondrak](https://github.com/ajvondrak).
122
150
  * [#1026](https://github.com/ruby-grape/grape/pull/1026): Added `file` method, explicitly setting a file-like response object - [@dblock](https://github.com/dblock).
123
151
 
@@ -178,8 +206,8 @@
178
206
  * [#826](https://github.com/ruby-grape/grape/pull/826): Find `coerce_type` for `Array` when not specified - [@manovotn](https://github.com/manovotn).
179
207
  * [#645](https://github.com/ruby-grape/grape/issues/645): Invoking `body false` will return `204 No Content` - [@dblock](https://github.com/dblock).
180
208
  * [#801](https://github.com/ruby-grape/grape/issues/801): Only evaluate permitted parameter `values` and `default` lazily on each request when declared as a proc - [@dblock](https://github.com/dblock).
181
- * [#679](https://github.com/ruby-grape/grape/issues/679): Fixed `OPTIONS` method returning 404 when combined with `prefix`- [@dblock](https://github.com/dblock).
182
- * [#679](https://github.com/ruby-grape/grape/issues/679): Fixed unsupported methods returning 404 instead of 405 when combined with `prefix`- [@dblock](https://github.com/dblock).
209
+ * [#679](https://github.com/ruby-grape/grape/issues/679): Fixed `OPTIONS` method returning 404 when combined with `prefix` - [@dblock](https://github.com/dblock).
210
+ * [#679](https://github.com/ruby-grape/grape/issues/679): Fixed unsupported methods returning 404 instead of 405 when combined with `prefix` - [@dblock](https://github.com/dblock).
183
211
 
184
212
  0.9.0 (8/27/2014)
185
213
  =================
@@ -259,7 +287,7 @@
259
287
  * [#557](https://github.com/ruby-grape/grape/pull/557): Pass `content_types` option to `Grape::Middleware::Error` to fix the content-type header for custom formats. - [@bernd](https://github.com/bernd).
260
288
  * [#585](https://github.com/ruby-grape/grape/pull/585): Fix after boot thread-safety issue - [@etehtsea](https://github.com/etehtsea).
261
289
  * [#587](https://github.com/ruby-grape/grape/pull/587): Fix oauth2 middleware compatibility with [draft-ietf-oauth-v2-31](http://tools.ietf.org/html/draft-ietf-oauth-v2-31) spec - [@etehtsea](https://github.com/etehtsea).
262
- * [#610](https://github.com/ruby-grape/grape/pull/610): Fixed group keyword was not working with type parameter - [@klausmeyer](https://github.com/klausmeyer/).
290
+ * [#610](https://github.com/ruby-grape/grape/pull/610): Fixed group keyword was not working with type parameter - [@klausmeyer](https://github.com/klausmeyer).
263
291
 
264
292
  0.6.1 (10/19/2013)
265
293
  ==================
@@ -290,7 +318,7 @@
290
318
  * [#448](https://github.com/ruby-grape/grape/pull/448): Adding POST style parameters for DELETE requests - [@dquimper](https://github.com/dquimper).
291
319
  * [#450](https://github.com/ruby-grape/grape/pull/450): Added option to pass an exception handler lambda as an argument to `rescue_from` - [@robertopedroso](https://github.com/robertopedroso).
292
320
  * [#443](https://github.com/ruby-grape/grape/pull/443): Let `requires` and `optional` take blocks that initialize new scopes - [@asross](https://github.com/asross).
293
- * [#452](https://github.com/ruby-grape/grape/pull/452): Added `with` as a hash option to specify handlers for `rescue_from` and `error_formatter` [@robertopedroso](https://github.com/robertopedroso).
321
+ * [#452](https://github.com/ruby-grape/grape/pull/452): Added `with` as a hash option to specify handlers for `rescue_from` and `error_formatter` - [@robertopedroso](https://github.com/robertopedroso).
294
322
  * [#433](https://github.com/ruby-grape/grape/issues/433), [#462](https://github.com/ruby-grape/grape/issues/462): Validation errors are now collected and `Grape::Exceptions::ValidationErrors` is raised - [@stevschmid](https://github.com/stevschmid).
295
323
 
296
324
  #### Fixes
@@ -322,7 +350,7 @@
322
350
  * [#408](https://github.com/ruby-grape/grape/pull/408): Fix: Goliath passes request header keys as symbols not strings - [@bobek](https://github.com/bobek).
323
351
  * [#417](https://github.com/ruby-grape/grape/issues/417): Fix: Rails 4 does not rewind input, causes POSTed data to be empty - [@dblock](https://github.com/dblock).
324
352
  * [#423](https://github.com/ruby-grape/grape/pull/423): Fix: `Grape::Endpoint#declared` now correctly handles nested params (ie. declared with `group`) - [@jbarreneche](https://github.com/jbarreneche).
325
- * [#427](https://github.com/ruby-grape/grape/issues/427): Fix: `declared(params)` breaks when `params` contains array - [@timhabermaas](https://github.com/timhabermaas)
353
+ * [#427](https://github.com/ruby-grape/grape/issues/427): Fix: `declared(params)` breaks when `params` contains array - [@timhabermaas](https://github.com/timhabermaas).
326
354
 
327
355
  0.4.1 (4/1/2013)
328
356
  ================
@@ -361,32 +389,32 @@
361
389
  * [#340](https://github.com/ruby-grape/grape/pull/339), [#342](https://github.com/ruby-grape/grape/pull/342): Added `:cascade` option to `version` to allow disabling of rack/mount cascade behavior - [@dieb](https://github.com/dieb).
362
390
  * [#333](https://github.com/ruby-grape/grape/pull/333): Added support for validation of arrays in `params` - [@flyerhzm](https://github.com/flyerhzm).
363
391
  * [#306](https://github.com/ruby-grape/grape/issues/306): Added I18n support for all Grape exceptions - [@niedhui](https://github.com/niedhui).
364
- * [#309](https://github.com/ruby-grape/grape/pull/309): Added XML support to the entity presenter - [@johnnyiller](https://github.com/johnnyiller), [@dblock](http://github.com/dblock).
365
- * [#131](https://github.com/ruby-grape/grape/issues/131): Added instructions for Grape API reloading in Rails - [@jyn](http://github.com/jyn), [@dblock](http://github.com/dblock).
366
- * [#317](https://github.com/ruby-grape/grape/issues/317): Added `headers` that returns a hash of parsed HTTP request headers - [@dblock](http://github.com/dblock).
392
+ * [#309](https://github.com/ruby-grape/grape/pull/309): Added XML support to the entity presenter - [@johnnyiller](https://github.com/johnnyiller), [@dblock](https://github.com/dblock).
393
+ * [#131](https://github.com/ruby-grape/grape/issues/131): Added instructions for Grape API reloading in Rails - [@jyn](https://github.com/jyn), [@dblock](https://github.com/dblock).
394
+ * [#317](https://github.com/ruby-grape/grape/issues/317): Added `headers` that returns a hash of parsed HTTP request headers - [@dblock](https://github.com/dblock).
367
395
  * [#332](https://github.com/ruby-grape/grape/pull/332): `Grape::Exceptions::Validation` now contains full nested parameter names - [@alovak](https://github.com/alovak).
368
- * [#328](https://github.com/ruby-grape/grape/issues/328): API version can now be specified as both String and Symbol - [@dblock](http://github.com/dblock).
369
- * [#190](https://github.com/ruby-grape/grape/issues/190): When you add a `GET` route for a resource, a route for the `HEAD` method will also be added automatically. You can disable this behavior with `do_not_route_head!` - [@dblock](http://github.com/dblock).
370
- * Added `do_not_route_options!`, which disables the automatic creation of the `OPTIONS` route - [@dblock](http://github.com/dblock).
371
- * [#309](https://github.com/ruby-grape/grape/pull/309): An XML format API will return an error instead of returning a string representation of the response if the latter cannot be converted to XML - [@dblock](http://github.com/dblock).
372
- * A formatter that raises an exception will cause the API to return a 500 error - [@dblock](http://github.com/dblock).
373
- * [#322](https://github.com/ruby-grape/grape/issues/322): When returning a 406 status, Grape will include the requested format or content-type in the response body - [@dblock](http://github.com/dblock).
374
- * [#60](https://github.com/ruby-grape/grape/issues/60): Fix: mounting of a Grape API onto a path - [@dblock](http://github.com/dblock).
375
- * [#335](https://github.com/ruby-grape/grape/pull/335): Fix: request body parameters from a `PATCH` request not available in `params` - [@FreakenK](http://github.com/FreakenK).
396
+ * [#328](https://github.com/ruby-grape/grape/issues/328): API version can now be specified as both String and Symbol - [@dblock](https://github.com/dblock).
397
+ * [#190](https://github.com/ruby-grape/grape/issues/190): When you add a `GET` route for a resource, a route for the `HEAD` method will also be added automatically. You can disable this behavior with `do_not_route_head!` - [@dblock](https://github.com/dblock).
398
+ * Added `do_not_route_options!`, which disables the automatic creation of the `OPTIONS` route - [@dblock](https://github.com/dblock).
399
+ * [#309](https://github.com/ruby-grape/grape/pull/309): An XML format API will return an error instead of returning a string representation of the response if the latter cannot be converted to XML - [@dblock](https://github.com/dblock).
400
+ * A formatter that raises an exception will cause the API to return a 500 error - [@dblock](https://github.com/dblock).
401
+ * [#322](https://github.com/ruby-grape/grape/issues/322): When returning a 406 status, Grape will include the requested format or content-type in the response body - [@dblock](https://github.com/dblock).
402
+ * [#60](https://github.com/ruby-grape/grape/issues/60): Fix: mounting of a Grape API onto a path - [@dblock](https://github.com/dblock).
403
+ * [#335](https://github.com/ruby-grape/grape/pull/335): Fix: request body parameters from a `PATCH` request not available in `params` - [@FreakenK](https://github.com/FreakenK).
376
404
 
377
405
  0.2.6 (01/11/2013)
378
406
  ==================
379
407
 
380
- * Fix: support content-type with character set when parsing POST and PUT input - [@dblock](http://github.com/dblock).
381
- * Fix: CVE-2013-0175, multi_xml parse vulnerability, require multi_xml 0.5.2 - [@dblock](http://github.com/dblock).
408
+ * Fix: support content-type with character set when parsing POST and PUT input - [@dblock](https://github.com/dblock).
409
+ * Fix: CVE-2013-0175, multi_xml parse vulnerability, require multi_xml 0.5.2 - [@dblock](https://github.com/dblock).
382
410
 
383
411
  0.2.5 (01/10/2013)
384
412
  ==================
385
413
 
386
- * Added support for custom parsers via `parser`, in addition to built-in multipart, JSON and XML parsers - [@dblock](http://github.com/dblock).
387
- * Removed `body_params`, data sent via a POST or PUT with a supported content-type is merged into `params` - [@dblock](http://github.com/dblock).
388
- * Setting `format` will automatically remove other content-types by calling `content_type` - [@dblock](http://github.com/dblock).
389
- * Setting `content_type` will prevent any input data other than the matching content-type or any Rack-supported form and parseable media types (`application/x-www-form-urlencoded`, `multipart/form-data`, `multipart/related` and `multipart/mixed`) from being parsed - [@dblock](http://github.com/dblock).
414
+ * Added support for custom parsers via `parser`, in addition to built-in multipart, JSON and XML parsers - [@dblock](https://github.com/dblock).
415
+ * Removed `body_params`, data sent via a POST or PUT with a supported content-type is merged into `params` - [@dblock](https://github.com/dblock).
416
+ * Setting `format` will automatically remove other content-types by calling `content_type` - [@dblock](https://github.com/dblock).
417
+ * Setting `content_type` will prevent any input data other than the matching content-type or any Rack-supported form and parseable media types (`application/x-www-form-urlencoded`, `multipart/form-data`, `multipart/related` and `multipart/mixed`) from being parsed - [@dblock](https://github.com/dblock).
390
418
  * [#305](https://github.com/ruby-grape/grape/issues/305): Fix: presenting arrays of objects via `represent` or when auto-detecting an `Entity` constant in the objects being presented - [@brandonweiss](https://github.com/brandonweiss).
391
419
  * [#306](https://github.com/ruby-grape/grape/issues/306): Added i18n support for validation error messages - [@niedhui](https://github.com/niedhui).
392
420
 
@@ -444,7 +472,7 @@
444
472
  * [#181](https://github.com/ruby-grape/grape/pull/181): Fix: Corrected JSON serialization of nested hashes containing `Grape::Entity` instances - [@benrosenblum](https://github.com/benrosenblum).
445
473
  * [#203](https://github.com/ruby-grape/grape/pull/203): Added a check to `Entity#serializable_hash` that verifies an entity exists on an object - [@adamgotterer](https://github.com/adamgotterer).
446
474
  * [#208](https://github.com/ruby-grape/grape/pull/208): `Entity#serializable_hash` must also check if attribute is generated by a user supplied block - [@ppadron](https://github.com/ppadron).
447
- * [#252](https://github.com/ruby-grape/grape/pull/252): Resources that don't respond to a requested HTTP method return 405 (Method Not Allowed) instead of 404 (Not Found) - [@simulacre](https://github.com/simulacre)
475
+ * [#252](https://github.com/ruby-grape/grape/pull/252): Resources that don't respond to a requested HTTP method return 405 (Method Not Allowed) instead of 404 (Not Found) - [@simulacre](https://github.com/simulacre).
448
476
 
449
477
  0.2.1 (7/11/2012)
450
478
  =================
@@ -483,7 +511,6 @@
483
511
  * Added support for before and after filters - [@mbleigh](https://github.com/mbleigh).
484
512
  * Extended `rescue_from`, which can now take a block - [@dblock](https://github.com/dblock).
485
513
 
486
-
487
514
  0.1.5 (6/14/2011)
488
515
  ==================
489
516
 
@@ -0,0 +1,80 @@
1
+ # --------------------------------------------------------------------------------------------------------------------
2
+ # Has any changes happened inside the actual library code?
3
+ # --------------------------------------------------------------------------------------------------------------------
4
+ has_app_changes = !git.modified_files.grep(/lib/).empty?
5
+ has_spec_changes = !git.modified_files.grep(/spec/).empty?
6
+
7
+ # --------------------------------------------------------------------------------------------------------------------
8
+ # You've made changes to lib, but didn't write any tests?
9
+ # --------------------------------------------------------------------------------------------------------------------
10
+ if has_app_changes && !has_spec_changes
11
+ raise("There're library changes, but not tests. That's OK as long as you're refactoring existing code.", sticky: false)
12
+ end
13
+
14
+ # --------------------------------------------------------------------------------------------------------------------
15
+ # You've made changes to specs, but no library code has changed?
16
+ # --------------------------------------------------------------------------------------------------------------------
17
+ if !has_app_changes && has_spec_changes
18
+ message('We really appreciate pull requests that demonstrate issues, even without a fix. That said, the next step is to try and fix the failing tests!', sticky: false)
19
+ end
20
+
21
+ # --------------------------------------------------------------------------------------------------------------------
22
+ # Have you updated CHANGELOG.md?
23
+ # --------------------------------------------------------------------------------------------------------------------
24
+ if !git.modified_files.include?('CHANGELOG.md') && has_app_changes
25
+ pr_number = github.pr_json['number']
26
+ markdown <<-MARKDOWN
27
+ Here's an example of a CHANGELOG.md entry:
28
+
29
+ ```markdown
30
+ * [##{pr_number}](https://github.com/ruby-grape/grape/pull/#{pr_number}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
31
+ ```
32
+ MARKDOWN
33
+ raise('Please update CHANGELOG.md.', sticky: false)
34
+ end
35
+
36
+ # --------------------------------------------------------------------------------------------------------------------
37
+ # Is the CHANGELOG.md format correct?
38
+ # --------------------------------------------------------------------------------------------------------------------
39
+
40
+ your_contribution_here = false
41
+ releases = 0
42
+ errors = 0
43
+ File.open('CHANGELOG.md').each_line do |line|
44
+ # only look at the top releases, we entered a lot of changes without a PR before
45
+ if line == "==================\n"
46
+ releases += 1
47
+ break if releases == 5
48
+ end
49
+ # ignore lines that aren't changes
50
+ next unless line[0] == '*'
51
+ # notice your contribution here
52
+ if line == "* Your contribution here.\n"
53
+ your_contribution_here = true
54
+ next
55
+ end
56
+ # match the PR format
57
+ next if line =~ %r{^\*\s\[\#\d+\]\(https:\/\/github\.com\/.*\d+\)\: [\`[:upper:]].* \- \[\@[\w\d\-\_]+\]\(https:\/\/github\.com\/.*[\w\d\-\_]+\)\.$}
58
+ errors += 1
59
+ markdown <<-MARKDOWN
60
+ ```markdown
61
+ #{line}```
62
+ MARKDOWN
63
+ end
64
+
65
+ raise("One of the lines below found in CHANGELOG.md doesn't match the expected format. Please make it look like the other lines, pay attention to periods and spaces.", sticky: false) if errors > 0
66
+ raise('Please put back the `* Your contribution here.` line into CHANGELOG.md.', sticky: false) unless your_contribution_here
67
+
68
+ # --------------------------------------------------------------------------------------------------------------------
69
+ # Don't let testing shortcuts get into master by accident,
70
+ # ensuring that we don't get green builds based on a subset of tests.
71
+ # --------------------------------------------------------------------------------------------------------------------
72
+
73
+ (git.modified_files + git.added_files - %w(Dangerfile)).each do |file|
74
+ next unless File.file?(file)
75
+ contents = File.read(file)
76
+ if file.start_with?('spec')
77
+ raise("`xit` or `fit` left in tests (#{file})") if contents =~ /^\w*[xf]it/
78
+ raise("`fdescribe` left in tests (#{file})") if contents =~ /^\w*fdescribe/
79
+ end
80
+ end
data/Gemfile CHANGED
@@ -1,9 +1,32 @@
1
+ # when changing this file, run appraisal install ; rubocop -a gemfiles/*.gemfile
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
7
  group :development, :test do
8
+ gem 'bundler'
9
+ gem 'rake'
10
+ gem 'rubocop', '0.39.0'
11
+ end
12
+
13
+ group :development do
6
14
  gem 'guard'
7
15
  gem 'guard-rspec'
8
16
  gem 'guard-rubocop'
17
+ gem 'yard'
18
+ gem 'appraisal'
19
+ gem 'benchmark-ips'
20
+ gem 'redcarpet'
21
+ end
22
+
23
+ group :test do
24
+ gem 'grape-entity', '0.5.0'
25
+ gem 'maruku'
26
+ gem 'rack-test'
27
+ gem 'rspec', '~> 3.0'
28
+ gem 'cookiejar'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
30
+ gem 'mime-types', '< 3.0'
31
+ gem 'danger', '~> 2.0'
9
32
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape (0.16.2)
4
+ grape (0.17.0)
5
5
  activesupport
6
6
  builder
7
7
  hashie (>= 2.1.0)
@@ -15,37 +15,59 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- activesupport (4.2.5.1)
18
+ activesupport (4.2.6)
19
19
  i18n (~> 0.7)
20
20
  json (~> 1.7, >= 1.7.7)
21
21
  minitest (~> 5.1)
22
22
  thread_safe (~> 0.3, >= 0.3.4)
23
23
  tzinfo (~> 1.1)
24
+ addressable (2.4.0)
24
25
  appraisal (2.1.0)
25
26
  bundler
26
27
  rake
27
28
  thor (>= 0.14.0)
28
29
  ast (2.2.0)
29
- astrolabe (1.3.1)
30
- parser (~> 2.2)
31
30
  axiom-types (0.1.1)
32
31
  descendants_tracker (~> 0.0.4)
33
32
  ice_nine (~> 0.11.0)
34
33
  thread_safe (~> 0.3, >= 0.3.1)
35
- benchmark-ips (2.5.0)
34
+ benchmark-ips (2.6.1)
36
35
  builder (3.2.2)
36
+ claide (1.0.0)
37
+ claide-plugins (0.9.1)
38
+ cork
39
+ nap
40
+ open4 (~> 1.3)
37
41
  coderay (1.1.1)
38
42
  coercible (1.0.0)
39
43
  descendants_tracker (~> 0.0.1)
44
+ colored (1.2)
40
45
  cookiejar (0.3.3)
46
+ cork (0.1.0)
47
+ colored (~> 1.2)
48
+ danger (2.0.1)
49
+ claide (~> 1.0)
50
+ claide-plugins (> 0.9.0)
51
+ colored (~> 1.2)
52
+ cork (~> 0.1)
53
+ faraday (~> 0)
54
+ faraday-http-cache (~> 1.0)
55
+ git (~> 1)
56
+ octokit (~> 4.2)
57
+ redcarpet (~> 3.3)
58
+ terminal-table (~> 1)
41
59
  descendants_tracker (0.0.4)
42
60
  thread_safe (~> 0.3, >= 0.3.1)
43
61
  diff-lcs (1.2.5)
44
62
  enumerable-lazy (0.0.1)
45
63
  equalizer (0.0.11)
64
+ faraday (0.9.2)
65
+ multipart-post (>= 1.2, < 3)
66
+ faraday-http-cache (1.3.0)
67
+ faraday (~> 0.8)
46
68
  ffi (1.9.10)
47
69
  formatador (0.2.5)
48
- git-version-bump (0.15.1)
70
+ git (1.3.0)
49
71
  grape-entity (0.5.0)
50
72
  activesupport
51
73
  multi_json (>= 1.3.2)
@@ -59,34 +81,40 @@ GEM
59
81
  shellany (~> 0.0)
60
82
  thor (>= 0.18.1)
61
83
  guard-compat (1.2.1)
62
- guard-rspec (4.6.4)
84
+ guard-rspec (4.6.5)
63
85
  guard (~> 2.1)
64
86
  guard-compat (~> 1.1)
65
87
  rspec (>= 2.99.0, < 4.0)
66
88
  guard-rubocop (1.2.0)
67
89
  guard (~> 2.0)
68
90
  rubocop (~> 0.20)
69
- hashie (3.4.3)
91
+ hashie (3.4.4)
70
92
  i18n (0.7.0)
71
93
  ice_nine (0.11.2)
72
94
  json (1.8.3)
73
- listen (3.0.6)
95
+ listen (3.1.2)
74
96
  rb-fsevent (>= 0.9.3)
75
97
  rb-inotify (>= 0.9.7)
98
+ ruby_dep (~> 1.1)
76
99
  lumberjack (1.0.10)
77
100
  maruku (0.7.2)
78
101
  method_source (0.8.2)
79
102
  mime-types (2.99.1)
80
103
  minitest (5.8.4)
81
- multi_json (1.11.2)
104
+ multi_json (1.11.3)
82
105
  multi_xml (0.5.5)
83
- mustermann19 (0.4.3)
106
+ multipart-post (2.0.0)
107
+ mustermann19 (0.4.4)
84
108
  enumerable-lazy
109
+ nap (1.1.0)
85
110
  nenv (0.3.0)
86
111
  notiffany (0.0.8)
87
112
  nenv (~> 0.1)
88
113
  shellany (~> 0.0)
89
- parser (2.3.0.6)
114
+ octokit (4.3.0)
115
+ sawyer (~> 0.7.0, >= 0.5.3)
116
+ open4 (1.3.4)
117
+ parser (2.3.1.0)
90
118
  ast (~> 2.2)
91
119
  powerpack (0.1.1)
92
120
  pry (0.10.3)
@@ -96,21 +124,21 @@ GEM
96
124
  rack (1.6.4)
97
125
  rack-accept (0.4.5)
98
126
  rack (>= 0.4)
99
- rack-contrib (1.4.0)
100
- git-version-bump (~> 0.15)
101
- rack (~> 1.4)
127
+ rack-jsonp (1.3.1)
128
+ rack
102
129
  rack-test (0.6.3)
103
130
  rack (>= 1.0)
104
131
  rainbow (2.1.0)
105
- rake (10.5.0)
132
+ rake (11.1.2)
106
133
  rb-fsevent (0.9.7)
107
134
  rb-inotify (0.9.7)
108
135
  ffi (>= 0.5.0)
136
+ redcarpet (3.3.4)
109
137
  rspec (3.4.0)
110
138
  rspec-core (~> 3.4.0)
111
139
  rspec-expectations (~> 3.4.0)
112
140
  rspec-mocks (~> 3.4.0)
113
- rspec-core (3.4.3)
141
+ rspec-core (3.4.4)
114
142
  rspec-support (~> 3.4.0)
115
143
  rspec-expectations (3.4.0)
116
144
  diff-lcs (>= 1.2.0, < 2.0)
@@ -119,21 +147,25 @@ GEM
119
147
  diff-lcs (>= 1.2.0, < 2.0)
120
148
  rspec-support (~> 3.4.0)
121
149
  rspec-support (3.4.1)
122
- rubocop (0.35.1)
123
- astrolabe (~> 1.3)
124
- parser (>= 2.2.3.0, < 3.0)
150
+ rubocop (0.39.0)
151
+ parser (>= 2.3.0.7, < 3.0)
125
152
  powerpack (~> 0.1)
126
153
  rainbow (>= 1.99.1, < 3.0)
127
154
  ruby-progressbar (~> 1.7)
128
- tins (<= 1.6.0)
129
- ruby-progressbar (1.7.5)
155
+ unicode-display_width (~> 1.0, >= 1.0.1)
156
+ ruby-progressbar (1.8.0)
157
+ ruby_dep (1.1.0)
158
+ sawyer (0.7.0)
159
+ addressable (>= 2.3.5, < 2.5)
160
+ faraday (~> 0.8, < 0.10)
130
161
  shellany (0.0.1)
131
162
  slop (3.6.0)
163
+ terminal-table (1.6.0)
132
164
  thor (0.19.1)
133
165
  thread_safe (0.3.5)
134
- tins (1.6.0)
135
166
  tzinfo (1.2.2)
136
167
  thread_safe (~> 0.1)
168
+ unicode-display_width (1.0.5)
137
169
  virtus (1.0.5)
138
170
  axiom-types (~> 0.1)
139
171
  coercible (~> 1.0)
@@ -149,6 +181,7 @@ DEPENDENCIES
149
181
  benchmark-ips
150
182
  bundler
151
183
  cookiejar
184
+ danger (~> 2.0)
152
185
  grape!
153
186
  grape-entity (= 0.5.0)
154
187
  guard
@@ -156,12 +189,13 @@ DEPENDENCIES
156
189
  guard-rubocop
157
190
  maruku
158
191
  mime-types (< 3.0)
159
- rack-contrib
192
+ rack-jsonp
160
193
  rack-test
161
- rake (~> 10)
194
+ rake
195
+ redcarpet
162
196
  rspec (~> 3.0)
163
- rubocop (= 0.35.1)
197
+ rubocop (= 0.39.0)
164
198
  yard
165
199
 
166
200
  BUNDLED WITH
167
- 1.11.2
201
+ 1.12.1