Class: FlixCloud::Response
- Inherits:
-
Object
- Object
- FlixCloud::Response
- Defined in:
- lib/flix_cloud/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#body_as_hash ⇒ Object
Returns the value of attribute body_as_hash.
-
#code ⇒ Object
Returns the value of attribute code.
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
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
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/flix_cloud/response.rb', line 3 def body @body end |
#body_as_hash ⇒ Object
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 |
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/flix_cloud/response.rb', line 3 def code @code end |
#errors ⇒ Object
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
13 14 15 |
# File 'lib/flix_cloud/response.rb', line 13 def success? 201 == code.to_i end |