class ApiWrapperFor8x8::ResponseError

Attributes

response[R]

Public Class Methods

new(response, message=nil) click to toggle source
Calls superclass method
# File lib/ApiWrapperFor8x8/error.rb, line 5
def initialize(response, message=nil)
  self.set_backtrace(caller[1..-1]) if self.backtrace.nil?
  @response = response
  super((message || @response.message))
end

Public Instance Methods

code() click to toggle source
# File lib/ApiWrapperFor8x8/error.rb, line 11
def code
  @response.code
end
common_solutions() click to toggle source
# File lib/ApiWrapperFor8x8/error.rb, line 15
def common_solutions
  if @response.code.to_i == 401
    "Check your credentials and make sure they are correct and not expired"
  elsif @response.code.to_i >= 500 && @response.code.to_i < 600
    "Check the format of your json"
  end
end
detailed_message() click to toggle source
# File lib/ApiWrapperFor8x8/error.rb, line 23
def detailed_message
  if @response.is_a? Hash
    @response[:error][:message] if @response[:error]
  end
end