Class: Raas::NewCreditCardModel
- Defined in:
- lib/raas/models/new_credit_card_model.rb
Overview
Represents the credit card information required to register a credit card
Instance Attribute Summary collapse
-
#expiration ⇒ String
The credit card expiration date in YYYY-MM format.
-
#number ⇒ String
The credit card number.
-
#verification_number ⇒ String
The 3 or 4 digit card security code on the back of card.
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(number = nil, expiration = nil, verification_number = nil) ⇒ NewCreditCardModel
constructor
A new instance of NewCreditCardModel.
Methods inherited from BaseModel
Constructor Details
#initialize(number = nil, expiration = nil, verification_number = nil) ⇒ NewCreditCardModel
Returns a new instance of NewCreditCardModel.
28 29 30 31 32 33 34 |
# File 'lib/raas/models/new_credit_card_model.rb', line 28 def initialize(number = nil, expiration = nil, verification_number = nil) @number = number @expiration = expiration @verification_number = verification_number end |
Instance Attribute Details
#expiration ⇒ String
The credit card expiration date in YYYY-MM format
13 14 15 |
# File 'lib/raas/models/new_credit_card_model.rb', line 13 def expiration @expiration end |
#number ⇒ String
The credit card number
9 10 11 |
# File 'lib/raas/models/new_credit_card_model.rb', line 9 def number @number end |
#verification_number ⇒ String
The 3 or 4 digit card security code on the back of card
17 18 19 |
# File 'lib/raas/models/new_credit_card_model.rb', line 17 def verification_number @verification_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/raas/models/new_credit_card_model.rb', line 37 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. number = hash['number'] expiration = hash['expiration'] verification_number = hash['verificationNumber'] # Create object from extracted values. NewCreditCardModel.new(number, expiration, verification_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 25 26 |
# File 'lib/raas/models/new_credit_card_model.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['number'] = 'number' @_hash['expiration'] = 'expiration' @_hash['verification_number'] = 'verificationNumber' @_hash end |