Class: Raas::AccountModel
- Defined in:
- lib/raas/models/account_model.rb
Overview
Represents an Account
Instance Attribute Summary collapse
-
#account_identifier ⇒ String
An account identifier.
-
#account_number ⇒ String
An account number.
-
#contact_email ⇒ String
The contact email on file for the account.
-
#created_at ⇒ DateTime
The date the account was created.
-
#currency_code ⇒ String
The currency code for the account.
-
#current_balance ⇒ Float
The current balance of the account.
-
#display_name ⇒ String
A display name.
-
#status ⇒ String
The status of the account.
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(account_identifier = nil, account_number = nil, display_name = nil, currency_code = 'USD', current_balance = nil, created_at = nil, status = nil, contact_email = nil) ⇒ AccountModel
constructor
A new instance of AccountModel.
Methods inherited from BaseModel
Constructor Details
#initialize(account_identifier = nil, account_number = nil, display_name = nil, currency_code = 'USD', current_balance = nil, created_at = nil, status = nil, contact_email = nil) ⇒ AccountModel
Returns a new instance of AccountModel.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/raas/models/account_model.rb', line 54 def initialize(account_identifier = nil, account_number = nil, display_name = nil, currency_code = 'USD', current_balance = nil, created_at = nil, status = nil, contact_email = nil) @account_identifier = account_identifier @account_number = account_number @display_name = display_name @currency_code = currency_code @current_balance = current_balance @created_at = created_at @status = status @contact_email = contact_email end |
Instance Attribute Details
#account_identifier ⇒ String
An account identifier
10 11 12 |
# File 'lib/raas/models/account_model.rb', line 10 def account_identifier @account_identifier end |
#account_number ⇒ String
An account number
14 15 16 |
# File 'lib/raas/models/account_model.rb', line 14 def account_number @account_number end |
#contact_email ⇒ String
The contact email on file for the account
38 39 40 |
# File 'lib/raas/models/account_model.rb', line 38 def contact_email @contact_email end |
#created_at ⇒ DateTime
The date the account was created
30 31 32 |
# File 'lib/raas/models/account_model.rb', line 30 def created_at @created_at end |
#currency_code ⇒ String
The currency code for the account
22 23 24 |
# File 'lib/raas/models/account_model.rb', line 22 def currency_code @currency_code end |
#current_balance ⇒ Float
The current balance of the account
26 27 28 |
# File 'lib/raas/models/account_model.rb', line 26 def current_balance @current_balance end |
#display_name ⇒ String
A display name
18 19 20 |
# File 'lib/raas/models/account_model.rb', line 18 def display_name @display_name end |
#status ⇒ String
The status of the account
34 35 36 |
# File 'lib/raas/models/account_model.rb', line 34 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/raas/models/account_model.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_identifier = hash['accountIdentifier'] account_number = hash['accountNumber'] display_name = hash['displayName'] currency_code = hash['currencyCode'] ||= 'USD' current_balance = hash['currentBalance'] created_at = APIHelper.rfc3339(hash['createdAt']) if hash['createdAt'] status = hash['status'] contact_email = hash['contactEmail'] # Create object from extracted values. AccountModel.new(account_identifier, account_number, display_name, currency_code, current_balance, created_at, status, contact_email) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/raas/models/account_model.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['account_identifier'] = 'accountIdentifier' @_hash['account_number'] = 'accountNumber' @_hash['display_name'] = 'displayName' @_hash['currency_code'] = 'currencyCode' @_hash['current_balance'] = 'currentBalance' @_hash['created_at'] = 'createdAt' @_hash['status'] = 'status' @_hash['contact_email'] = 'contactEmail' @_hash end |