grape 0.6.1 → 0.7.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.
- checksums.yaml +9 -9
- data/.gitignore +7 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +3 -3
- data/CHANGELOG.md +42 -3
- data/CONTRIBUTING.md +118 -0
- data/Gemfile +4 -4
- data/README.md +312 -52
- data/Rakefile +6 -1
- data/UPGRADING.md +124 -0
- data/lib/grape.rb +2 -0
- data/lib/grape/api.rb +95 -44
- data/lib/grape/cookies.rb +0 -2
- data/lib/grape/endpoint.rb +63 -39
- data/lib/grape/error_formatter/base.rb +0 -3
- data/lib/grape/error_formatter/json.rb +0 -2
- data/lib/grape/error_formatter/txt.rb +0 -2
- data/lib/grape/error_formatter/xml.rb +0 -2
- data/lib/grape/exceptions/base.rb +0 -2
- data/lib/grape/exceptions/incompatible_option_values.rb +0 -3
- data/lib/grape/exceptions/invalid_formatter.rb +0 -3
- data/lib/grape/exceptions/invalid_versioner_option.rb +0 -4
- data/lib/grape/exceptions/invalid_with_option_for_represent.rb +0 -2
- data/lib/grape/exceptions/missing_mime_type.rb +0 -4
- data/lib/grape/exceptions/missing_option.rb +0 -3
- data/lib/grape/exceptions/missing_vendor_option.rb +0 -3
- data/lib/grape/exceptions/unknown_options.rb +0 -4
- data/lib/grape/exceptions/unknown_validator.rb +0 -2
- data/lib/grape/exceptions/validation_errors.rb +6 -5
- data/lib/grape/formatter/base.rb +0 -3
- data/lib/grape/formatter/json.rb +0 -2
- data/lib/grape/formatter/serializable_hash.rb +15 -16
- data/lib/grape/formatter/txt.rb +0 -2
- data/lib/grape/formatter/xml.rb +0 -2
- data/lib/grape/http/request.rb +2 -4
- data/lib/grape/locale/en.yml +1 -1
- data/lib/grape/middleware/auth/oauth2.rb +15 -6
- data/lib/grape/middleware/base.rb +7 -7
- data/lib/grape/middleware/error.rb +11 -6
- data/lib/grape/middleware/formatter.rb +80 -78
- data/lib/grape/middleware/globals.rb +13 -0
- data/lib/grape/middleware/versioner/accept_version_header.rb +0 -2
- data/lib/grape/middleware/versioner/header.rb +5 -3
- data/lib/grape/middleware/versioner/param.rb +2 -4
- data/lib/grape/middleware/versioner/path.rb +3 -4
- data/lib/grape/namespace.rb +0 -1
- data/lib/grape/parser/base.rb +0 -3
- data/lib/grape/parser/json.rb +0 -2
- data/lib/grape/parser/xml.rb +0 -2
- data/lib/grape/path.rb +1 -3
- data/lib/grape/route.rb +0 -3
- data/lib/grape/util/hash_stack.rb +1 -1
- data/lib/grape/validations.rb +72 -22
- data/lib/grape/validations/coerce.rb +5 -4
- data/lib/grape/validations/default.rb +5 -3
- data/lib/grape/validations/presence.rb +1 -1
- data/lib/grape/validations/regexp.rb +0 -2
- data/lib/grape/validations/values.rb +2 -1
- data/lib/grape/version.rb +1 -1
- data/spec/grape/api_spec.rb +385 -96
- data/spec/grape/endpoint_spec.rb +162 -15
- data/spec/grape/entity_spec.rb +25 -0
- data/spec/grape/exceptions/validation_errors_spec.rb +19 -0
- data/spec/grape/middleware/auth/oauth2_spec.rb +60 -15
- data/spec/grape/middleware/base_spec.rb +3 -8
- data/spec/grape/middleware/error_spec.rb +2 -2
- data/spec/grape/middleware/exception_spec.rb +4 -4
- data/spec/grape/middleware/formatter_spec.rb +7 -4
- data/spec/grape/middleware/versioner/param_spec.rb +8 -7
- data/spec/grape/path_spec.rb +24 -14
- data/spec/grape/util/hash_stack_spec.rb +8 -8
- data/spec/grape/validations/coerce_spec.rb +75 -33
- data/spec/grape/validations/default_spec.rb +57 -0
- data/spec/grape/validations/presence_spec.rb +13 -11
- data/spec/grape/validations/values_spec.rb +76 -2
- data/spec/grape/validations_spec.rb +443 -20
- data/spec/spec_helper.rb +2 -2
- data/spec/support/content_type_helpers.rb +11 -0
- metadata +9 -38
data/spec/spec_helper.rb
CHANGED
@@ -4,8 +4,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'support'))
|
|
4
4
|
|
5
5
|
require 'grape'
|
6
6
|
|
7
|
-
# require 'grape-entity'
|
8
|
-
|
9
7
|
require 'rubygems'
|
10
8
|
require 'bundler'
|
11
9
|
Bundler.setup :default, :test
|
@@ -20,6 +18,8 @@ Dir["#{File.dirname(__FILE__)}/support/*.rb"].each do |file|
|
|
20
18
|
require file
|
21
19
|
end
|
22
20
|
|
21
|
+
I18n.enforce_available_locales = false
|
22
|
+
|
23
23
|
RSpec.configure do |config|
|
24
24
|
config.include Rack::Test::Methods
|
25
25
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ContentTypeHelpers
|
2
|
+
%w(put patch post delete).each do |method|
|
3
|
+
define_method :"#{method}_with_json" do |uri, params = {}, env = {}, &block|
|
4
|
+
params = params.to_json
|
5
|
+
env["CONTENT_TYPE"] ||= "application/json"
|
6
|
+
send(method, uri, params, env, &block)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
include(ContentTypeHelpers)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -247,12 +247,14 @@ files:
|
|
247
247
|
- .travis.yml
|
248
248
|
- .yardopts
|
249
249
|
- CHANGELOG.md
|
250
|
+
- CONTRIBUTING.md
|
250
251
|
- Gemfile
|
251
252
|
- Guardfile
|
252
253
|
- LICENSE
|
253
254
|
- README.md
|
254
255
|
- RELEASING.md
|
255
256
|
- Rakefile
|
257
|
+
- UPGRADING.md
|
256
258
|
- grape.gemspec
|
257
259
|
- lib/grape.rb
|
258
260
|
- lib/grape/api.rb
|
@@ -289,6 +291,7 @@ files:
|
|
289
291
|
- lib/grape/middleware/error.rb
|
290
292
|
- lib/grape/middleware/filter.rb
|
291
293
|
- lib/grape/middleware/formatter.rb
|
294
|
+
- lib/grape/middleware/globals.rb
|
292
295
|
- lib/grape/middleware/versioner.rb
|
293
296
|
- lib/grape/middleware/versioner/accept_version_header.rb
|
294
297
|
- lib/grape/middleware/versioner/header.rb
|
@@ -319,6 +322,7 @@ files:
|
|
319
322
|
- spec/grape/exceptions/missing_option_spec.rb
|
320
323
|
- spec/grape/exceptions/unknown_options_spec.rb
|
321
324
|
- spec/grape/exceptions/unknown_validator_spec.rb
|
325
|
+
- spec/grape/exceptions/validation_errors_spec.rb
|
322
326
|
- spec/grape/middleware/auth/basic_spec.rb
|
323
327
|
- spec/grape/middleware/auth/digest_spec.rb
|
324
328
|
- spec/grape/middleware/auth/oauth2_spec.rb
|
@@ -343,6 +347,7 @@ files:
|
|
343
347
|
- spec/shared/versioning_examples.rb
|
344
348
|
- spec/spec_helper.rb
|
345
349
|
- spec/support/basic_auth_encode_helpers.rb
|
350
|
+
- spec/support/content_type_helpers.rb
|
346
351
|
- spec/support/versioned_helpers.rb
|
347
352
|
homepage: https://github.com/intridea/grape
|
348
353
|
licenses:
|
@@ -364,43 +369,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
364
369
|
version: '0'
|
365
370
|
requirements: []
|
366
371
|
rubyforge_project: grape
|
367
|
-
rubygems_version: 2.
|
372
|
+
rubygems_version: 2.2.2
|
368
373
|
signing_key:
|
369
374
|
specification_version: 4
|
370
375
|
summary: A simple Ruby framework for building REST-like APIs.
|
371
|
-
test_files:
|
372
|
-
- spec/grape/api_spec.rb
|
373
|
-
- spec/grape/endpoint_spec.rb
|
374
|
-
- spec/grape/entity_spec.rb
|
375
|
-
- spec/grape/exceptions/invalid_formatter_spec.rb
|
376
|
-
- spec/grape/exceptions/invalid_versioner_option_spec.rb
|
377
|
-
- spec/grape/exceptions/missing_mime_type_spec.rb
|
378
|
-
- spec/grape/exceptions/missing_option_spec.rb
|
379
|
-
- spec/grape/exceptions/unknown_options_spec.rb
|
380
|
-
- spec/grape/exceptions/unknown_validator_spec.rb
|
381
|
-
- spec/grape/middleware/auth/basic_spec.rb
|
382
|
-
- spec/grape/middleware/auth/digest_spec.rb
|
383
|
-
- spec/grape/middleware/auth/oauth2_spec.rb
|
384
|
-
- spec/grape/middleware/base_spec.rb
|
385
|
-
- spec/grape/middleware/error_spec.rb
|
386
|
-
- spec/grape/middleware/exception_spec.rb
|
387
|
-
- spec/grape/middleware/formatter_spec.rb
|
388
|
-
- spec/grape/middleware/versioner/accept_version_header_spec.rb
|
389
|
-
- spec/grape/middleware/versioner/header_spec.rb
|
390
|
-
- spec/grape/middleware/versioner/param_spec.rb
|
391
|
-
- spec/grape/middleware/versioner/path_spec.rb
|
392
|
-
- spec/grape/middleware/versioner_spec.rb
|
393
|
-
- spec/grape/path_spec.rb
|
394
|
-
- spec/grape/util/hash_stack_spec.rb
|
395
|
-
- spec/grape/validations/coerce_spec.rb
|
396
|
-
- spec/grape/validations/default_spec.rb
|
397
|
-
- spec/grape/validations/presence_spec.rb
|
398
|
-
- spec/grape/validations/regexp_spec.rb
|
399
|
-
- spec/grape/validations/values_spec.rb
|
400
|
-
- spec/grape/validations/zh-CN.yml
|
401
|
-
- spec/grape/validations_spec.rb
|
402
|
-
- spec/shared/versioning_examples.rb
|
403
|
-
- spec/spec_helper.rb
|
404
|
-
- spec/support/basic_auth_encode_helpers.rb
|
405
|
-
- spec/support/versioned_helpers.rb
|
376
|
+
test_files: []
|
406
377
|
has_rdoc:
|