Exception: OJElectronics::Client::AuthenticationError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- OJElectronics::Client::AuthenticationError
- Defined in:
- lib/oj_electronics/client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error_code, message = nil) ⇒ AuthenticationError
constructor
A new instance of AuthenticationError.
Constructor Details
#initialize(error_code, message = nil) ⇒ AuthenticationError
Returns a new instance of AuthenticationError.
24 25 26 27 |
# File 'lib/oj_electronics/client.rb', line 24 def initialize(error_code, = nil) @error_code = error_code super( || "Unable to authenticate: ErrorCode #{error_code}") end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
22 23 24 |
# File 'lib/oj_electronics/client.rb', line 22 def error_code @error_code end |
Class Method Details
.create(error_code) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/oj_electronics/client.rb', line 11 def create(error_code) klass, = case error_code when 1 then [InvalidUsernameError, "Invalid Username"] when 2 then [IncorrectPasswordError, "Incorrect password"] else [self, nil] end klass.new(error_code, ) end |