lib/httparty.rb in jugend-httparty-0.5.2.2 vs lib/httparty.rb in jugend-httparty-0.5.2.3

- old
+ new

@@ -1,19 +1,21 @@ require 'pathname' require 'net/http' require 'net/https' require 'crack' -dir = Pathname.new(__FILE__).dirname.expand_path +if Crack::VERSION != "0.1.6" + warn "warning: HTTParty depends on version 0.1.6 of crack, not #{Crack::VERSION}." +end +dir = Pathname(__FILE__).dirname.expand_path + require dir + 'httparty/module_inheritable_attributes' require dir + 'httparty/cookie_hash' -require dir + 'httparty/net_digest_auth' module HTTParty VERSION = "0.5.2".freeze - CRACK_DEPENDENCY = "0.1.7".freeze module AllowedFormatsDeprecation def const_missing(const) if const.to_s =~ /AllowedFormats$/ Kernel.warn("Deprecated: Use HTTParty::Parser::SupportedFormats") @@ -69,20 +71,10 @@ # end def basic_auth(u, p) default_options[:basic_auth] = {:username => u, :password => p} end - # Allows setting digest authentication username and password. - # - # class Foo - # include HTTParty - # digest_auth 'username', 'password' - # end - def digest_auth(u, p) - default_options[:digest_auth] = {:username => u, :password => p} - end - # Allows setting default parameters to be appended to each request. # Great for api keys and such. # # class Foo # include HTTParty @@ -92,22 +84,10 @@ raise ArgumentError, 'Default params must be a hash' unless h.is_a?(Hash) default_options[:default_params] ||= {} default_options[:default_params].merge!(h) end - # Allows setting a default timeout for all HTTP calls - # Timeout is specified in seconds. - # - # class Foo - # include HTTParty - # default_timeout 10 - # end - def default_timeout(t) - raise ArgumentError, 'Timeout must be an integer' unless t && t.is_a?(Integer) - default_options[:timeout] = t - end - # Set an output stream for debugging, defaults to $stderr. # The output stream is passed on to Net::HTTP#set_debug_output. # # class Foo # include HTTParty @@ -115,11 +95,11 @@ # end def debug_output(stream = $stderr) default_options[:debug_output] = stream end - # Allows setting HTTP headers to be used for each request. + # Allows setting a base uri to be used for each request. # # class Foo # include HTTParty # headers 'Accept' => 'text/html' # end @@ -172,25 +152,10 @@ # end def no_follow(value = false) default_options[:no_follow] = value end - # Declare that you wish to maintain the chosen HTTP method across redirects. - # The default behavior is to follow redirects via the GET method. - # If you wish to maintain the original method, you can set this option to true. - # - # @example - # class Foo - # include HTTParty - # base_uri 'http://google.com' - # maintain_method_across_redirects true - # end - - def maintain_method_across_redirects(value = true) - default_options[:maintain_method_across_redirects] = value - end - # Allows setting a PEM file to be used # # class Foo # include HTTParty # pem File.read('/home/user/my.pem') @@ -335,9 +300,5 @@ require dir + 'httparty/core_extensions' require dir + 'httparty/exceptions' require dir + 'httparty/parser' require dir + 'httparty/request' require dir + 'httparty/response' - -if Crack::VERSION != HTTParty::CRACK_DEPENDENCY - warn "warning: HTTParty depends on version #{HTTParty::CRACK_DEPENDENCY} of crack, not #{Crack::VERSION}." -end