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 CHANGED
@@ -1,2 +1,6 @@
1
1
  source :rubygems
2
2
  gemspec
3
+
4
+ group(:development) do
5
+ gem 'rake', '~> 0.8.7'
6
+ end
data/History CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.7.8 2011-06-06
2
+ * bug fix
3
+ * Make response honor respond to
4
+ * net http timeout can also be a float
5
+
1
6
  == 0.7.7 2011-04-16
2
7
  * bug fix
3
8
  * Fix NoMethodError when using the NON_RAILS_QUERY_STRING_NORMALIZER with a hash whose key is a symbol and value is nil
@@ -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
 
@@ -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
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module HTTParty
2
- VERSION = "0.7.7".freeze
2
+ VERSION = "0.7.8".freeze
3
3
 
4
4
  CRACK_DEPENDENCY = "0.1.8".freeze
5
5
  end
@@ -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'}])
@@ -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: 13
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 7
10
- version: 0.7.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-04-20 00:00:00 -06:00
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.4.2
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: