Exception: HaveAPI::ValidationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/haveapi/params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, errors = {}) ⇒ ValidationError

Returns a new instance of ValidationError.



8
9
10
11
12
# File 'lib/haveapi/params.rb', line 8

def initialize(msg, errors = {})
  @message_value = msg
  super(msg)
  @errors = errors
end

Instance Attribute Details

#message_valueObject (readonly)

Returns the value of attribute message_value.



6
7
8
# File 'lib/haveapi/params.rb', line 6

def message_value
  @message_value
end

Instance Method Details

#messageObject



14
15
16
# File 'lib/haveapi/params.rb', line 14

def message
  HaveAPI.localize(@message_value)
end

#to_hashObject



22
23
24
# File 'lib/haveapi/params.rb', line 22

def to_hash
  @errors
end

#to_sObject



18
19
20
# File 'lib/haveapi/params.rb', line 18

def to_s
  message
end