Sha256: d3e096fec053566097e07725e3827afc8b6b7f2cf56381856cd1f47fb1881fbd

Contents?: true

Size: 772 Bytes

Versions: 89

Compression:

Stored size: 772 Bytes

Contents

module Braintree
  class Errors
    include Enumerable

    def initialize(data = {}) # :nodoc:
      @errors = ValidationErrorCollection.new(data.merge(:errors => []))
    end

    def each(&block)
      @errors.deep_errors.each(&block)
    end

    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

89 entries across 89 versions & 1 rubygems

Version Path
braintree-2.86.0 lib/braintree/errors.rb
braintree-2.85.0 lib/braintree/errors.rb
braintree-2.84.0 lib/braintree/errors.rb
braintree-2.83.0 lib/braintree/errors.rb
braintree-2.82.0 lib/braintree/errors.rb
braintree-2.81.0 lib/braintree/errors.rb
braintree-2.80.1 lib/braintree/errors.rb
braintree-2.80.0 lib/braintree/errors.rb
braintree-2.79.0 lib/braintree/errors.rb
braintree-2.78.0 lib/braintree/errors.rb
braintree-2.77.0 lib/braintree/errors.rb
braintree-2.76.0 lib/braintree/errors.rb
braintree-2.75.0 lib/braintree/errors.rb
braintree-2.74.0 lib/braintree/errors.rb
braintree-2.73.0 lib/braintree/errors.rb
braintree-2.72.0 lib/braintree/errors.rb
braintree-2.71.0 lib/braintree/errors.rb
braintree-2.70.0 lib/braintree/errors.rb
braintree-2.69.1 lib/braintree/errors.rb
braintree-2.69.0 lib/braintree/errors.rb