Class: Rubymail::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/rubymail/rubymail_error.rb', line 5 def initialize(={}) @error = case [:code] when 200 # 200 status code [success code] when 404 Rubymail::NotFound.new([:message]) when 400 Rubymail::BadRequest.new([:message]) when 401 Rubymail::Unauthorized.new([:message]) when 402 Rubymail::ResquestFailed.new([:message]) when 500, 502, 503, 504 Rubymail::ServerError.new([:message]) else Rubymail::ErrorBase.new([:message]) end end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/rubymail/rubymail_error.rb', line 3 def error @error end |
Instance Method Details
#handle ⇒ Object
25 26 27 |
# File 'lib/rubymail/rubymail_error.rb', line 25 def handle return error.handle end |