Sha256: c990da18f31aa4482472465bf55610af60b3d1670ca166bb249c126aa10c8a2d

Contents?: true

Size: 1.24 KB

Versions: 36

Compression:

Stored size: 1.24 KB

Contents

module Braintree
  class Disbursement
    include BaseModule

    attr_reader :id, :amount, :exception_message, :disbursement_date, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success

    def initialize(gateway, attributes) # :nodoc:
      @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

    def transactions
      transactions = @gateway.transaction.search do |search|
        search.ids.in transaction_ids
      end
    end

    def inspect # :nodoc:
      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.to_s}"
      "#<#{self.class} #{nice_attributes.join(', ')}>"
    end

    class << self
      protected :new
      def _new(*args) # :nodoc:
        self.new *args
      end
    end

    def self._inspect_attributes # :nodoc:
      [:id, :exception_message, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success]
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
braintree-2.62.0 lib/braintree/disbursement.rb
braintree-2.61.1 lib/braintree/disbursement.rb
braintree-2.61.0 lib/braintree/disbursement.rb
braintree-2.60.0 lib/braintree/disbursement.rb
braintree-2.59.0 lib/braintree/disbursement.rb
braintree-2.58.0 lib/braintree/disbursement.rb
braintree-2.57.0 lib/braintree/disbursement.rb
braintree-2.56.0 lib/braintree/disbursement.rb
braintree-2.55.0 lib/braintree/disbursement.rb
braintree-2.54.0 lib/braintree/disbursement.rb
braintree-2.50.0 lib/braintree/disbursement.rb
braintree-2.49.0 lib/braintree/disbursement.rb
braintree-2.48.1 lib/braintree/disbursement.rb
braintree-2.48.0 lib/braintree/disbursement.rb
braintree-2.47.0 lib/braintree/disbursement.rb
braintree-2.46.0 lib/braintree/disbursement.rb
braintree-2.45.0 lib/braintree/disbursement.rb
braintree-2.44.0 lib/braintree/disbursement.rb
braintree-2.43.0 lib/braintree/disbursement.rb
braintree-2.42.0 lib/braintree/disbursement.rb