Exception: TextMagic::API::Error
- Inherits:
-
StandardError
- Object
- StandardError
- TextMagic::API::Error
- Defined in:
- lib/textmagic/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Error
constructor
Creates an instance of TextMagic::API::Error.
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Error
14 15 16 17 18 19 20 21 |
# File 'lib/textmagic/error.rb', line 14 def initialize(*args) if args.first.is_a?(Hash) @code = args.first["error_code"] @message = args.first["error_message"] else @code, @message = args end end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/textmagic/error.rb', line 7 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/textmagic/error.rb', line 7 def @message end |
Instance Method Details
#to_s ⇒ Object
23 24 25 |
# File 'lib/textmagic/error.rb', line 23 def to_s "#{@message} (#{@code})" end |