Class: Raas::AccountModel
- Defined in:
- lib/raas/models/account_model.rb
Instance Attribute Summary collapse
-
#account_identifier ⇒ String
Account Identifier.
-
#contact_email ⇒ String
Contact Email.
-
#created_at ⇒ DateTime
Date Created.
-
#currency_code ⇒ String
Currency Code.
-
#current_balance ⇒ Float
Current Balance.
-
#display_name ⇒ String
Display Name.
-
#status ⇒ String
Status.
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, 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, display_name = nil, currency_code = 'USD', current_balance = nil, created_at = nil, status = nil, contact_email = nil) ⇒ AccountModel
Returns a new instance of AccountModel.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/raas/models/account_model.rb', line 49 def initialize(account_identifier = nil, display_name = nil, currency_code = 'USD', current_balance = nil, created_at = nil, status = nil, contact_email = nil) @account_identifier = account_identifier @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
Account Identifier
8 9 10 |
# File 'lib/raas/models/account_model.rb', line 8 def account_identifier @account_identifier end |
#contact_email ⇒ String
Contact Email
32 33 34 |
# File 'lib/raas/models/account_model.rb', line 32 def contact_email @contact_email end |
#created_at ⇒ DateTime
Date Created
24 25 26 |
# File 'lib/raas/models/account_model.rb', line 24 def created_at @created_at end |
#currency_code ⇒ String
Currency Code
16 17 18 |
# File 'lib/raas/models/account_model.rb', line 16 def currency_code @currency_code end |
#current_balance ⇒ Float
Current Balance
20 21 22 |
# File 'lib/raas/models/account_model.rb', line 20 def current_balance @current_balance end |
#display_name ⇒ String
Display Name
12 13 14 |
# File 'lib/raas/models/account_model.rb', line 12 def display_name @display_name end |
#status ⇒ String
Status
28 29 30 |
# File 'lib/raas/models/account_model.rb', line 28 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/raas/models/account_model.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash account_identifier = hash['accountIdentifier'] display_name = hash['displayName'] currency_code = hash['currencyCode'] ||= 'USD' current_balance = hash['currentBalance'] created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt'] status = hash['status'] contact_email = hash['contactEmail'] # Create object from extracted values AccountModel.new(account_identifier, display_name, currency_code, current_balance, created_at, status, contact_email) end |
.names ⇒ Object
A mapping from model property names to API property names
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/raas/models/account_model.rb', line 35 def self.names if @_hash.nil? @_hash = {} @_hash["account_identifier"] = "accountIdentifier" @_hash["display_name"] = "displayName" @_hash["currency_code"] = "currencyCode" @_hash["current_balance"] = "currentBalance" @_hash["created_at"] = "createdAt" @_hash["status"] = "status" @_hash["contact_email"] = "contactEmail" end @_hash end |