Sha256: 14bdf3569a039c00b626cc730cda9e5076e8597f6ffc4c944d69b2b21d574f5a
Contents?: true
Size: 822 Bytes
Versions: 3
Compression:
Stored size: 822 Bytes
Contents
require "nori" class Sekken class Response def initialize(raw_response) @raw_response = raw_response end def raw @raw_response end def body hash[:envelope][:body] end alias to_hash body def header hash[:envelope][:header] end def hash @hash ||= nori.parse(raw) end def doc @doc ||= Nokogiri.XML(raw) end def xpath(path, namespaces = nil) doc.xpath(path, namespaces || xml_namespaces) end private 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sekken-0.3.0 | lib/sekken/response.rb |
sekken-0.2.0 | lib/sekken/response.rb |
sekken-0.1.0 | lib/sekken/response.rb |