Class: Raas::CreditCardModel
- Defined in:
- lib/raas/models/credit_card_model.rb
Overview
Represents a Credit Card
Instance Attribute Summary collapse
-
#account_identifier ⇒ String
The account identifier.
-
#activation_date ⇒ DateTime
The date the card will be available for use.
-
#contact_information ⇒ List of FullNameEmailModel
An optional array of FullNameEmail objects.
-
#created_date ⇒ DateTime
The date the card was added.
-
#customer_identifier ⇒ String
The customer identifier.
-
#expiration_date ⇒ String
The credit card’s expiration date.
-
#label ⇒ String
The label/nickname for the credit card.
-
#last_four_digits ⇒ String
The last four digits of the credit card number.
-
#status ⇒ String
The status of the credit card.
-
#token ⇒ String
The credit card token.
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(customer_identifier = nil, account_identifier = nil, token = nil, label = nil, last_four_digits = nil, expiration_date = nil, status = nil, created_date = nil, activation_date = nil, contact_information = nil) ⇒ CreditCardModel
constructor
A new instance of CreditCardModel.
Methods inherited from BaseModel
Constructor Details
#initialize(customer_identifier = nil, account_identifier = nil, token = nil, label = nil, last_four_digits = nil, expiration_date = nil, status = nil, created_date = nil, activation_date = nil, contact_information = nil) ⇒ CreditCardModel
Returns a new instance of CreditCardModel.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/raas/models/credit_card_model.rb', line 64 def initialize(customer_identifier = nil, account_identifier = nil, token = nil, label = nil, last_four_digits = nil, expiration_date = nil, status = nil, created_date = nil, activation_date = nil, contact_information = nil) @customer_identifier = customer_identifier @account_identifier = account_identifier @token = token @label = label @last_four_digits = last_four_digits @expiration_date = expiration_date @status = status @created_date = created_date @activation_date = activation_date @contact_information = contact_information end |
Instance Attribute Details
#account_identifier ⇒ String
The account identifier
14 15 16 |
# File 'lib/raas/models/credit_card_model.rb', line 14 def account_identifier @account_identifier end |
#activation_date ⇒ DateTime
The date the card will be available for use
42 43 44 |
# File 'lib/raas/models/credit_card_model.rb', line 42 def activation_date @activation_date end |
#contact_information ⇒ List of FullNameEmailModel
An optional array of FullNameEmail objects
46 47 48 |
# File 'lib/raas/models/credit_card_model.rb', line 46 def contact_information @contact_information end |
#created_date ⇒ DateTime
The date the card was added
38 39 40 |
# File 'lib/raas/models/credit_card_model.rb', line 38 def created_date @created_date end |
#customer_identifier ⇒ String
The customer identifier
10 11 12 |
# File 'lib/raas/models/credit_card_model.rb', line 10 def customer_identifier @customer_identifier end |
#expiration_date ⇒ String
The credit card’s expiration date
30 31 32 |
# File 'lib/raas/models/credit_card_model.rb', line 30 def expiration_date @expiration_date end |
#label ⇒ String
The label/nickname for the credit card
22 23 24 |
# File 'lib/raas/models/credit_card_model.rb', line 22 def label @label end |
#last_four_digits ⇒ String
The last four digits of the credit card number
26 27 28 |
# File 'lib/raas/models/credit_card_model.rb', line 26 def last_four_digits @last_four_digits end |
#status ⇒ String
The status of the credit card
34 35 36 |
# File 'lib/raas/models/credit_card_model.rb', line 34 def status @status end |
#token ⇒ String
The credit card token
18 19 20 |
# File 'lib/raas/models/credit_card_model.rb', line 18 def token @token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/raas/models/credit_card_model.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. customer_identifier = hash['customerIdentifier'] account_identifier = hash['accountIdentifier'] token = hash['token'] label = hash['label'] last_four_digits = hash['lastFourDigits'] expiration_date = hash['expirationDate'] status = hash['status'] created_date = APIHelper.rfc3339(hash['createdDate']) if hash['createdDate'] activation_date = APIHelper.rfc3339(hash['activationDate']) if hash['activationDate'] # Parameter is an array, so we need to iterate through it contact_information = nil unless hash['contactInformation'].nil? contact_information = [] hash['contactInformation'].each do |structure| contact_information << (FullNameEmailModel.from_hash(structure) if structure) end end # Create object from extracted values. CreditCardModel.new(customer_identifier, account_identifier, token, label, last_four_digits, expiration_date, status, created_date, activation_date, contact_information) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/raas/models/credit_card_model.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['customer_identifier'] = 'customerIdentifier' @_hash['account_identifier'] = 'accountIdentifier' @_hash['token'] = 'token' @_hash['label'] = 'label' @_hash['last_four_digits'] = 'lastFourDigits' @_hash['expiration_date'] = 'expirationDate' @_hash['status'] = 'status' @_hash['created_date'] = 'createdDate' @_hash['activation_date'] = 'activationDate' @_hash['contact_information'] = 'contactInformation' @_hash end |