Class: Braintree::Disbursement
- Inherits:
-
Object
- Object
- Braintree::Disbursement
- Includes:
- BaseModule
- Defined in:
- lib/braintree/disbursement.rb
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#disbursement_date ⇒ Object
readonly
Returns the value of attribute disbursement_date.
-
#disbursement_type ⇒ Object
readonly
Returns the value of attribute disbursement_type.
-
#exception_message ⇒ Object
readonly
Returns the value of attribute exception_message.
-
#follow_up_action ⇒ Object
readonly
Returns the value of attribute follow_up_action.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#merchant_account ⇒ Object
readonly
Returns the value of attribute merchant_account.
-
#retry ⇒ Object
readonly
Returns the value of attribute retry.
-
#success ⇒ Object
(also: #success?)
readonly
Returns the value of attribute success.
-
#transaction_ids ⇒ Object
readonly
Returns the value of attribute transaction_ids.
Class Method Summary collapse
Instance Method Summary collapse
- #credit? ⇒ Boolean
- #debit? ⇒ Boolean
-
#initialize(gateway, attributes) ⇒ Disbursement
constructor
A new instance of Disbursement.
- #inspect ⇒ Object
- #transactions ⇒ Object
Methods included from BaseModule
Methods included from BaseModule::Methods
#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class
Constructor Details
#initialize(gateway, attributes) ⇒ Disbursement
Returns a new instance of Disbursement.
23 24 25 26 27 28 29 |
# File 'lib/braintree/disbursement.rb', line 23 def initialize(gateway, attributes) @gateway = gateway set_instance_variables_from_hash(attributes) @amount = Util.to_big_decimal(amount) @disbursement_date = Date.parse(disbursement_date) @merchant_account = MerchantAccount._new(gateway, @merchant_account) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
10 11 12 |
# File 'lib/braintree/disbursement.rb', line 10 def amount @amount end |
#disbursement_date ⇒ Object (readonly)
Returns the value of attribute disbursement_date.
11 12 13 |
# File 'lib/braintree/disbursement.rb', line 11 def disbursement_date @disbursement_date end |
#disbursement_type ⇒ Object (readonly)
Returns the value of attribute disbursement_type.
12 13 14 |
# File 'lib/braintree/disbursement.rb', line 12 def disbursement_type @disbursement_type end |
#exception_message ⇒ Object (readonly)
Returns the value of attribute exception_message.
13 14 15 |
# File 'lib/braintree/disbursement.rb', line 13 def @exception_message end |
#follow_up_action ⇒ Object (readonly)
Returns the value of attribute follow_up_action.
14 15 16 |
# File 'lib/braintree/disbursement.rb', line 14 def follow_up_action @follow_up_action end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/braintree/disbursement.rb', line 15 def id @id end |
#merchant_account ⇒ Object (readonly)
Returns the value of attribute merchant_account.
16 17 18 |
# File 'lib/braintree/disbursement.rb', line 16 def merchant_account @merchant_account end |
#retry ⇒ Object (readonly)
Returns the value of attribute retry.
17 18 19 |
# File 'lib/braintree/disbursement.rb', line 17 def retry @retry end |
#success ⇒ Object (readonly) Also known as: success?
Returns the value of attribute success.
18 19 20 |
# File 'lib/braintree/disbursement.rb', line 18 def success @success end |
#transaction_ids ⇒ Object (readonly)
Returns the value of attribute transaction_ids.
19 20 21 |
# File 'lib/braintree/disbursement.rb', line 19 def transaction_ids @transaction_ids end |
Class Method Details
._inspect_attributes ⇒ Object
59 60 61 |
# File 'lib/braintree/disbursement.rb', line 59 def self._inspect_attributes [:id, :exception_message, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success] end |
._new(*args) ⇒ Object
54 55 56 |
# File 'lib/braintree/disbursement.rb', line 54 def _new(*args) self.new(*args) end |
Instance Method Details
#credit? ⇒ Boolean
48 49 50 |
# File 'lib/braintree/disbursement.rb', line 48 def credit? disbursement_type == Types::Credit end |
#debit? ⇒ Boolean
44 45 46 |
# File 'lib/braintree/disbursement.rb', line 44 def debit? disbursement_type == Types::Debit end |
#inspect ⇒ Object
37 38 39 40 41 42 |
# File 'lib/braintree/disbursement.rb', line 37 def inspect nice_attributes = self.class._inspect_attributes.map { |attr| "#{attr}: #{send(attr).inspect}" } nice_attributes << "amount: #{self.amount.to_s("F").inspect}" nice_attributes << "disbursement_date: #{self.disbursement_date}" "#<#{self.class} #{nice_attributes.join(', ')}>" end |
#transactions ⇒ Object
31 32 33 34 35 |
# File 'lib/braintree/disbursement.rb', line 31 def transactions @gateway.transaction.search do |search| search.ids.in transaction_ids end end |