class EasyPing::APIError

Wrap error responded from server side

Attributes

code[R]
param[R]
status[R]
type[R]

Public Class Methods

new(response) click to toggle source
Calls superclass method
# File lib/easy_ping/error.rb, line 27
def initialize(response)
  @status  = response.status
  @error   = JSON.parse(response.body)['error'] rescue {}
  @type    = @error['type']
  @code    = @error['code']
  @param   = @error['param']
  @message = @error['message']

  message =  "Server responded with status #{@status}."
  message += " Full Message: #{@message}." if @message
  super(message)
end