From 35abcfdce25ab66ba4f198c61bdec25541abe04b Mon Sep 17 00:00:00 2001 From: Zhou Xianhua Date: Tue, 14 Sep 2010 14:24:56 +0800 Subject: [PATCH] updated for v1.1.10 --- Changelog | 3 +++ README.rdoc | 15 ++++++++------- http_request.gemspec | 2 +- lib/http_request.rb | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Changelog b/Changelog index 4de99f0..b2f156a 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +v1.1.10 + * make it wroks on Ruby1.9.2 + v1.1.9 * re-format code with 2 spaces and fixed the version number diff --git a/README.rdoc b/README.rdoc index f746c3e..d6ef6d2 100644 --- a/README.rdoc +++ b/README.rdoc @@ -27,16 +27,17 @@ include http_request.rb first or install it "gem install http_request.rb", then require 'http_request' get - puts HttpRequest.get('http://www.github.com') + puts HttpRequest.get('http://www.github.com').body 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(: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'}) - 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?hl=en&q=ruby&start=0&sa=N').body + 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').body + 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 - 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 also support other http methods, such as put, delete, trace, options, move etc. @@ -227,4 +228,4 @@ download multiple files from a directory bug fixing, testing and testing... == LATEST VERSION - 1.1.9 + 1.1.10 diff --git a/http_request.gemspec b/http_request.gemspec index ef9fde4..428b2dc 100644 --- a/http_request.gemspec +++ b/http_request.gemspec @@ -3,7 +3,7 @@ SPEC=Gem::Specification.new do |s| s.homepage = 'http://github.com/xianhuazhou' s.rubyforge_project = "http_request.rb" s.name = 'http_request.rb' - s.version = '1.1.9' + s.version = '1.1.10' s.author = 'xianhua.zhou' s.email = 'xianhua.zhou@gmail.com' s.platform = Gem::Platform::RUBY diff --git a/lib/http_request.rb b/lib/http_request.rb index aa3c74d..02fb0e0 100755 --- a/lib/http_request.rb +++ b/lib/http_request.rb @@ -11,7 +11,7 @@ # # == Version # -# v1.1.9 +# v1.1.10 # # Last Change: 13 Sep, 2010 # @@ -32,7 +32,7 @@ class HttpRequest include Singleton class << self # version - VERSION = '1.1.9'.freeze + VERSION = '1.1.10'.freeze def version;VERSION;end # avaiabled http methods @@ -104,7 +104,7 @@ def self.method_missing(method_name, *options, &block) end @@redirect_times = 0 # 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 = {} 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)