lib/balanced/resources/card.rb in balanced-1.0.2 vs lib/balanced/resources/card.rb in balanced-1.1.0
- old
+ new
@@ -6,17 +6,31 @@
include Balanced::Resource
include Balanced::HypermediaRegistry
define_hypermedia_types [:cards]
- # Creates a Debit of funds from this Card to the Marketplace's escrow account.
+ # Creates a Debit of funds from this Card.
#
# @param [Hash] options
# @return [Debit]
def debit(options={})
options[:href] = self.debits.href
debit = Balanced::Debit.new(options)
debit.save
+ end
+
+ # Creates a Credit of funds to this Card.
+ #
+ # @param [Hash] options
+ # @return [Credit]
+ def credit(options={})
+ if ! defined? self.credits
+ raise Balanced::FundingInstrumentNotCreditable
+ end
+
+ options[:href] = self.credits.href
+ credit = Balanced::Credit.new(options)
+ credit.save
end
# Creates a Hold of funds from this Card to your Marketplace.
#
# @return [Hold]