Class: Raas::CreateCreditCardRequestModel
- Defined in:
- lib/raas/models/create_credit_card_request_model.rb
Overview
Represents the request to register a credit card
Instance Attribute Summary collapse
-
#account_identifier ⇒ String
The account identifier.
-
#billing_address ⇒ BillingAddressModel
A BillingAddress object.
-
#contact_information ⇒ List of FullNameEmailModel
An optional array of FullNameEmail objects.
-
#credit_card ⇒ NewCreditCardModel
A NewCreditCard object.
-
#customer_identifier ⇒ String
The customer identifier.
-
#ip_address ⇒ String
The IP address of the user registering the card.
-
#label ⇒ String
The credit card’s label/nickname.
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, label = nil, ip_address = nil, credit_card = nil, billing_address = nil, contact_information = nil) ⇒ CreateCreditCardRequestModel
constructor
A new instance of CreateCreditCardRequestModel.
Methods inherited from BaseModel
Constructor Details
#initialize(customer_identifier = nil, account_identifier = nil, label = nil, ip_address = nil, credit_card = nil, billing_address = nil, contact_information = nil) ⇒ CreateCreditCardRequestModel
Returns a new instance of CreateCreditCardRequestModel.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 48 def initialize(customer_identifier = nil, account_identifier = nil, label = nil, ip_address = nil, credit_card = nil, billing_address = nil, contact_information = nil) @customer_identifier = customer_identifier @account_identifier = account_identifier @label = label @ip_address = ip_address @credit_card = credit_card @billing_address = billing_address @contact_information = contact_information end |
Instance Attribute Details
#account_identifier ⇒ String
The account identifier
13 14 15 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 13 def account_identifier @account_identifier end |
#billing_address ⇒ BillingAddressModel
A BillingAddress object
29 30 31 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 29 def billing_address @billing_address end |
#contact_information ⇒ List of FullNameEmailModel
An optional array of FullNameEmail objects
33 34 35 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 33 def contact_information @contact_information end |
#credit_card ⇒ NewCreditCardModel
A NewCreditCard object
25 26 27 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 25 def credit_card @credit_card end |
#customer_identifier ⇒ String
The customer identifier
9 10 11 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 9 def customer_identifier @customer_identifier end |
#ip_address ⇒ String
The IP address of the user registering the card
21 22 23 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 21 def ip_address @ip_address end |
#label ⇒ String
The credit card’s label/nickname
17 18 19 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 17 def label @label end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. customer_identifier = hash['customerIdentifier'] account_identifier = hash['accountIdentifier'] label = hash['label'] ip_address = hash['ipAddress'] credit_card = NewCreditCardModel.from_hash(hash['creditCard']) if hash['creditCard'] billing_address = BillingAddressModel.from_hash(hash['billingAddress']) if hash['billingAddress'] # 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. CreateCreditCardRequestModel.new(customer_identifier, account_identifier, label, ip_address, credit_card, billing_address, contact_information) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/raas/models/create_credit_card_request_model.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['customer_identifier'] = 'customerIdentifier' @_hash['account_identifier'] = 'accountIdentifier' @_hash['label'] = 'label' @_hash['ip_address'] = 'ipAddress' @_hash['credit_card'] = 'creditCard' @_hash['billing_address'] = 'billingAddress' @_hash['contact_information'] = 'contactInformation' @_hash end |