Exception: Keratin::ClientError

Inherits:
Error
  • Object
show all
Defined in:
lib/keratin/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ClientError

Returns a new instance of ClientError.



17
18
19
20
21
22
23
24
# File 'lib/keratin/client.rb', line 17

def initialize(errors)
  @errors = errors.map{|e| [e['field'], e['message']] }
    .group_by(&:first)
    .map{|k, v| [k, v.map(&:last)] }
    .to_h

  super(@errors.inspect)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



15
16
17
# File 'lib/keratin/client.rb', line 15

def errors
  @errors
end