Sha256: 9c3c259c32da9695d412d753f8e8a1c96d08111e776d519eb04a99391416aea7

Contents?: true

Size: 647 Bytes

Versions: 36

Compression:

Stored size: 647 Bytes

Contents

module Braintree
  class ValidationError
    include BaseModule

    attr_reader :attribute
    attr_reader :code
    attr_reader :message

    def initialize(error_hash)
      # parse GraphQL response objects
      if (error_hash[:extensions] &&
          error_hash[:extensions][:errorClass] &&
          error_hash[:extensions][:errorClass] == "VALIDATION")
        error_hash[:code] = error_hash[:extensions][:legacyCode].to_i
        error_hash[:attribute] = error_hash[:path].last
      end

      set_instance_variables_from_hash error_hash
    end

    def inspect # :nodoc:
      "#<#{self.class} (#{code}) #{message}>"
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
braintree-4.15.0 lib/braintree/validation_error.rb
braintree-4.14.0 lib/braintree/validation_error.rb
braintree-4.13.0 lib/braintree/validation_error.rb
braintree-4.12.0 lib/braintree/validation_error.rb
braintree-4.11.0 lib/braintree/validation_error.rb
braintree-4.10.0 lib/braintree/validation_error.rb
braintree-4.9.0 lib/braintree/validation_error.rb
braintree-4.8.0 lib/braintree/validation_error.rb
braintree-4.7.0 lib/braintree/validation_error.rb
braintree-4.6.0 lib/braintree/validation_error.rb
braintree-4.5.0 lib/braintree/validation_error.rb
braintree-4.4.0 lib/braintree/validation_error.rb
braintree-4.3.0 lib/braintree/validation_error.rb
braintree-4.2.0 lib/braintree/validation_error.rb
braintree-4.1.0 lib/braintree/validation_error.rb
braintree-4.0.0 lib/braintree/validation_error.rb
braintree-3.4.0 lib/braintree/validation_error.rb
braintree-3.3.0 lib/braintree/validation_error.rb
braintree-3.2.0 lib/braintree/validation_error.rb
braintree-3.1.0 lib/braintree/validation_error.rb