Class: CTA::API::Error
- Inherits:
-
Object
- Object
- CTA::API::Error
- Defined in:
- lib/cta_redux/api/api_response.rb
Instance Attribute Summary collapse
-
#code ⇒ Integer
readonly
Error code from the API.
-
#message ⇒ String
readonly
Detailed error message, if any, from the API.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(options = {}) ⇒ Error
Returns a new instance of Error.
10 11 12 13 |
# File 'lib/cta_redux/api/api_response.rb', line 10 def initialize( = {}) @message = [:message] || "OK" @code = [:code] ? [:code].to_i : (@message == "OK" ? 0 : 1) end |
Instance Attribute Details
#code ⇒ Integer (readonly)
Returns Error code from the API. Normalized across different CTA APIs, and 0 indicates success.
5 6 7 |
# File 'lib/cta_redux/api/api_response.rb', line 5 def code @code end |
#message ⇒ String (readonly)
Returns Detailed error message, if any, from the API.
8 9 10 |
# File 'lib/cta_redux/api/api_response.rb', line 8 def @message end |