Class: Mailgun::Error
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(options = {}) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(options = {}) ⇒ Error
Returns a new instance of Error.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mailgun/mailgun_error.rb', line 5 def initialize(={}) @error = case [:code] when 200 # Not an error when 404 Mailgun::NotFound.new([:message]) when 400 Mailgun::BadRequest.new([:message]) when 401 Mailgun::Unauthorized.new([:message]) when 402 Mailgun::ResquestFailed.new([:message]) when 500, 502, 503, 504 Mailgun::ServerError.new([:message]) else Mailgun::ErrorBase.new([:message]) end end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/mailgun/mailgun_error.rb', line 3 def error @error end |
Instance Method Details
#handle ⇒ Object
25 26 27 |
# File 'lib/mailgun/mailgun_error.rb', line 25 def handle return error.handle end |