Class: Pandexio::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Request

Returns a new instance of Request.



8
9
10
11
12
13
14
# File 'lib/request.rb', line 8

def initialize(params = {})
    @method = params.fetch(:method, nil)
    @path = params.fetch(:path, nil)
    @query_parameters = params.fetch(:query_parameters, {})
    @headers = params.fetch(:headers, {})
    @payload = params.fetch(:payload, nil)
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



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

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



16
17
18
# File 'lib/request.rb', line 16

def method
  @method
end

#pathObject

Returns the value of attribute path.



17
18
19
# File 'lib/request.rb', line 17

def path
  @path
end

#payloadObject

Returns the value of attribute payload.



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

def payload
  @payload
end

#query_parametersObject

Returns the value of attribute query_parameters.



18
19
20
# File 'lib/request.rb', line 18

def query_parameters
  @query_parameters
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/request.rb', line 22

def to_s
    "#{@method} #{@path}#{LINE_BREAK}query_parameters: #{query_parameters}#{LINE_BREAK}headers: #{headers}#{LINE_BREAK}payload: #{payload}"
end