Class: Asdawqw::CreditCard
- Defined in:
- lib/asdawqw/models/credit_card.rb
Overview
CreditCard Model.
Instance Attribute Summary collapse
-
#credit_card_list ⇒ List of CreditCardListEnum
List of acceptable credit cards.
-
#credit_card_type ⇒ CreditCardTypeEnum
Type of payment - will payment be processed over API (in reservation request - transmit), or will payment be processed over payment gateway (post).
-
#payment_gateways ⇒ PaymentGateways
Model.
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(credit_card_type = nil, payment_gateways = nil, credit_card_list = nil) ⇒ CreditCard
constructor
A new instance of CreditCard.
Methods inherited from BaseModel
Constructor Details
#initialize(credit_card_type = nil, payment_gateways = nil, credit_card_list = nil) ⇒ CreditCard
Returns a new instance of CreditCard.
34 35 36 37 38 39 40 |
# File 'lib/asdawqw/models/credit_card.rb', line 34 def initialize(credit_card_type = nil, payment_gateways = nil, credit_card_list = nil) @credit_card_type = credit_card_type @payment_gateways = payment_gateways @credit_card_list = credit_card_list end |
Instance Attribute Details
#credit_card_list ⇒ List of CreditCardListEnum
List of acceptable credit cards. Allowed only if type is TRANSMIT. MASTER_CARD,VISA,AMERICAN_EXPRESS,DINERS_CLUB,DISCOVER. If POST method selected it will select all creditCardList.
23 24 25 |
# File 'lib/asdawqw/models/credit_card.rb', line 23 def credit_card_list @credit_card_list end |
#credit_card_type ⇒ CreditCardTypeEnum
Type of payment - will payment be processed over API (in reservation request - transmit), or will payment be processed over payment gateway (post). TRANSMIT,POST
13 14 15 |
# File 'lib/asdawqw/models/credit_card.rb', line 13 def credit_card_type @credit_card_type end |
#payment_gateways ⇒ PaymentGateways
Model. Mandatory if POST type is selected
17 18 19 |
# File 'lib/asdawqw/models/credit_card.rb', line 17 def payment_gateways @payment_gateways end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/asdawqw/models/credit_card.rb', line 43 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. credit_card_type = hash['creditCardType'] payment_gateways = PaymentGateways.from_hash(hash['paymentGateways']) if hash['paymentGateways'] credit_card_list = hash['creditCardList'] # Create object from extracted values. CreditCard.new(credit_card_type, payment_gateways, credit_card_list) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/asdawqw/models/credit_card.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['credit_card_type'] = 'creditCardType' @_hash['payment_gateways'] = 'paymentGateways' @_hash['credit_card_list'] = 'creditCardList' @_hash end |