Class: Bankscrap::Card

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Inspectable

#inspect

Constructor Details

#initialize(params = {}) ⇒ Card

Returns a new instance of Card.



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

def initialize(params = {})
  raise NotMoneyObjectError, :amount unless params[:amount].is_a?(Money)
  raise NotMoneyObjectError, :avaliable unless params[:avaliable].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/card.rb', line 5

def amount
  @amount
end

#avaliableObject

Returns the value of attribute avaliable.



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

def avaliable
  @avaliable
end

#bankObject

Returns the value of attribute bank.



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

def bank
  @bank
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#is_creditObject

Returns the value of attribute is_credit.



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

def is_credit
  @is_credit
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#panObject

Returns the value of attribute pan.



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

def pan
  @pan
end

#raw_dataObject

Returns the value of attribute raw_data.



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

def raw_data
  @raw_data
end

Instance Method Details

#currencyObject



16
17
18
# File 'lib/bankscrap/card.rb', line 16

def currency
  amount.try(:currency)
end

#to_aObject



24
25
26
# File 'lib/bankscrap/card.rb', line 24

def to_a
  [id, name, description, pan, amount, avaliable, is_credit]
end

#to_sObject



20
21
22
# File 'lib/bankscrap/card.rb', line 20

def to_s
  description
end