Class: RestClientWrapper::Request
- Inherits:
-
Object
- Object
- RestClientWrapper::Request
- Defined in:
- lib/rest_client_wrapper/request.rb
Overview
Request
Constant Summary collapse
- DEFAULT_CONTENT_TYPE =
default content type for post and put requests
{ content_type: :json, accept: :json }.freeze
- VALID_HTTP_METHODS =
%i[get post put patch delete connect options trace].freeze
- HTTP_METHOD_FOR_JSON =
%i[post put patch].freeze
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
-
#segment_params ⇒ Object
Returns the value of attribute segment_params.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(http_method:, uri:, segment_params: {}, payload: {}, query_params: {}, headers: {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(http_method:, uri:, segment_params: {}, payload: {}, query_params: {}, headers: {}) ⇒ Request
Returns a new instance of Request.
31 32 33 34 35 36 37 38 |
# File 'lib/rest_client_wrapper/request.rb', line 31 def initialize(http_method:, uri:, segment_params: {}, payload: {}, query_params: {}, headers: {}) @uri = uri self.headers = headers self.http_method = http_method self.segment_params = segment_params self.payload = payload self.query_params = query_params end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
24 25 26 |
# File 'lib/rest_client_wrapper/request.rb', line 24 def headers @headers end |
#http_method ⇒ Object
Returns the value of attribute http_method.
24 25 26 |
# File 'lib/rest_client_wrapper/request.rb', line 24 def http_method @http_method end |
#payload ⇒ Object
Returns the value of attribute payload.
24 25 26 |
# File 'lib/rest_client_wrapper/request.rb', line 24 def payload @payload end |
#query_params ⇒ Object
Returns the value of attribute query_params.
24 25 26 |
# File 'lib/rest_client_wrapper/request.rb', line 24 def query_params @query_params end |
#segment_params ⇒ Object
Returns the value of attribute segment_params.
24 25 26 |
# File 'lib/rest_client_wrapper/request.rb', line 24 def segment_params @segment_params end |
#uri ⇒ Object
Returns the value of attribute uri.
24 25 26 |
# File 'lib/rest_client_wrapper/request.rb', line 24 def uri @uri end |