Class: MundiApi::CreateCheckoutCardPaymentRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mundi_api/models/create_checkout_card_payment_request.rb

Overview

Checkout card payment request

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(statement_descriptor = nil, installments = nil) ⇒ CreateCheckoutCardPaymentRequest



25
26
27
28
29
# File 'lib/mundi_api/models/create_checkout_card_payment_request.rb', line 25

def initialize(statement_descriptor = nil,
               installments = nil)
  @statement_descriptor = statement_descriptor
  @installments = installments
end

Instance Attribute Details

#installmentsList of CreateCheckoutCardInstallmentOptionRequest

Payment installment options



13
14
15
# File 'lib/mundi_api/models/create_checkout_card_payment_request.rb', line 13

def installments
  @installments
end

#statement_descriptorString

Card invoice text descriptor



9
10
11
# File 'lib/mundi_api/models/create_checkout_card_payment_request.rb', line 9

def statement_descriptor
  @statement_descriptor
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/mundi_api/models/create_checkout_card_payment_request.rb', line 32

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  statement_descriptor = hash['statement_descriptor']
  # Parameter is an array, so we need to iterate through it

  installments = nil
  unless hash['installments'].nil?
    installments = []
    hash['installments'].each do |structure|
      installments << (CreateCheckoutCardInstallmentOptionRequest.from_hash(structure) if structure)
    end
  end

  # Create object from extracted values.

  CreateCheckoutCardPaymentRequest.new(statement_descriptor,
                                       installments)
end

.namesObject

A mapping from model property names to API property names.



16
17
18
19
20
21
22
23
# File 'lib/mundi_api/models/create_checkout_card_payment_request.rb', line 16

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash['statement_descriptor'] = 'statement_descriptor'
    @_hash['installments'] = 'installments'
  end
  @_hash
end