Class: AFMotion::HTTPResult

Inherits:
Object
  • Object
show all
Defined in:
lib/afmotion/http_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, responseObject, error) ⇒ HTTPResult

Returns a new instance of HTTPResult.



5
6
7
8
9
# File 'lib/afmotion/http_result.rb', line 5

def initialize(operation, responseObject, error)
  self.operation = operation
  self.object = responseObject
  self.error = error
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



3
4
5
# File 'lib/afmotion/http_result.rb', line 3

def error
  @error
end

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/afmotion/http_result.rb', line 3

def object
  @object
end

#operationObject

Returns the value of attribute operation.



3
4
5
# File 'lib/afmotion/http_result.rb', line 3

def operation
  @operation
end

Instance Method Details

#bodyObject



19
20
21
22
23
# File 'lib/afmotion/http_result.rb', line 19

def body
  if operation && operation.responseString
    operation.responseString
  end
end

#failure?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/afmotion/http_result.rb', line 15

def failure?
  !!error
end

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/afmotion/http_result.rb', line 11

def success?
  !failure?
end