class Easycron::Error

Constants

DEFAULT_ERROR_MESSAGE

Attributes

code[R]
response[R]

Public Class Methods

new(response = nil) click to toggle source
Calls superclass method
# File lib/easycron/error.rb, line 7
def initialize(response = nil)
  @response = response

  if response.nil?
    super DEFAULT_ERROR_MESSAGE
  else
    @code = response.fetch('error', {}).fetch('code', DEFAULT_ERROR_MESSAGE)
    errmsg = response.fetch('error', {}).fetch('message', DEFAULT_ERROR_MESSAGE)
    super errmsg
  end
end