Class: Braintree::ValidationError
- Inherits:
 - 
      Object
      
        
- Object
 - Braintree::ValidationError
 
 
- Includes:
 - BaseModule
 
- Defined in:
 - lib/braintree/validation_error.rb
 
Instance Attribute Summary collapse
- 
  
    
      #attribute  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute attribute.
 - 
  
    
      #code  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute code.
 - 
  
    
      #message  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute message.
 
Instance Method Summary collapse
- 
  
    
      #initialize(error_hash)  ⇒ ValidationError 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ValidationError.
 - #inspect ⇒ Object
 
Methods included from BaseModule
Methods included from BaseModule::Methods
#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class
Constructor Details
#initialize(error_hash) ⇒ ValidationError
Returns a new instance of ValidationError.
      9 10 11 12 13 14 15 16 17 18 19  | 
    
      # File 'lib/braintree/validation_error.rb', line 9 def initialize(error_hash) # parse GraphQL response objects if (error_hash[:extensions] && error_hash[:extensions][:errorClass] && error_hash[:extensions][:errorClass] == "VALIDATION") error_hash[:code] = error_hash[:extensions][:legacyCode].to_i error_hash[:attribute] = error_hash[:path].last end set_instance_variables_from_hash error_hash end  | 
  
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
      5 6 7  | 
    
      # File 'lib/braintree/validation_error.rb', line 5 def attribute @attribute end  | 
  
#code ⇒ Object (readonly)
Returns the value of attribute code.
      6 7 8  | 
    
      # File 'lib/braintree/validation_error.rb', line 6 def code @code end  | 
  
#message ⇒ Object (readonly)
Returns the value of attribute message.
      7 8 9  | 
    
      # File 'lib/braintree/validation_error.rb', line 7 def @message end  | 
  
Instance Method Details
#inspect ⇒ Object
      21 22 23  | 
    
      # File 'lib/braintree/validation_error.rb', line 21 def inspect "#<#{self.class} (#{code}) #{}>" end  |