Exception: Billogram::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Billogram::Error
- Defined in:
- lib/billogram/error.rb
Direct Known Subclasses
BadRequest, Forbidden, InternalServerError, NotFound, Unauthorized
Defined Under Namespace
Classes: BadRequest, Forbidden, InternalServerError, NotFound, Unauthorized
Class Method Summary collapse
Class Method Details
.error_class(response) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# 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) ⇒ Object
12 13 14 15 |
# File 'lib/billogram/error.rb', line 12 def from_response(response) = response.dig('data', 'message') error_class(response).new() end |