Class: Balanced::CardHold

Inherits:
Object
  • Object
show all
Includes:
HypermediaRegistry, Resource
Defined in:
lib/balanced/resources/card_hold.rb

Overview

A Hold is a reservation of funds on a funding source such as a Card. This reservation is guaranteed until the expires_at date. You may capture the Hold at any time before then which will create a Debit and transfer the funds to your Marketplace. If you do not capture the Hold it will be marked as invalid which is represented by the is_void field being set to true.

By default a Hold is created using the most recently added funding source on the Account. You may specify a specific funding source such as a Card or BankAccount uri.

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

Dynamic Method Handling

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

Instance Method Details

#capture(options = {}) ⇒ Debit

Captures a valid Hold and returns a Debit representing the transfer of funds from the buyer’s Account to your Marketplace.

Returns:



23
24
25
26
27
28
29
# File 'lib/balanced/resources/card_hold.rb', line 23

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

#unstoreObject Also known as: delete



31
32
33
# File 'lib/balanced/resources/card_hold.rb', line 31

def unstore
  destroy
end