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-4.15.0 lib/braintree/errors.rb
braintree-4.14.0 lib/braintree/errors.rb
braintree-4.13.0 lib/braintree/errors.rb
braintree-4.12.0 lib/braintree/errors.rb
braintree-4.11.0 lib/braintree/errors.rb
braintree-4.10.0 lib/braintree/errors.rb
braintree-4.9.0 lib/braintree/errors.rb
braintree-4.8.0 lib/braintree/errors.rb
braintree-4.7.0 lib/braintree/errors.rb
braintree-4.6.0 lib/braintree/errors.rb
braintree-4.5.0 lib/braintree/errors.rb
braintree-4.4.0 lib/braintree/errors.rb
braintree-4.3.0 lib/braintree/errors.rb
braintree-4.2.0 lib/braintree/errors.rb
braintree-4.1.0 lib/braintree/errors.rb
braintree-4.0.0 lib/braintree/errors.rb
braintree-3.4.0 lib/braintree/errors.rb
braintree-3.3.0 lib/braintree/errors.rb
braintree-3.2.0 lib/braintree/errors.rb
braintree-3.1.0 lib/braintree/errors.rb