Class: AdvancedBilling::PaymentMethodCreditCardType
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::PaymentMethodCreditCardType
- Defined in:
- lib/advanced_billing/models/payment_method_credit_card_type.rb
Overview
PaymentMethodCreditCardType Model.
Instance Attribute Summary collapse
-
#card_brand ⇒ String
TODO: Write general description for this method.
-
#card_expiration ⇒ String
TODO: Write general description for this method.
-
#last_four ⇒ String
TODO: Write general description for this method.
-
#masked_card_number ⇒ String
TODO: Write general description for this method.
-
#type ⇒ String
TODO: Write general description for this method.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(card_brand = SKIP, card_expiration = SKIP, last_four = SKIP, masked_card_number = SKIP, type = 'credit_card') ⇒ PaymentMethodCreditCardType
constructor
A new instance of PaymentMethodCreditCardType.
Methods inherited from BaseModel
Constructor Details
#initialize(card_brand = SKIP, card_expiration = SKIP, last_four = SKIP, masked_card_number = SKIP, type = 'credit_card') ⇒ PaymentMethodCreditCardType
Returns a new instance of PaymentMethodCreditCardType.
61 62 63 64 65 66 67 68 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 61 def initialize(card_brand = SKIP, card_expiration = SKIP, last_four = SKIP, masked_card_number = SKIP, type = 'credit_card') @card_brand = card_brand unless card_brand == SKIP @card_expiration = card_expiration unless card_expiration == SKIP @last_four = last_four unless last_four == SKIP @masked_card_number = masked_card_number unless masked_card_number == SKIP @type = type unless type == SKIP end |
Instance Attribute Details
#card_brand ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 14 def card_brand @card_brand end |
#card_expiration ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 18 def card_expiration @card_expiration end |
#last_four ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 22 def last_four @last_four end |
#masked_card_number ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 26 def masked_card_number @masked_card_number end |
#type ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 30 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. card_brand = hash.key?('card_brand') ? hash['card_brand'] : SKIP card_expiration = hash.key?('card_expiration') ? hash['card_expiration'] : SKIP last_four = hash.key?('last_four') ? hash['last_four'] : SKIP masked_card_number = hash.key?('masked_card_number') ? hash['masked_card_number'] : SKIP type = hash['type'] ||= 'credit_card' # Create object from extracted values. PaymentMethodCreditCardType.new(card_brand, card_expiration, last_four, masked_card_number, type) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['card_brand'] = 'card_brand' @_hash['card_expiration'] = 'card_expiration' @_hash['last_four'] = 'last_four' @_hash['masked_card_number'] = 'masked_card_number' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 58 59 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 55 def self.nullables %w[ last_four ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 44 def self.optionals %w[ card_brand card_expiration last_four masked_card_number type ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
93 94 95 96 97 98 99 |
# File 'lib/advanced_billing/models/payment_method_credit_card_type.rb', line 93 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |