Class: Asdawqw::PaymentPolicy
- Defined in:
- lib/asdawqw/models/payment_policy.rb
Overview
PaymentPolicy Model.
Instance Attribute Summary collapse
-
#split_payment ⇒ SplitPayment
Model.
-
#type ⇒ PaymentPolicyTypeEnum
Full or Split payment.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(type = nil, split_payment = nil) ⇒ PaymentPolicy
constructor
A new instance of PaymentPolicy.
Methods inherited from BaseModel
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_payment ⇒ SplitPayment
Model. Required only if SPLIT type is selected.
16 17 18 |
# File 'lib/asdawqw/models/payment_policy.rb', line 16 def split_payment @split_payment end |
#type ⇒ PaymentPolicyTypeEnum
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 |
.names ⇒ Object
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 |