Sha256: 134c5ef2892eb6c40844014118d04afe137068d7e530c07cbf7c595fce9651bf

Contents?: true

Size: 1.25 KB

Versions: 20

Compression:

Stored size: 1.25 KB

Contents

module Braintree
  # See http://www.braintreepayments.com/docs/ruby/general/result_objects
  class ErrorResult

    attr_reader :credit_card_verification, :merchant_account, :transaction, :subscription, :errors, :params, :message

    def initialize(gateway, data) # :nodoc:
      @gateway = gateway
      @params = data[:params]
      @credit_card_verification = CreditCardVerification._new(data[:verification]) if data[:verification]
      @merchant_account = MerchantAccount._new(gateway, data[:merchant_account]) if data[:merchant_account]
      @message = data[:message]
      @transaction = Transaction._new(gateway, data[:transaction]) if data[:transaction]
      @subscription = Subscription._new(gateway, data[:subscription]) if data[:subscription]
      @errors = Errors.new(data[:errors])
    end

    def inspect # :nodoc:
      if @credit_card_verification
        verification_inspect = " credit_card_verification: #{@credit_card_verification.inspect}"
      end
      if @transaction
        transaction_inspect = " transaction: #{@transaction.inspect}"
      end
      "#<#{self.class} params:{...} errors:<#{@errors._inner_inspect}>#{verification_inspect}#{transaction_inspect}>"
    end

    # Always returns false.
    def success?
      false
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
braintree-2.40.0 lib/braintree/error_result.rb
braintree-2.39.0 lib/braintree/error_result.rb
braintree-2.38.0 lib/braintree/error_result.rb
braintree-2.37.0 lib/braintree/error_result.rb
braintree-2.36.0 lib/braintree/error_result.rb
braintree-2.35.0 lib/braintree/error_result.rb
braintree-2.34.1 lib/braintree/error_result.rb
braintree-2.34.0 lib/braintree/error_result.rb
braintree-2.33.1 lib/braintree/error_result.rb
braintree-2.33.0 lib/braintree/error_result.rb
braintree-2.32.1 lib/braintree/error_result.rb
braintree-2.31.0 lib/braintree/error_result.rb
braintree-2.30.2 lib/braintree/error_result.rb
braintree-2.30.0 lib/braintree/error_result.rb
braintree-2.29.0 lib/braintree/error_result.rb
braintree-2.28.0 lib/braintree/error_result.rb
braintree-2.27.1 lib/braintree/error_result.rb
braintree-2.27.0 lib/braintree/error_result.rb
braintree-2.26.0 lib/braintree/error_result.rb
braintree-2.25.0 lib/braintree/error_result.rb