Class: Talkbird::Result::Failure
- Inherits:
-
Object
- Object
- Talkbird::Result::Failure
- Defined in:
- lib/talkbird/result/failure.rb
Overview
Encapsulates a response from the API which should be considered a failed request.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(result) ⇒ Failure
constructor
A new instance of Failure.
- #message ⇒ Object
Constructor Details
#initialize(result) ⇒ Failure
Returns a new instance of Failure.
12 13 14 15 |
# File 'lib/talkbird/result/failure.rb', line 12 def initialize(result) @result = result @body = MultiJson.load(result.body.to_s, symbolize_keys: true) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/talkbird/result/failure.rb', line 9 def body @body end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
10 11 12 |
# File 'lib/talkbird/result/failure.rb', line 10 def result @result end |
Instance Method Details
#code ⇒ Object
17 18 19 |
# File 'lib/talkbird/result/failure.rb', line 17 def code @body[:code] end |
#message ⇒ Object
21 22 23 |
# File 'lib/talkbird/result/failure.rb', line 21 def @body[:message] end |