Exception: OptaSD::Error
- Defined in:
- lib/opta_sd/error.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/opta_sd/error.rb', line 6 def initialize(response) unless response.instance_of? Hash fail ::ArgumentError, 'Response passed to OptaSD::Error must be a hash' end @error_code = response["errorCode"] @message = ErrorMessage.(@error_code.to_i) @token = response["token"] log_error end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
3 4 5 |
# File 'lib/opta_sd/error.rb', line 3 def env @env end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
4 5 6 |
# File 'lib/opta_sd/error.rb', line 4 def error_code @error_code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/opta_sd/error.rb', line 3 def @message end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/opta_sd/error.rb', line 4 def response @response end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'lib/opta_sd/error.rb', line 4 def token @token end |