http_request.rb 1.1.9 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Changelog +4 -1
  2. data/README.rdoc +8 -7
  3. data/lib/http_request.rb +3 -3
  4. metadata +2 -2
data/Changelog CHANGED
@@ -1,5 +1,8 @@
1
+ v1.1.10
2
+ * make it wroks on Ruby1.9.2
3
+
1
4
  v1.1.9
2
- * fixed parameters when uploading files (it's double escaped)
5
+ * re-format code with 2 spaces and fixed the version number
3
6
 
4
7
  v1.1.8
5
8
  * fixed parameters when uploading files (it's double escaped)
data/README.rdoc CHANGED
@@ -27,16 +27,17 @@ include http_request.rb first
27
27
  or install it "gem install http_request.rb", then require 'http_request'
28
28
 
29
29
  get
30
- puts HttpRequest.get('http://www.github.com')
30
+ puts HttpRequest.get('http://www.github.com').body
31
31
 
32
32
  get with query string, 4 are same
33
- puts HttpRequest.get('http://www.google.com/search?hl=en&q=ruby&start=0&sa=N')
34
- puts HttpRequest.get(:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N')
35
- puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N'})
36
- puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => {:hl => 'en', :q => 'ruby', :start => 0, :sa => 'N'}})
33
+ puts HttpRequest.get('http://www.google.com/search?hl=en&q=ruby&start=0&sa=N').body
34
+ puts HttpRequest.get('http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N').body
35
+ puts HttpRequest.get(:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N').body
36
+ puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N'}).body
37
+ puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => {:hl => 'en', :q => 'ruby', :start => 0, :sa => 'N'}}).body
37
38
 
38
39
  post with some parameters
39
- puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => 'from=http_request.rb').body
40
+ puts HttpRequest.get('http://localhost/test.php', :parameters => 'from=http_request.rb').body
40
41
  puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => {:name => 'Ruby', :time => 'Now'}).body
41
42
 
42
43
  also support other http methods, such as put, delete, trace, options, move etc.
@@ -227,4 +228,4 @@ download multiple files from a directory
227
228
  bug fixing, testing and testing...
228
229
 
229
230
  == LATEST VERSION
230
- 1.1.9
231
+ 1.1.10
data/lib/http_request.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # == Version
13
13
  #
14
- # v1.1.9
14
+ # v1.1.10
15
15
  #
16
16
  # Last Change: 13 Sep, 2010
17
17
  #
@@ -32,7 +32,7 @@ class HttpRequest
32
32
  include Singleton
33
33
  class << self
34
34
  # version
35
- VERSION = '1.1.9'.freeze
35
+ VERSION = '1.1.10'.freeze
36
36
  def version;VERSION;end
37
37
 
38
38
  # avaiabled http methods
@@ -104,7 +104,7 @@ class HttpRequest
104
104
  end
105
105
  @@redirect_times = 0
106
106
  # we need to retrieve the cookies from last http response before reset cookies if it's a Net::HTTPResponse
107
- options[:cookies] = options[:cookies].cookies if options[:cookies].is_a? Net::HTTPResponse
107
+ options[:cookies] = options[:cookies].cookies if options.is_a?(Hash) and options[:cookies].is_a?(Net::HTTPResponse)
108
108
  @@__cookies = {}
109
109
  method_name = method_name.to_s.downcase
110
110
  raise NoHttpMethodException, "No such http method can be called: #{method_name}" unless self.http_methods.include?(method_name)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 9
9
- version: 1.1.9
8
+ - 10
9
+ version: 1.1.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - xianhua.zhou