Class: Balanced::Card
- Inherits:
-
DebitableFundingInstrument
- Object
- FundingInstrument
- DebitableFundingInstrument
- Balanced::Card
- Includes:
- HypermediaRegistry, Resource
- Defined in:
- lib/balanced/resources/card.rb
Overview
A card represents a source of funds for an Account. You may Hold or Debit funds from the account associated with the Card.
Instance Attribute Summary
Attributes included from Resource
#attributes, #href, #hyperlinks, #id, #links
Instance Method Summary collapse
- #associate_to_customer(customer) ⇒ Object
-
#debit(options = {}) ⇒ Debit
Creates a Debit of funds from this Card to the Marketplace’s escrow account.
-
#hold(options = {}) ⇒ Hold
Creates a Hold of funds from this Card to your Marketplace.
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
#associate_to_customer(customer) ⇒ Object
30 31 32 33 |
# File 'lib/balanced/resources/card.rb', line 30 def associate_to_customer(customer) self.links['customer'] = Balanced::Utils.extract_href_from_object(customer) save end |
#debit(options = {}) ⇒ Debit
Creates a Debit of funds from this Card to the Marketplace’s escrow account.
15 16 17 18 19 |
# File 'lib/balanced/resources/card.rb', line 15 def debit(={}) [:href] = self.debits.href debit = Balanced::Debit.new() debit.save end |
#hold(options = {}) ⇒ Hold
Creates a Hold of funds from this Card to your Marketplace.
24 25 26 27 28 |
# File 'lib/balanced/resources/card.rb', line 24 def hold(={}) [:href] = self.card_holds.href hold = Balanced::CardHold.new() hold.save end |