Class: RestClientWrapper::Request

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#headersObject

Returns the value of attribute headers.



24
25
26
# File 'lib/rest_client_wrapper/request.rb', line 24

def headers
  @headers
end

#http_methodObject

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

#payloadObject

Returns the value of attribute payload.



24
25
26
# File 'lib/rest_client_wrapper/request.rb', line 24

def payload
  @payload
end

#query_paramsObject

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_paramsObject

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

#uriObject

Returns the value of attribute uri.



24
25
26
# File 'lib/rest_client_wrapper/request.rb', line 24

def uri
  @uri
end