Class: HTTParty::Request
- Inherits:
-
Object
- Object
- HTTParty::Request
- Defined in:
- lib/httparty/request.rb
Overview
:nodoc:
Constant Summary collapse
- SupportedHTTPMethods =
[Net::HTTP::Get, Net::HTTP::Post, Net::HTTP::Put, Net::HTTP::Delete]
Instance Attribute Summary collapse
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#options ⇒ Object
Returns the value of attribute options.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(http_method, path, o = {}) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(http_method, path, o = {}) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 16 |
# File 'lib/httparty/request.rb', line 9 def initialize(http_method, path, o={}) self.http_method = http_method self.path = path self. = { :limit => o.delete(:no_follow) ? 0 : 5, :default_params => {}, }.merge(o) end |
Instance Attribute Details
#http_method ⇒ Object
Returns the value of attribute http_method.
7 8 9 |
# File 'lib/httparty/request.rb', line 7 def http_method @http_method end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/httparty/request.rb', line 7 def @options end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/httparty/request.rb', line 7 def path @path end |
Instance Method Details
#format ⇒ Object
33 34 35 |
# File 'lib/httparty/request.rb', line 33 def format [:format] end |
#perform ⇒ Object
37 38 39 40 41 |
# File 'lib/httparty/request.rb', line 37 def perform validate setup_raw_request handle_response(get_response) end |
#uri ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/httparty/request.rb', line 22 def uri new_uri = path.relative? ? URI.parse("#{[:base_uri]}#{path}") : path # avoid double query string on redirects [#12] unless @redirect new_uri.query = query_string(new_uri) end new_uri end |