Exception: Zerobounce::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Zerobounce::Error
- Defined in:
- lib/zerobounce/error.rb
Overview
The base Zerobounce error.
Direct Known Subclasses
ApiError, InternalServerError, MissingParameter, UnknownError
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Class Method Summary collapse
-
.from_response(env) ⇒ Error?
Parse the response for errors.
Instance Method Summary collapse
-
#initialize(env = {}) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(env = {}) ⇒ Error
Returns a new instance of Error.
12 13 14 15 |
# File 'lib/zerobounce/error.rb', line 12 def initialize(env={}) @env = env super(env[:body]) end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/zerobounce/error.rb', line 10 def env @env end |
Class Method Details
.from_response(env) ⇒ Error?
Parse the response for errors.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zerobounce/error.rb', line 22 def from_response(env) case env[:status] when 500 parse500(env) when 200 parse200(env) else UnknownError.new(env) end end |