Sha256: 3b38f9552bc11f005b5786dcb710ae4ce942d49514ea427784ce48d766050fda

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

module Braintree
  # Provides access to errors from an ErrorResult.
  class Errors
    def initialize(data = {}) # :nodoc:
      @errors = ValidationErrorCollection.new(data.merge(:errors => []))
    end

    # Accesses validation errors for the given +scope+.
    def for(scope)
      @errors.for(scope)
    end

    def inspect # :nodoc:
      "#<#{self.class} #{_inner_inspect}>"
    end

    # Returns the total number of validation errors at all levels of nesting. For example,
    # if creating a customer with a credit card and a billing address, and each of the customer,
    # credit card, and billing address has 1 error, this method will return 3.
    def size
      @errors.deep_size
    end

    def _inner_inspect # :nodoc:
      @errors._inner_inspect
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
braintree-1.1.1 lib/braintree/errors.rb
braintree-1.1.0 lib/braintree/errors.rb
braintree-1.0.1 lib/braintree/errors.rb
braintree-1.0.0 lib/braintree/errors.rb