Class: Sekken::Response

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

Instance Method Summary collapse

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

#bodyObject Also known as: to_hash



14
15
16
# File 'lib/sekken/response.rb', line 14

def body
  hash[:envelope][:body]
end

#docObject



27
28
29
# File 'lib/sekken/response.rb', line 27

def doc
  @doc ||= Nokogiri.XML(raw)
end

#hashObject



23
24
25
# File 'lib/sekken/response.rb', line 23

def hash
  @hash ||= nori.parse(raw)
end

#headerObject



19
20
21
# File 'lib/sekken/response.rb', line 19

def header
  hash[:envelope][:header]
end

#rawObject



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