Class: Bankscrap::Loan

Inherits:
Object
  • Object
show all
Includes:
Utils::Inspectable
Defined in:
lib/bankscrap/loan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Inspectable

#inspect

Constructor Details

#initialize(params = {}) ⇒ Loan

Returns a new instance of Loan.



9
10
11
12
13
# File 'lib/bankscrap/loan.rb', line 9

def initialize(params = {})
  raise NotMoneyObjectError, :amount unless params[:amount].is_a?(Money)

  params.each { |key, value| send "#{key}=", value }
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



5
6
7
# File 'lib/bankscrap/loan.rb', line 5

def amount
  @amount
end

#bankObject

Returns the value of attribute bank.



5
6
7
# File 'lib/bankscrap/loan.rb', line 5

def bank
  @bank
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/bankscrap/loan.rb', line 5

def description
  @description
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/bankscrap/loan.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/bankscrap/loan.rb', line 5

def name
  @name
end

#raw_dataObject

Returns the value of attribute raw_data.



5
6
7
# File 'lib/bankscrap/loan.rb', line 5

def raw_data
  @raw_data
end

Instance Method Details

#currencyObject



15
16
17
# File 'lib/bankscrap/loan.rb', line 15

def currency
  amount.try(:currency)
end

#to_aObject



23
24
25
# File 'lib/bankscrap/loan.rb', line 23

def to_a
  [id, name, description, amount]
end

#to_sObject



19
20
21
# File 'lib/bankscrap/loan.rb', line 19

def to_s
  description
end