Class: HTTPWrapper::Request
- Inherits:
-
Object
- Object
- HTTPWrapper::Request
- Defined in:
- lib/http_wrapper/request.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(url, method, headers: nil, query: nil, cookie: nil, auth: nil, body: nil, user_agent: nil, content_type: nil, multipart: nil) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(url, method, headers: nil, query: nil, cookie: nil, auth: nil, body: nil, user_agent: nil, content_type: nil, multipart: nil) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/http_wrapper/request.rb', line 7 def initialize(url, method, headers: nil, query: nil, cookie: nil, auth: nil, body: nil, user_agent: nil, content_type: nil, multipart: nil) self.uri = url @query = query || {} @headers = normalize_headers(headers) @method = HTTP_METHODS.fetch(method) @cookie = @body_data = body @multipart_data = multipart @user_agent = user_agent @content_type = content_type || default_content_type_for(method) if auth @login = auth.fetch(:login) @password = auth.fetch(:password) end initialize_headers end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
29 30 31 |
# File 'lib/http_wrapper/request.rb', line 29 def uri @uri end |
Instance Method Details
#create ⇒ Object
36 37 38 39 |
# File 'lib/http_wrapper/request.rb', line 36 def create merge_uri_query create_method_specific_request end |