class Billogram::Error
Public Class Methods
error_class(response)
click to toggle source
# File lib/billogram/error.rb, line 17 def error_class(response) case response.code.to_i when 400 then BadRequest when 401 then Unauthorized when 403 then Forbidden when 404 then NotFound when 500 then InternalServerError else Billogram::Error end end
from_response(response)
click to toggle source
# File lib/billogram/error.rb, line 12 def from_response(response) message = response.dig('data', 'message') error_class(response).new(message) end