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
.from_response(response) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/billogram/error.rb', line 10 def self.from_response(response) status = response.response.code.to_i body = response.body.to_s headers = response.headers = (response) if klass = case status when 400 then BadRequest when 401 then when 403 then Forbidden when 404 then NotFound when 500 then InternalServerError else Billogram::Error end klass.new() end end |