Class: SixSaferpay::RequestHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/request_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec_version: nil, customer_id: nil, request_id: nil, retry_indicator: nil, client_info: nil) ⇒ RequestHeader

Returns a new instance of RequestHeader.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/six_saferpay/models/request_header.rb', line 10

def initialize(spec_version: nil,
               customer_id: nil,
               request_id: nil,
               retry_indicator: nil,
               client_info: nil)
  @spec_version = spec_version || SixSaferpay::API::VERSION
  @customer_id = customer_id || SixSaferpay.config.customer_id
  @request_id = request_id || SecureRandom.uuid
  @retry_indicator = retry_indicator || 0
  @client_info = SixSaferpay::ClientInfo.new(**client_info.to_h) if client_info
end

Instance Attribute Details

#client_infoObject

Returns the value of attribute client_info.



4
5
6
# File 'lib/six_saferpay/models/request_header.rb', line 4

def client_info
  @client_info
end

#customer_idObject

Returns the value of attribute customer_id.



4
5
6
# File 'lib/six_saferpay/models/request_header.rb', line 4

def customer_id
  @customer_id
end

#request_idObject

Returns the value of attribute request_id.



4
5
6
# File 'lib/six_saferpay/models/request_header.rb', line 4

def request_id
  @request_id
end

#retry_indicatorObject

Returns the value of attribute retry_indicator.



4
5
6
# File 'lib/six_saferpay/models/request_header.rb', line 4

def retry_indicator
  @retry_indicator
end

#spec_versionObject

Returns the value of attribute spec_version.



4
5
6
# File 'lib/six_saferpay/models/request_header.rb', line 4

def spec_version
  @spec_version
end

Instance Method Details

#to_hashObject Also known as: to_h



22
23
24
25
26
27
28
29
30
# File 'lib/six_saferpay/models/request_header.rb', line 22

def to_hash
  hash = Hash.new
  hash.merge!(spec_version: @spec_version) if @spec_version
  hash.merge!(customer_id: @customer_id) if @customer_id
  hash.merge!(request_id: @request_id) if @request_id
  hash.merge!(retry_indicator: @retry_indicator) if @retry_indicator
  hash.merge!(client_info: @client_info.to_h) if @client_info
  hash
end