Class: AFMotion::HTTPResult
- Inherits:
-
Object
- Object
- AFMotion::HTTPResult
- Defined in:
- lib/afmotion/http_result.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#object ⇒ Object
Returns the value of attribute object.
-
#task ⇒ Object
Returns the value of attribute task.
Instance Method Summary collapse
- #body ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(task, responseObject, error) ⇒ HTTPResult
constructor
A new instance of HTTPResult.
-
#operation ⇒ Object
include this for backwards compatibility (?).
- #status_code ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(task, responseObject, error) ⇒ HTTPResult
Returns a new instance of HTTPResult.
5 6 7 8 9 |
# File 'lib/afmotion/http_result.rb', line 5 def initialize(task, responseObject, error) self.task = task self.object = responseObject self.error = error end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/afmotion/http_result.rb', line 3 def error @error end |
#object ⇒ Object
Returns the value of attribute object.
3 4 5 |
# File 'lib/afmotion/http_result.rb', line 3 def object @object end |
#task ⇒ Object
Returns the value of attribute task.
3 4 5 |
# File 'lib/afmotion/http_result.rb', line 3 def task @task end |
Instance Method Details
#body ⇒ Object
33 34 35 |
# File 'lib/afmotion/http_result.rb', line 33 def body self.object end |
#failure? ⇒ Boolean
15 16 17 |
# File 'lib/afmotion/http_result.rb', line 15 def failure? !!error end |
#operation ⇒ Object
include this for backwards compatibility (?)
20 21 22 23 |
# File 'lib/afmotion/http_result.rb', line 20 def operation puts "HTTPResult#operation is deprecated and returns a task, switch to using #task" task end |
#status_code ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/afmotion/http_result.rb', line 25 def status_code if self.task && self.task.response self.task.response.statusCode else nil end end |
#success? ⇒ Boolean
11 12 13 |
# File 'lib/afmotion/http_result.rb', line 11 def success? !failure? end |