Skip to content

Commit

Permalink
updated for v1.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou Xianhua committed Sep 14, 2010
1 parent 771141b commit 35abcfd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Changelog
@@ -1,3 +1,6 @@
v1.1.10
* make it wroks on Ruby1.9.2

v1.1.9 v1.1.9
* re-format code with 2 spaces and fixed the version number * re-format code with 2 spaces and fixed the version number


Expand Down
15 changes: 8 additions & 7 deletions README.rdoc
Expand Up @@ -27,16 +27,17 @@ include http_request.rb first
or install it "gem install http_request.rb", then require 'http_request' or install it "gem install http_request.rb", then require 'http_request'


get get
puts HttpRequest.get('http://www.github.com') puts HttpRequest.get('http://www.github.com').body


get with query string, 4 are same get with query string, 4 are same
puts HttpRequest.get('http://www.google.com/search?hl=en&q=ruby&start=0&sa=N') puts HttpRequest.get('http://www.google.com/search?hl=en&q=ruby&start=0&sa=N').body
puts HttpRequest.get(:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N') puts HttpRequest.get('http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N').body
puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N'}) puts HttpRequest.get(:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N').body
puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => {:hl => 'en', :q => 'ruby', :start => 0, :sa => 'N'}}) puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => 'hl=en&q=ruby&start=0&sa=N'}).body
puts HttpRequest.get({:url => 'http://www.google.com/search', :parameters => {:hl => 'en', :q => 'ruby', :start => 0, :sa => 'N'}}).body


post with some parameters post with some parameters
puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => 'from=http_request.rb').body puts HttpRequest.get('http://localhost/test.php', :parameters => 'from=http_request.rb').body
puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => {:name => 'Ruby', :time => 'Now'}).body puts HttpRequest.get(:url => 'http://localhost/test.php', :parameters => {:name => 'Ruby', :time => 'Now'}).body


also support other http methods, such as put, delete, trace, options, move etc. also support other http methods, such as put, delete, trace, options, move etc.
Expand Down Expand Up @@ -227,4 +228,4 @@ download multiple files from a directory
bug fixing, testing and testing... bug fixing, testing and testing...


== LATEST VERSION == LATEST VERSION
1.1.9 1.1.10
2 changes: 1 addition & 1 deletion http_request.gemspec
Expand Up @@ -3,7 +3,7 @@ SPEC=Gem::Specification.new do |s|
s.homepage = 'http://github.com/xianhuazhou' s.homepage = 'http://github.com/xianhuazhou'
s.rubyforge_project = "http_request.rb" s.rubyforge_project = "http_request.rb"
s.name = 'http_request.rb' s.name = 'http_request.rb'
s.version = '1.1.9' s.version = '1.1.10'
s.author = 'xianhua.zhou' s.author = 'xianhua.zhou'
s.email = 'xianhua.zhou@gmail.com' s.email = 'xianhua.zhou@gmail.com'
s.platform = Gem::Platform::RUBY s.platform = Gem::Platform::RUBY
Expand Down
6 changes: 3 additions & 3 deletions lib/http_request.rb
Expand Up @@ -11,7 +11,7 @@
# #
# == Version # == Version
# #
# v1.1.9 # v1.1.10
# #
# Last Change: 13 Sep, 2010 # Last Change: 13 Sep, 2010
# #
Expand All @@ -32,7 +32,7 @@ class HttpRequest
include Singleton include Singleton
class << self class << self
# version # version
VERSION = '1.1.9'.freeze VERSION = '1.1.10'.freeze
def version;VERSION;end def version;VERSION;end


# avaiabled http methods # avaiabled http methods
Expand Down Expand Up @@ -104,7 +104,7 @@ def self.method_missing(method_name, *options, &block)
end end
@@redirect_times = 0 @@redirect_times = 0
# we need to retrieve the cookies from last http response before reset cookies if it's a Net::HTTPResponse # we need to retrieve the cookies from last http response before reset cookies if it's a Net::HTTPResponse
options[:cookies] = options[:cookies].cookies if options[:cookies].is_a? Net::HTTPResponse options[:cookies] = options[:cookies].cookies if options.is_a?(Hash) and options[:cookies].is_a?(Net::HTTPResponse)
@@__cookies = {} @@__cookies = {}
method_name = method_name.to_s.downcase method_name = method_name.to_s.downcase
raise NoHttpMethodException, "No such http method can be called: #{method_name}" unless self.http_methods.include?(method_name) raise NoHttpMethodException, "No such http method can be called: #{method_name}" unless self.http_methods.include?(method_name)
Expand Down

0 comments on commit 35abcfd

Please sign in to comment.