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(**params) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(**params) ⇒ 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(**params) @uri = params[:uri] self.headers = (params[:headers].nil?) ? {} : params[:headers] self.http_method = params[:http_method] self.segment_params = (params[:segment_params].nil?) ? {} : params[:segment_params] self.payload = (params[:payload].nil?) ? {} : params[:payload] self.query_params = (params[:query_params].nil?) ? {} : params[:query_params] end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
25 26 27 |
# File 'lib/rest_client_wrapper/request.rb', line 25 def headers @headers end |
#http_method ⇒ Object
Returns the value of attribute http_method.
25 26 27 |
# File 'lib/rest_client_wrapper/request.rb', line 25 def http_method @http_method end |
#payload ⇒ Object
Returns the value of attribute payload.
25 26 27 |
# File 'lib/rest_client_wrapper/request.rb', line 25 def payload @payload end |
#query_params ⇒ Object
Returns the value of attribute query_params.
25 26 27 |
# File 'lib/rest_client_wrapper/request.rb', line 25 def query_params @query_params end |
#segment_params ⇒ Object
Returns the value of attribute segment_params.
25 26 27 |
# File 'lib/rest_client_wrapper/request.rb', line 25 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 |