Class: Adyen::API::XMLQuerier::NokogiriBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/adyen/api/xml_querier.rb

Instance Method Summary collapse

Constructor Details

#initializeNokogiriBackend

Returns a new instance of NokogiriBackend.



19
20
21
# File 'lib/adyen/api/xml_querier.rb', line 19

def initialize
  require 'nokogiri'
end

Instance Method Details

#document_for_html(html) ⇒ Object



23
24
25
# File 'lib/adyen/api/xml_querier.rb', line 23

def document_for_html(html)
  Nokogiri::HTML::Document.parse(html, nil, 'UTF-8')
end

#document_for_xml(xml) ⇒ Object



27
28
29
# File 'lib/adyen/api/xml_querier.rb', line 27

def document_for_xml(xml)
  Nokogiri::XML::Document.parse(xml)
end

#perform_xpath(query, root_node) ⇒ Object



31
32
33
# File 'lib/adyen/api/xml_querier.rb', line 31

def perform_xpath(query, root_node)
  root_node.xpath(query, NS)
end

#stringify_nodeset(nodeset) ⇒ Object



35
36
37
# File 'lib/adyen/api/xml_querier.rb', line 35

def stringify_nodeset(nodeset)
  nodeset.to_xml(encoding: 'UTF-8')
end