Class: ProcessOut::GatewayRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway_configuration_id, data = {}) ⇒ GatewayRequest

Returns a new instance of GatewayRequest.



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

def initialize(gateway_configuration_id, data = {})
  self.gateway_configuration_id = gateway_configuration_id
  self.method = data.fetch(:method, nil)
  self.url = data.fetch(:url, nil)
  self.headers = data.fetch(:headers, {})
  self.body = data.fetch(:body, nil)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



6
7
8
# File 'lib/processout/gateway_request.rb', line 6

def body
  @body
end

#gateway_configuration_idObject

Returns the value of attribute gateway_configuration_id.



6
7
8
# File 'lib/processout/gateway_request.rb', line 6

def gateway_configuration_id
  @gateway_configuration_id
end

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/processout/gateway_request.rb', line 6

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



6
7
8
# File 'lib/processout/gateway_request.rb', line 6

def method
  @method
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/processout/gateway_request.rb', line 6

def url
  @url
end

Instance Method Details

#to_sObject



16
17
18
19
20
21
22
23
24
# File 'lib/processout/gateway_request.rb', line 16

def to_s
  "gway_req_" + Base64.strict_encode64(JSON.generate({
    gateway_configuration_id: self.gateway_configuration_id,
    method: self.method,
    url: self.url,
    headers: self.headers,
    body: self.body
  }))
end