class Sekken::Response

Public Class Methods

new(raw_response) click to toggle source
# File lib/sekken/response.rb, line 6
def initialize(raw_response)
  @raw_response = raw_response
end

Public Instance Methods

body() click to toggle source
# File lib/sekken/response.rb, line 14
def body
  hash[:envelope][:body]
end
Also aliased as: to_hash
doc() click to toggle source
# File lib/sekken/response.rb, line 27
def doc
  @doc ||= Nokogiri.XML(raw)
end
hash() click to toggle source
# File lib/sekken/response.rb, line 23
def hash
  @hash ||= nori.parse(raw)
end
header() click to toggle source
# File lib/sekken/response.rb, line 19
def header
  hash[:envelope][:header]
end
raw() click to toggle source
# File lib/sekken/response.rb, line 10
def raw
  @raw_response
end
to_hash()
Alias for: body
xpath(path, namespaces = nil) click to toggle source
# File lib/sekken/response.rb, line 31
def xpath(path, namespaces = nil)
  doc.xpath(path, namespaces || xml_namespaces)
end

Private Instance Methods

nori() click to toggle source
# File lib/sekken/response.rb, line 37
def nori
  return @nori if @nori

  nori_options = {
    strip_namespaces: true,
    convert_tags_to: lambda { |tag| tag.snakecase.to_sym }
  }

  non_nil_nori_options = nori_options.reject { |_, value| value.nil? }
  @nori = Nori.new(non_nil_nori_options)
end