Class: Braintree::Errors

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/braintree/errors.rb

Overview

Instance Method Summary (collapse)

Constructor Details

- (Errors) initialize(data = {})

:nodoc:



6
7
8
# File 'lib/braintree/errors.rb', line 6

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

Instance Method Details

- (Object) _inner_inspect

:nodoc:



29
30
31
# File 'lib/braintree/errors.rb', line 29

def _inner_inspect # :nodoc:
  @errors._inner_inspect
end

- (Object) each(&block)



10
11
12
# File 'lib/braintree/errors.rb', line 10

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

- (Object) for(scope)



14
15
16
# File 'lib/braintree/errors.rb', line 14

def for(scope)
  @errors.for(scope)
end

- (Object) inspect

:nodoc:



18
19
20
# File 'lib/braintree/errors.rb', line 18

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

- (Object) size

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.



25
26
27
# File 'lib/braintree/errors.rb', line 25

def size
  @errors.deep_size
end