Class: HTTParty::Request
- Inherits:
-
Object
- Object
- HTTParty::Request
- Defined in:
- lib/httparty/request.rb
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
-
#initialize(http_method, path, options = {}) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(http_method, path, options = {}) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 12 13 14 |
# File 'lib/httparty/request.rb', line 7 def initialize(http_method, path, ={}) self.http_method = http_method self.path = path self. = { :limit => .delete(:no_follow) ? 0 : 5, :default_params => {}, }.merge(.dup) end |
Instance Attribute Details
#http_method ⇒ Object
Returns the value of attribute http_method.
5 6 7 |
# File 'lib/httparty/request.rb', line 5 def http_method @http_method end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/httparty/request.rb', line 5 def @options end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/httparty/request.rb', line 5 def path @path end |
Instance Method Details
#perform ⇒ Object
26 27 28 29 |
# File 'lib/httparty/request.rb', line 26 def perform validate! handle_response!(get_response(uri)) end |
#uri ⇒ Object
20 21 22 23 24 |
# File 'lib/httparty/request.rb', line 20 def uri uri = path.relative? ? URI.parse("#{[:base_uri]}#{path}") : path uri.query = query_string(uri) uri end |