Exception: Eleyo::API::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/eleyo/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message) ⇒ Error

Returns a new instance of Error.



22
23
24
25
26
27
28
29
30
# File 'lib/eleyo/api.rb', line 22

def initialize(code, message)
  self.http_status_code = code.to_i
  begin
    self.json = JSON.parse(message)
  rescue
  end
  
  super "(#{code}) #{message}"
end

Instance Attribute Details

#http_status_codeObject

Returns the value of attribute http_status_code.



21
22
23
# File 'lib/eleyo/api.rb', line 21

def http_status_code
  @http_status_code
end