class Frontapp::Error

Public Class Methods

from_response(response) click to toggle source
# File lib/frontapp/error.rb, line 3
def self.from_response(response)
  error_class = case response.status
    when 400 then BadRequestError
    when 401 then UnauthorizedError
    when 404 then NotFoundError
    when 409 then ConflictError
    when 429 then TooManyRequestsError
    else self
    end
  error_class.new(response)
end
new(response) click to toggle source
Calls superclass method
# File lib/frontapp/error.rb, line 15
def initialize(response)
  @response = response
  super("Response: #{response.inspect}\nBody: #{response.body}")
end