Class: Supreme::Response
- Inherits:
-
Object
- Object
- Supreme::Response
- Defined in:
- lib/supreme/response.rb
Overview
The base class for all response classes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Class Method Summary collapse
-
.for(response_body, klass) ⇒ Object
Return an instance of a reponse class based on the contents of the body.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(body) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(body) ⇒ Response
Returns a new instance of Response.
8 9 10 |
# File 'lib/supreme/response.rb', line 8 def initialize(body) @body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/supreme/response.rb', line 6 def body @body end |
Class Method Details
.for(response_body, klass) ⇒ Object
Return an instance of a reponse class based on the contents of the body
17 18 19 20 21 22 23 24 |
# File 'lib/supreme/response.rb', line 17 def self.for(response_body, klass) body = REXML::Document.new(response_body).root if body.elements["/response/item"] ::Supreme::Error.new(body) else klass.new(body) end end |
Instance Method Details
#error? ⇒ Boolean
12 13 14 |
# File 'lib/supreme/response.rb', line 12 def error? false end |