Class: Asdawqw::PaymentPolicy

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/payment_policy.rb

Overview

PaymentPolicy Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(type = nil, split_payment = nil) ⇒ PaymentPolicy

Returns a new instance of PaymentPolicy.



26
27
28
29
30
# File 'lib/asdawqw/models/payment_policy.rb', line 26

def initialize(type = nil,
               split_payment = nil)
  @type = type
  @split_payment = split_payment
end

Instance Attribute Details

#split_paymentSplitPayment

Model. Required only if SPLIT type is selected.

Returns:



16
17
18
# File 'lib/asdawqw/models/payment_policy.rb', line 16

def split_payment
  @split_payment
end

#typePaymentPolicyTypeEnum

Full or Split payment. In case of Split payment - it will be 2 payments. FULL



12
13
14
# File 'lib/asdawqw/models/payment_policy.rb', line 12

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/asdawqw/models/payment_policy.rb', line 33

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  type = hash['type']
  split_payment = SplitPayment.from_hash(hash['splitPayment']) if
    hash['splitPayment']

  # Create object from extracted values.

  PaymentPolicy.new(type,
                    split_payment)
end

.namesObject

A mapping from model property names to API property names.



19
20
21
22
23
24
# File 'lib/asdawqw/models/payment_policy.rb', line 19

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['split_payment'] = 'splitPayment'
  @_hash
end