Class: WhatsAppCloudApi::HttpRequest
- Inherits:
-
Object
- Object
- WhatsAppCloudApi::HttpRequest
- Defined in:
- lib/whats_app_cloud_api/http/http_request.rb
Overview
Represents a single Http Request.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#password ⇒ Object
Returns the value of attribute password.
-
#query_url ⇒ Object
Returns the value of attribute query_url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#add_header(name, value) ⇒ Object
Add a header to the HttpRequest.
-
#add_parameter(name, value) ⇒ Object
Add a parameter to the HttpRequest.
-
#add_query_parameter(name, value) ⇒ Object
Add a query parameter to the HttpRequest.
-
#initialize(http_method, query_url, headers: {}, parameters: {}, context: {}) ⇒ HttpRequest
constructor
The constructor.
Constructor Details
#initialize(http_method, query_url, headers: {}, parameters: {}, context: {}) ⇒ HttpRequest
The constructor.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 19 def initialize(http_method, query_url, headers: {}, parameters: {}, context: {}) @http_method = http_method @query_url = query_url @headers = headers @parameters = parameters @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def context @context end |
#headers ⇒ Object
Returns the value of attribute headers.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def headers @headers end |
#http_method ⇒ Object
Returns the value of attribute http_method.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def http_method @http_method end |
#parameters ⇒ Object
Returns the value of attribute parameters.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def parameters @parameters end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def password @password end |
#query_url ⇒ Object
Returns the value of attribute query_url.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def query_url @query_url end |
#username ⇒ Object
Returns the value of attribute username.
9 10 11 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 9 def username @username end |
Instance Method Details
#add_header(name, value) ⇒ Object
Add a header to the HttpRequest.
34 35 36 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 34 def add_header(name, value) @headers[name] = value end |
#add_parameter(name, value) ⇒ Object
Add a parameter to the HttpRequest.
41 42 43 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 41 def add_parameter(name, value) @parameters[name] = value end |
#add_query_parameter(name, value) ⇒ Object
Add a query parameter to the HttpRequest.
48 49 50 51 52 |
# File 'lib/whats_app_cloud_api/http/http_request.rb', line 48 def add_query_parameter(name, value) @query_url = APIHelper.append_url_with_query_parameters(@query_url, name => value) @query_url = APIHelper.clean_url(@query_url) end |