Class: Balanced::Account
- Inherits:
-
FundingInstrument
- Object
- FundingInstrument
- Balanced::Account
- Includes:
- HypermediaRegistry, Resource
- Defined in:
- lib/balanced/resources/account.rb
Overview
An Account is a way to pool funds from across multiple Orders
Instance Attribute Summary
Attributes included from Resource
#attributes, #href, #hyperlinks, #id, #links
Instance Method Summary collapse
-
#credit(options = {}) ⇒ Credit
Creates a Credit of funds from to this Account.
-
#settle(options = {}) ⇒ Credit
Creates a Settlement from to this Account.
Methods included from HypermediaRegistry
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
#credit(options = {}) ⇒ Credit
Creates a Credit of funds from to this Account.
13 14 15 16 17 |
# File 'lib/balanced/resources/account.rb', line 13 def credit( = {}) [:href] = self.credits.href credit = Balanced::Credit.new() credit.save end |
#settle(options = {}) ⇒ Credit
Creates a Settlement from to this Account.
22 23 24 25 26 27 28 29 30 |
# File 'lib/balanced/resources/account.rb', line 22 def settle( = {}) Balanced::Utils.assert_required_keys( , :required => [:funding_instrument] ) [:href] = self.settlements.href settlement = Balanced::Settlement.new() settlement.save end |