Class: Bankscrap::Account
- Inherits:
-
Object
- Object
- Bankscrap::Account
- Includes:
- Utils::Inspectable
- Defined in:
- lib/bankscrap/account.rb
Instance Attribute Summary collapse
-
#available_balance ⇒ Object
Returns the value of attribute available_balance.
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#bank ⇒ Object
Returns the value of attribute bank.
-
#bic ⇒ Object
Returns the value of attribute bic.
-
#description ⇒ Object
Returns the value of attribute description.
-
#iban ⇒ Object
Returns the value of attribute iban.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#raw_data ⇒ Object
Returns the value of attribute raw_data.
-
#transactions ⇒ Object
Returns the value of attribute transactions.
Instance Method Summary collapse
- #currency ⇒ Object
- #fetch_transactions(start_date: Date.today - 2.years, end_date: Date.today) ⇒ Object
-
#initialize(params = {}) ⇒ Account
constructor
A new instance of Account.
- #to_a ⇒ Object
- #to_s ⇒ Object
Methods included from Utils::Inspectable
Constructor Details
#initialize(params = {}) ⇒ Account
Returns a new instance of Account.
10 11 12 13 14 15 |
# File 'lib/bankscrap/account.rb', line 10 def initialize(params = {}) raise NotMoneyObjectError, :balance unless params[:balance].is_a?(Money) raise NotMoneyObjectError, :available_balance unless params[:available_balance].is_a?(Money) params.each { |key, value| send "#{key}=", value } end |
Instance Attribute Details
#available_balance ⇒ Object
Returns the value of attribute available_balance.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def available_balance @available_balance end |
#balance ⇒ Object
Returns the value of attribute balance.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def balance @balance end |
#bank ⇒ Object
Returns the value of attribute bank.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def bank @bank end |
#bic ⇒ Object
Returns the value of attribute bic.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def bic @bic end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def description @description end |
#iban ⇒ Object
Returns the value of attribute iban.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def iban @iban end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def name @name end |
#raw_data ⇒ Object
Returns the value of attribute raw_data.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def raw_data @raw_data end |
#transactions ⇒ Object
Returns the value of attribute transactions.
5 6 7 |
# File 'lib/bankscrap/account.rb', line 5 def transactions @transactions end |
Instance Method Details
#currency ⇒ Object
25 26 27 |
# File 'lib/bankscrap/account.rb', line 25 def currency balance.try(:currency) end |
#fetch_transactions(start_date: Date.today - 2.years, end_date: Date.today) ⇒ Object
21 22 23 |
# File 'lib/bankscrap/account.rb', line 21 def fetch_transactions(start_date: Date.today - 2.years, end_date: Date.today) bank.fetch_transactions_for(self, start_date: start_date, end_date: end_date) end |
#to_a ⇒ Object
33 34 35 |
# File 'lib/bankscrap/account.rb', line 33 def to_a [id, iban, name, description, balance] end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/bankscrap/account.rb', line 29 def to_s description end |