httparty 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of httparty might be problematic. Click here for more details.
- data/Gemfile +4 -0
- data/History +5 -0
- data/lib/httparty.rb +1 -1
- data/lib/httparty/request.rb +1 -1
- data/lib/httparty/response.rb +5 -0
- data/lib/httparty/version.rb +1 -1
- data/spec/httparty/response_spec.rb +5 -0
- data/spec/httparty_spec.rb +5 -0
- metadata +6 -7
data/Gemfile
CHANGED
data/History
CHANGED
data/lib/httparty.rb
CHANGED
@@ -148,7 +148,7 @@ module HTTParty
|
|
148
148
|
# default_timeout 10
|
149
149
|
# end
|
150
150
|
def default_timeout(t)
|
151
|
-
raise ArgumentError, 'Timeout must be an integer' unless t && t.is_a?(Integer)
|
151
|
+
raise ArgumentError, 'Timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
|
152
152
|
default_options[:timeout] = t
|
153
153
|
end
|
154
154
|
|
data/lib/httparty/request.rb
CHANGED
@@ -101,7 +101,7 @@ module HTTParty
|
|
101
101
|
http = Net::HTTP.new(uri.host, uri.port, options[:http_proxyaddr], options[:http_proxyport])
|
102
102
|
http.use_ssl = ssl_implied?
|
103
103
|
|
104
|
-
if options[:timeout] && options[:timeout].is_a?(Integer)
|
104
|
+
if options[:timeout] && (options[:timeout].is_a?(Integer) || options[:timeout].is_a?(Float))
|
105
105
|
http.open_timeout = options[:timeout]
|
106
106
|
http.read_timeout = options[:timeout]
|
107
107
|
end
|
data/lib/httparty/response.rb
CHANGED
@@ -64,6 +64,11 @@ module HTTParty
|
|
64
64
|
klass === response
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
def respond_to?(name)
|
69
|
+
return true if [:request,:response,:parsed_response,:body,:headers].include?(name)
|
70
|
+
parsed_response.respond_to?(name) or response.respond_to?(name)
|
71
|
+
end
|
67
72
|
|
68
73
|
protected
|
69
74
|
|
data/lib/httparty/version.rb
CHANGED
@@ -54,6 +54,11 @@ describe HTTParty::Response do
|
|
54
54
|
response = HTTParty::Response.new(@request_object, @response_object, {'foo' => 'bar'})
|
55
55
|
response['foo'].should == 'bar'
|
56
56
|
end
|
57
|
+
|
58
|
+
it "should respond_to? methods it supports" do
|
59
|
+
response = HTTParty::Response.new(@request_object, @response_object, {'foo' => 'bar'})
|
60
|
+
response.respond_to?(:parsed_response).should be_true
|
61
|
+
end
|
57
62
|
|
58
63
|
it "should be able to iterate if it is array" do
|
59
64
|
response = HTTParty::Response.new(@request_object, @response_object, [{'foo' => 'bar'}, {'foo' => 'baz'}])
|
data/spec/httparty_spec.rb
CHANGED
@@ -232,6 +232,11 @@ describe HTTParty do
|
|
232
232
|
@klass.default_timeout 10
|
233
233
|
@klass.default_options[:timeout].should == 10
|
234
234
|
end
|
235
|
+
|
236
|
+
it "should support floats" do
|
237
|
+
@klass.default_timeout 0.5
|
238
|
+
@klass.default_options[:timeout].should == 0.5
|
239
|
+
end
|
235
240
|
end
|
236
241
|
|
237
242
|
describe "debug_output" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 8
|
10
|
+
version: 0.7.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Nunemaker
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable:
|
19
|
+
date: 2011-06-07 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: crack
|
@@ -193,7 +192,6 @@ files:
|
|
193
192
|
- spec/support/stub_response.rb
|
194
193
|
- website/css/common.css
|
195
194
|
- website/index.html
|
196
|
-
has_rdoc: true
|
197
195
|
homepage: http://httparty.rubyforge.org/
|
198
196
|
licenses: []
|
199
197
|
|
@@ -223,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
221
|
requirements: []
|
224
222
|
|
225
223
|
rubyforge_project:
|
226
|
-
rubygems_version: 1.
|
224
|
+
rubygems_version: 1.7.2
|
227
225
|
signing_key:
|
228
226
|
specification_version: 3
|
229
227
|
summary: Makes http fun! Also, makes consuming restful web services dead easy.
|
@@ -268,3 +266,4 @@ test_files:
|
|
268
266
|
- spec/support/ssl_test_helper.rb
|
269
267
|
- spec/support/ssl_test_server.rb
|
270
268
|
- spec/support/stub_response.rb
|
269
|
+
has_rdoc:
|