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.
-
#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.
Methods included from Utils::Inspectable
Constructor Details
#initialize(params = {}) ⇒ Account
Returns a new instance of Account.
9 10 11 12 13 14 |
# File 'lib/bankscrap/account.rb', line 9 def initialize(params = {}) raise NotMoneyObjectError.new(:balance) unless params[:balance].is_a?(Money) raise NotMoneyObjectError.new(: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 |
#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
24 25 26 |
# File 'lib/bankscrap/account.rb', line 24 def currency balance.try(:currency) end |
#fetch_transactions(start_date: Date.today - 2.years, end_date: Date.today) ⇒ Object
20 21 22 |
# File 'lib/bankscrap/account.rb', line 20 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 |