Class: Retab::ValidationError

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/shared/validation_error.rb

Constant Summary collapse

HASH_ATTRS =
{
  loc: :loc,
  msg: :msg,
  type: :type,
  input: :input,
  ctx: :ctx
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ValidationError

Returns a new instance of ValidationError.



23
24
25
26
27
28
29
30
# File 'lib/retab/shared/validation_error.rb', line 23

def initialize(json)
  hash = self.class.normalize(json)
  @loc = (hash[:loc] || [])
  @msg = hash[:msg]
  @type = hash[:type]
  @input = hash[:input]
  @ctx = hash[:ctx] || {}
end

Instance Attribute Details

#ctxObject

Returns the value of attribute ctx.



16
17
18
# File 'lib/retab/shared/validation_error.rb', line 16

def ctx
  @ctx
end

#inputObject

Returns the value of attribute input.



16
17
18
# File 'lib/retab/shared/validation_error.rb', line 16

def input
  @input
end

#locObject

Returns the value of attribute loc.



16
17
18
# File 'lib/retab/shared/validation_error.rb', line 16

def loc
  @loc
end

#msgObject

Returns the value of attribute msg.



16
17
18
# File 'lib/retab/shared/validation_error.rb', line 16

def msg
  @msg
end

#typeObject

Returns the value of attribute type.



16
17
18
# File 'lib/retab/shared/validation_error.rb', line 16

def type
  @type
end