Class: BloomRemit2::Credit
- Inherits:
-
Object
- Object
- BloomRemit2::Credit
- Defined in:
- lib/bloom_remit2/credit.rb
Instance Attribute Summary collapse
-
#amount_in_php ⇒ Object
readonly
Returns the value of attribute amount_in_php.
-
#balance ⇒ Object
readonly
Returns the value of attribute balance.
-
#consumed ⇒ Object
readonly
Returns the value of attribute consumed.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
-
#item_type ⇒ Object
readonly
Returns the value of attribute item_type.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#source_amount ⇒ Object
readonly
Returns the value of attribute source_amount.
-
#source_currency ⇒ Object
readonly
Returns the value of attribute source_currency.
-
#target_amount ⇒ Object
readonly
Returns the value of attribute target_amount.
-
#target_currency ⇒ Object
readonly
Returns the value of attribute target_currency.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
-
.history ⇒ Object
Show a list of credit transactions.
Instance Method Summary collapse
-
#initialize(amount_in_php, balance, consumed, created_at, id, item_id, item_type, rate, source_amount, source_currency, target_amount, target_currency, updated_at) ⇒ Credit
constructor
A new instance of Credit.
Constructor Details
#initialize(amount_in_php, balance, consumed, created_at, id, item_id, item_type, rate, source_amount, source_currency, target_amount, target_currency, updated_at) ⇒ Credit
Returns a new instance of Credit.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/bloom_remit2/credit.rb', line 39 def initialize( amount_in_php, balance, consumed, created_at, id, item_id, item_type, rate, source_amount, source_currency, target_amount, target_currency, updated_at ) @amount_in_php = amount_in_php @balance = balance @consumed = consumed @created_at = created_at @id = id @item_id = item_id @item_type = item_type @rate = rate @source_amount = source_amount @source_currency = source_currency @target_amount = target_amount @target_currency = target_currency @updated_at = updated_at end |
Instance Attribute Details
#amount_in_php ⇒ Object (readonly)
Returns the value of attribute amount_in_php.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def amount_in_php @amount_in_php end |
#balance ⇒ Object (readonly)
Returns the value of attribute balance.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def balance @balance end |
#consumed ⇒ Object (readonly)
Returns the value of attribute consumed.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def consumed @consumed end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def id @id end |
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def item_id @item_id end |
#item_type ⇒ Object (readonly)
Returns the value of attribute item_type.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def item_type @item_type end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def rate @rate end |
#source_amount ⇒ Object (readonly)
Returns the value of attribute source_amount.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def source_amount @source_amount end |
#source_currency ⇒ Object (readonly)
Returns the value of attribute source_currency.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def source_currency @source_currency end |
#target_amount ⇒ Object (readonly)
Returns the value of attribute target_amount.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def target_amount @target_amount end |
#target_currency ⇒ Object (readonly)
Returns the value of attribute target_currency.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def target_currency @target_currency end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
37 38 39 |
# File 'lib/bloom_remit2/credit.rb', line 37 def updated_at @updated_at end |
Class Method Details
.history ⇒ Object
Show a list of credit transactions
Grabs a list of the most recent 100 credit transactions associated with this vendor account. Transactions that add to your credit will have the boolean ‘consumed’ set to ‘false’, and transactions that use up your credit (i.e., to pay for remittances) will have it set to ‘true’.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bloom_remit2/credit.rb', line 9 def history credits = Client.get("#{path}/history") credits.map do |credit| new( credit['amount_in_php'], credit['balance'], credit['consumed'], credit['created_at'], credit['id'], credit['item_id'], credit['item_type'], credit['rate'], credit['source_amount'], credit['source_currency'], credit['target_amount'], credit['target_currency'], credit['updated_at'] ) end end |