restfulness 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -3
- data/Gemfile +3 -0
- data/README.md +6 -0
- data/lib/restfulness.rb +1 -4
- data/lib/restfulness/request.rb +3 -1
- data/lib/restfulness/version.rb +1 -1
- data/restfulness.gemspec +1 -1
- data/spec/unit/request_spec.rb +11 -3
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8d0ae0d276f2bc7050b05eb6e5847dbdb806eb4
|
4
|
+
data.tar.gz: 125d361645226748911052cddd7ffd754b868e31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f72e3f6622107325d6758bfcdc9e65706bdad87fa196800c900e8a570e16e8ed52863b3b715e7c3b45c7c53a02291eb79f5cdae7e5aafc550d50ab9d78c0757
|
7
|
+
data.tar.gz: b38a2f978128b3962e4fa7d8fc27fdb1b322eceeb8d76b0da32d34ade8e6075429e6d84beb66ef1066a28ac4ad02878b24beb7ee091cf2d2b2cc75923372048a
|
data/.travis.yml
CHANGED
@@ -7,17 +7,20 @@ rvm:
|
|
7
7
|
- 2.1.10
|
8
8
|
- 2.2.4
|
9
9
|
- 2.3.0
|
10
|
-
- jruby
|
11
10
|
- rbx
|
12
11
|
before_install:
|
13
12
|
- gem install bundler
|
14
13
|
env:
|
15
14
|
- JRUBY_OPTS=--2.0
|
16
15
|
matrix:
|
16
|
+
include:
|
17
|
+
# JRuby takes a lot more effort
|
18
|
+
- rvm: jruby-9.1.5.0
|
19
|
+
env: JRUBY_OPTS='--2.0'
|
20
|
+
gemfile: Gemfile.activesupport-4.x
|
17
21
|
allow_failures:
|
18
22
|
- rvm: 2.0.0
|
19
23
|
gemfile: Gemfile.activesupport-5.x
|
20
24
|
- rvm: 2.1.10
|
21
25
|
gemfile: Gemfile.activesupport-5.x
|
22
|
-
- rvm:
|
23
|
-
gemfile: Gemfile.activesupport-5.x
|
26
|
+
- rvm: rbx
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -706,6 +706,12 @@ Restfulness is still a work in progress but at Cabify we are using it in product
|
|
706
706
|
|
707
707
|
## History
|
708
708
|
|
709
|
+
### 0.3.5 - February 21, 2017
|
710
|
+
|
711
|
+
* Rewind body after reading (@pacoguzman)
|
712
|
+
* Ensuring Rack compatibility from 1.5.0 through 2.0.1 (@samlown)
|
713
|
+
* Giving up on ensuring Travis works with jruby and rbx, sorry (@samlown)
|
714
|
+
|
709
715
|
### 0.3.4 - August 8, 2016
|
710
716
|
|
711
717
|
* Added helper methods for success responses (@samlown)
|
data/lib/restfulness.rb
CHANGED
@@ -5,10 +5,7 @@ require 'active_support'
|
|
5
5
|
require 'active_support/core_ext'
|
6
6
|
require 'active_support/dependencies'
|
7
7
|
require 'active_support/logger'
|
8
|
-
require 'rack
|
9
|
-
require 'rack/commonlogger'
|
10
|
-
require 'rack/showexceptions'
|
11
|
-
require 'rack/builder'
|
8
|
+
require 'rack'
|
12
9
|
|
13
10
|
require 'http_accept_language/parser'
|
14
11
|
|
data/lib/restfulness/request.rb
CHANGED
@@ -110,7 +110,9 @@ module Restfulness
|
|
110
110
|
unless body.nil?
|
111
111
|
# Sometimes the body can be a StringIO, Tempfile, or some other freakish IO.
|
112
112
|
if body.respond_to?(:read)
|
113
|
-
body.read
|
113
|
+
read_body = body.read
|
114
|
+
body.rewind if body.respond_to?(:rewind)
|
115
|
+
read_body
|
114
116
|
else
|
115
117
|
body
|
116
118
|
end
|
data/lib/restfulness/version.rb
CHANGED
data/restfulness.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "rack", "
|
21
|
+
spec.add_dependency "rack", ">= 1.5", "< 2.1"
|
22
22
|
spec.add_dependency "multi_json", "~> 1.8"
|
23
23
|
spec.add_dependency "activesupport", ">= 4.0", "< 6.0"
|
24
24
|
spec.add_dependency "http_accept_language", "~> 2.0"
|
data/spec/unit/request_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Restfulness::Request do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
let :klass do
|
14
14
|
Restfulness::Request
|
15
15
|
end
|
@@ -28,8 +28,8 @@ describe Restfulness::Request do
|
|
28
28
|
class EmptyIO
|
29
29
|
def read(count = nil, buffer = nil); ""; end
|
30
30
|
end
|
31
|
-
|
32
|
-
|
31
|
+
|
32
|
+
|
33
33
|
describe "#initialize" do
|
34
34
|
it "should prepare basic objects" do
|
35
35
|
expect(obj.action).to be_nil
|
@@ -236,6 +236,14 @@ describe Restfulness::Request do
|
|
236
236
|
expect(obj.body).to receive(:read)
|
237
237
|
expect(obj.params).to be_empty
|
238
238
|
end
|
239
|
+
|
240
|
+
it "should rewind IO body object when reading it" do
|
241
|
+
obj.headers[:content_type] = "application/x-www-form-urlencoded"
|
242
|
+
obj.body = StringIO.new("grant_type=password&username=johndoe&password=A3ddj3w")
|
243
|
+
|
244
|
+
expect(obj.params.keys).to eql(['grant_type', 'username', 'password'])
|
245
|
+
expect(obj.body.read).to eql('grant_type=password&username=johndoe&password=A3ddj3w')
|
246
|
+
end
|
239
247
|
end
|
240
248
|
|
241
249
|
describe "#sanitized_params" do
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restfulness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Lown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1
|
22
|
+
version: '2.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.5'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1
|
32
|
+
version: '2.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: multi_json
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
200
|
version: '0'
|
195
201
|
requirements: []
|
196
202
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
203
|
+
rubygems_version: 2.6.8
|
198
204
|
signing_key:
|
199
205
|
specification_version: 4
|
200
206
|
summary: Use to create a powerful, yet simple REST API in your application.
|