Class: Braintree::ValidationErrorCollection


A collection of validation errors.

  result = Braintree::Customer.create(
    :email => "invalid",
    :credit_card => {
      :number => "invalidnumber",
      :billing_address => {
        :country_name => "invalid"
      }
    }
  )
  result.success?
  #=> false
  result.errors.for(:customer).on(:email)
  #=> [#<Braintree::ValidationError (81604) Email is an invalid format.>]
  result.errors.for(:customer).for(:credit_card).on(:number)
  #=> [#<Braintree::ValidationError (81715) Credit card number is invalid.>]
  result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_name)
  #=> [#<Braintree::ValidationError (91803) Country name is not an accepted country.>]

More Information

For more detailed documentation on ValidationErrors, see www.braintreepaymentsolutions.com/gateway/validation-errors


Public Instance Methods
[](index)

Accesses the error at the given index.

deep_errors()

Returns an array of ValidationError objects at this level and all nested levels in the error hierarchy

deep_size()
each(&block)

Iterates over errors at the current level. Nested errors will not be yielded.

for(nested_key)

Returns a ValidationErrorCollection of errors nested under the given nested_key. Returns nil if there are not any errors nested under the given key.

on(attribute)

Returns an array of ValidationError objects on the given attribute.

shallow_errors()

Returns an array of ValidationError objects at the given level in the error hierarchy

size()

The number of errors at this level. This does not include nested errors.


© Copyright 2009 Braintree Payment Solutions. All Rights Reserved.