class Teamtailor::Error
Public Class Methods
from_response(body:, status:)
click to toggle source
# File lib/teamtailor/error.rb, line 5 def self.from_response(body:, status:) case status when 401 Teamtailor::UnauthorizedRequestError.new when 406 json_response = JSON.parse(body) Teamtailor::InvalidApiVersionError.new( json_response.dig("errors", "detail") ) when 422 json_response = JSON.parse(body) Teamtailor::UnprocessableEntityError.new( json_response.dig("errors", 0, "detail") ) end end