Class: Balanced::BankAccount

Inherits:
DebitableFundingInstrument show all
Includes:
HypermediaRegistry, Resource
Defined in:
lib/balanced/resources/bank_account.rb

Overview

A BankAccount is both a source, and a destination of, funds. You may create Debits and Credits to and from, this funding source.

NOTE: The BankAccount resource does not support creating a Hold.

Instance Attribute Summary

Attributes included from Resource

#attributes, #href, #hyperlinks, #id, #links

Instance Method Summary collapse

Methods included from HypermediaRegistry

included

Methods included from Resource

#copy_from, #does_resource_respond_to?, #fetch, #hydrate, included, #initialize, #method_missing, #reload, #respond_to?, #respond_to_missing?, #sanitize, #save, #unstore

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Balanced::Resource

Instance Method Details

#associate_to_customer(customer) ⇒ Object



38
39
40
41
# File 'lib/balanced/resources/bank_account.rb', line 38

def associate_to_customer(customer)
  self.links['customer'] = Balanced::Utils.extract_href_from_object(customer)
  save
end

#credit(options = {}) ⇒ Credit

Creates a Credit of funds from your Marketplace’s escrow account to this Account.

Returns:



26
27
28
29
30
# File 'lib/balanced/resources/bank_account.rb', line 26

def credit(options = {})
  options[:href] = self.credits.href
  credit = Balanced::Credit.new(options)
  credit.save
end

#debit(options = {}) ⇒ Debit

Creates a Debit of funds from this BankAccount to your Marketplace’s escrow account.

Returns:



16
17
18
19
20
# File 'lib/balanced/resources/bank_account.rb', line 16

def debit(options = {})
  options[:href] = self.debits.href
  debit = Balanced::Debit.new(options)
  debit.save
end

#verifyObject



32
33
34
35
36
# File 'lib/balanced/resources/bank_account.rb', line 32

def verify
  options = {:href => self..href}
  vf = BankAccountVerification.new(options)
  vf.save
end