Class: Monzo::Account
- Inherits:
-
Object
- Object
- Monzo::Account
- Defined in:
- lib/monzo/account.rb
Overview
Public: Accounts represent a store of funds, and have a list of transactions.
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.all ⇒ Object
Public: Find all Monzo Accounts.
Instance Method Summary collapse
-
#initialize(params) ⇒ Account
constructor
Public: Initialize an Account.
Constructor Details
#initialize(params) ⇒ Account
Public: Initialize an Account.
params - A Hash of account parameters.
11 12 13 14 15 |
# File 'lib/monzo/account.rb', line 11 def initialize(params) @id = params[:id] @description = params[:description] @created = params[:created] end |
Instance Attribute Details
#created ⇒ Object (readonly)
Returns the value of attribute created.
6 7 8 |
# File 'lib/monzo/account.rb', line 6 def created @created end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/monzo/account.rb', line 6 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/monzo/account.rb', line 6 def id @id end |
Class Method Details
.all ⇒ Object
Public: Find all Monzo Accounts
Returns An Array of Monzo::Account
20 21 22 23 24 25 26 27 28 |
# File 'lib/monzo/account.rb', line 20 def self.all client = Monzo.client response = client.get("/accounts") parsed_response = JSON.parse(response.body, :symbolize_names => true) parsed_response[:accounts].map do |item| Monzo::Account.new(item) end end |