Class: FlixCloud::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/flix_cloud/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
10
11
# File 'lib/flix_cloud/response.rb', line 5

def initialize(response)
  self.code = response.code
  self.body = response.to_s
  self.body_as_hash = Crack::XML.parse(response.to_s)
  self.errors = []
  process_response_xml
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/flix_cloud/response.rb', line 3

def body
  @body
end

#body_as_hashObject

Returns the value of attribute body_as_hash.



3
4
5
# File 'lib/flix_cloud/response.rb', line 3

def body_as_hash
  @body_as_hash
end

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/flix_cloud/response.rb', line 3

def code
  @code
end

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/flix_cloud/response.rb', line 3

def errors
  @errors
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/flix_cloud/response.rb', line 13

def success?
  201 == code.to_i
end