Class: HttpClientGenerator::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/http_client_generator/request.rb

Constant Summary collapse

CONTENT_TYPES =
i[json text].freeze
DEFAULT_HEADERS_BY_CONTENT_TYPE =
{
  json: { accept: 'application/json', content_type: 'application/json' },
  text: { content_type: 'text/plain' },
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verb:, content_type:, url:, body:, rest_args:) ⇒ Request

Returns a new instance of Request.



22
23
24
25
26
27
28
29
# File 'lib/http_client_generator/request.rb', line 22

def initialize(verb:, content_type:, url:, body:, rest_args:)
  @verb = verb
  @content_type = content_type
  @url = url
  @rest_args = rest_args
  @body = body
  @headers = {}
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def body
  @body
end

#content_typeObject

Returns the value of attribute content_type.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def content_type
  @content_type
end

#headersObject

Returns the value of attribute headers.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def headers
  @headers
end

#request_idObject

Returns the value of attribute request_id.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def request_id
  @request_id
end

#response_bodyObject

Returns the value of attribute response_body.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def response_body
  @response_body
end

#urlObject

Returns the value of attribute url.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def url
  @url
end

#verbObject

Returns the value of attribute verb.



20
21
22
# File 'lib/http_client_generator/request.rb', line 20

def verb
  @verb
end