class BloomRemit2::Credit

Attributes

amount_in_php[R]
balance[R]
consumed[R]
created_at[R]
id[R]
item_id[R]
item_type[R]
rate[R]
source_amount[R]
source_currency[R]
target_amount[R]
target_currency[R]
updated_at[R]

Public Class Methods

history() click to toggle source

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'.

# 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
new( amount_in_php, balance, consumed, created_at, id, item_id, item_type, rate, source_amount, source_currency, target_amount, target_currency, updated_at ) click to toggle source
# 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

Private Class Methods

path() click to toggle source
# File lib/bloom_remit2/credit.rb, line 32
def path
  "api/v1/partners/#{BloomRemit2.configuration.api_token}/credits"
end