Class: Asdawqw::Payment
- Defined in:
- lib/asdawqw/models/payment.rb
Overview
Payment Model.
Instance Attribute Summary collapse
-
#credit_card ⇒ CreditCard
Model.
-
#payment_type ⇒ PaymentTypeEnum
Type how payment will be processed.
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(payment_type = nil, credit_card = nil) ⇒ Payment
constructor
A new instance of Payment.
Methods inherited from BaseModel
Constructor Details
#initialize(payment_type = nil, credit_card = nil) ⇒ Payment
Returns a new instance of Payment.
26 27 28 29 30 |
# File 'lib/asdawqw/models/payment.rb', line 26 def initialize(payment_type = nil, credit_card = nil) @payment_type = payment_type @credit_card = credit_card end |
Instance Attribute Details
#credit_card ⇒ CreditCard
Model. Mandatory if CREDIT_CARD type is selected.
16 17 18 |
# File 'lib/asdawqw/models/payment.rb', line 16 def credit_card @credit_card end |
#payment_type ⇒ PaymentTypeEnum
Type how payment will be processed. CREDIT_CARD,MAIL_CHECK,BOOKING_PAL_MOR
12 13 14 |
# File 'lib/asdawqw/models/payment.rb', line 12 def payment_type @payment_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.rb', line 33 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payment_type = hash['paymentType'] credit_card = CreditCard.from_hash(hash['creditCard']) if hash['creditCard'] # Create object from extracted values. Payment.new(payment_type, credit_card) end |
.names ⇒ Object
A mapping from model property names to API property names.
19 20 21 22 23 24 |
# File 'lib/asdawqw/models/payment.rb', line 19 def self.names @_hash = {} if @_hash.nil? @_hash['payment_type'] = 'paymentType' @_hash['credit_card'] = 'creditCard' @_hash end |