Class: AgentCooper::Response
- Inherits:
-
Object
- Object
- AgentCooper::Response
- Defined in:
- lib/agent_cooper/response.rb,
lib/agent_cooper/synchrony.rb
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
-
#initialize(attributes) ⇒ Response
constructor
A new instance of Response.
- #to_hash(options = {}) ⇒ Object
- #valid? ⇒ Boolean
- #xml ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/agent_cooper/response.rb', line 4 def initialize(attributes) @response = attributes.fetch(:response) end |
Instance Method Details
#body ⇒ Object
9 10 11 |
# File 'lib/agent_cooper/response.rb', line 9 def body response.body end |
#code ⇒ Object
14 15 16 |
# File 'lib/agent_cooper/response.rb', line 14 def code response.code end |
#to_hash(options = {}) ⇒ Object
19 20 21 |
# File 'lib/agent_cooper/response.rb', line 19 def to_hash( = {}) xml.to_hash() end |
#valid? ⇒ Boolean
24 25 26 |
# File 'lib/agent_cooper/response.rb', line 24 def valid? code == 200 end |
#xml ⇒ Object
29 30 31 |
# File 'lib/agent_cooper/response.rb', line 29 def xml @xml ||= Nokogiri::XML(body) end |