restful_resource 1.2.2 → 1.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2d72ef667a20e5c2773931c3b5c449af79ed096
|
4
|
+
data.tar.gz: f0d464e0d0ffd5740c61d5ae6e251e755844e940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161b0138fea97c3cb5853514ddc3b799328bf01d8829276b84f1dadcd2b1513739f2a8a7163a35c54304c1549e184dd0d3d1731920b4c16e41e859fadbeb61fe
|
7
|
+
data.tar.gz: 40177d79fd2a410a23adbb5e93037b72fc82657f7d9caa1353cc318aa296984fd1e862d5a11eb3ca8ea45b1d1d3320332146777b5b75d419cc5d387105272304
|
data/Rakefile
CHANGED
@@ -9,12 +9,12 @@ desc "Upload to rubygems"
|
|
9
9
|
task :upload => :build do
|
10
10
|
# Check if tag with v#{ResearchSiteApiClient::VERSION} version exists, if so, return with error
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
if tag_exists?(current_tag_name)
|
13
|
+
puts "Tag exists, did you run rake increase_revision_number after merging with master?"
|
14
|
+
exit 1
|
15
|
+
end
|
16
16
|
|
17
|
-
|
17
|
+
create_tag(current_tag_name)
|
18
18
|
Rake::Task[:release].invoke
|
19
19
|
end
|
20
20
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# Use the Faraday-Typhoeus adapter provided by Typhoeus, not Faraday
|
2
|
+
require "typhoeus/adapters/faraday"
|
3
|
+
|
1
4
|
module RestfulResource
|
2
5
|
class HttpClient
|
3
6
|
class HttpError < StandardError
|
@@ -86,17 +89,15 @@ module RestfulResource
|
|
86
89
|
b.response :encoding
|
87
90
|
b.use :gzip
|
88
91
|
|
89
|
-
b.adapter :
|
90
|
-
nonblock: true, # Always use non-blocking IO (for safe timeouts)
|
91
|
-
persistent: true, # Re-use TCP connections
|
92
|
-
connect_timeout: 2, # seconds
|
93
|
-
read_timeout: 10, # seconds
|
94
|
-
write_timeout: 2 # seconds
|
92
|
+
b.adapter :typhoeus
|
95
93
|
end
|
96
94
|
end
|
97
95
|
|
98
96
|
def http_request(request)
|
99
97
|
response = @connection.send(request.method) do |req|
|
98
|
+
req.options.open_timeout = 2 # seconds
|
99
|
+
req.options.timeout = 10 # seconds
|
100
|
+
|
100
101
|
req.body = request.body unless request.body.nil?
|
101
102
|
req.url request.url
|
102
103
|
|
data/restful_resource.gemspec
CHANGED
@@ -20,8 +20,8 @@ describe RestfulResource::HttpClient do
|
|
20
20
|
let(:middleware) { connection.builder.handlers }
|
21
21
|
|
22
22
|
describe 'Builder configuration' do
|
23
|
-
it 'uses the
|
24
|
-
expect(middleware).to include Faraday::Adapter::
|
23
|
+
it 'uses the typhoeus adapter' do
|
24
|
+
expect(middleware).to include Faraday::Adapter::Typhoeus
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'url_encodes requests' do
|
@@ -65,29 +65,5 @@ describe RestfulResource::HttpClient do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
69
|
-
describe 'Excon Adapter configuration' do
|
70
|
-
let(:config) { find_middleware_args connection, 'Faraday::Adapter::Excon' }
|
71
|
-
|
72
|
-
it 'uses nonblock' do
|
73
|
-
expect(config[:nonblock]).to eq true
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'uses a persistent connection' do
|
77
|
-
expect(config[:persistent]).to eq true
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'has a connect_timeout of 2' do
|
81
|
-
expect(config[:connect_timeout]).to eq 2
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'has a read_timeout of 10' do
|
85
|
-
expect(config[:read_timeout]).to eq 10
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'has a write_timeout of 2' do
|
89
|
-
expect(config[:write_timeout]).to eq 2
|
90
|
-
end
|
91
|
-
end
|
92
68
|
end
|
93
|
-
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Santoro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -152,7 +152,7 @@ dependencies:
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
|
-
name:
|
155
|
+
name: typhoeus
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - ">="
|