Class: Sekken::Response
- Inherits:
-
Object
- Object
- Sekken::Response
- Defined in:
- lib/sekken/response.rb
Instance Method Summary collapse
- #body ⇒ Object (also: #to_hash)
- #doc ⇒ Object
- #hash ⇒ Object
- #header ⇒ Object
-
#initialize(raw_response) ⇒ Response
constructor
A new instance of Response.
- #raw ⇒ Object
- #xpath(path, namespaces = nil) ⇒ Object
Constructor Details
#initialize(raw_response) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/sekken/response.rb', line 6 def initialize(raw_response) @raw_response = raw_response end |
Instance Method Details
#body ⇒ Object Also known as: to_hash
14 15 16 |
# File 'lib/sekken/response.rb', line 14 def body hash[:envelope][:body] end |
#doc ⇒ Object
27 28 29 |
# File 'lib/sekken/response.rb', line 27 def doc @doc ||= Nokogiri.XML(raw) end |
#hash ⇒ Object
23 24 25 |
# File 'lib/sekken/response.rb', line 23 def hash @hash ||= nori.parse(raw) end |
#header ⇒ Object
19 20 21 |
# File 'lib/sekken/response.rb', line 19 def header hash[:envelope][:header] end |
#raw ⇒ Object
10 11 12 |
# File 'lib/sekken/response.rb', line 10 def raw @raw_response end |
#xpath(path, namespaces = nil) ⇒ Object
31 32 33 |
# File 'lib/sekken/response.rb', line 31 def xpath(path, namespaces = nil) doc.xpath(path, namespaces || xml_namespaces) end |