Class: Adyen::API::XMLQuerier
- Inherits:
-
Object
- Object
- Adyen::API::XMLQuerier
- Defined in:
- lib/adyen/api.rb
Constant Summary collapse
- NS =
{ 'soap' => 'http://schemas.xmlsoap.org/soap/envelope/', 'payment' => 'http://payment.services.adyen.com', 'recurring' => 'http://recurring.services.adyen.com', 'common' => 'http://common.services.adyen.com' }
Class Attribute Summary collapse
-
.backend ⇒ Object
Returns the value of attribute backend.
Instance Method Summary collapse
- #children ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(data) ⇒ XMLQuerier
constructor
A new instance of XMLQuerier.
- #map(&block) ⇒ Object
- #text(query) ⇒ Object
- #to_s ⇒ Object
- #xpath(query) ⇒ Object
Constructor Details
#initialize(data) ⇒ XMLQuerier
Returns a new instance of XMLQuerier.
173 174 175 |
# File 'lib/adyen/api.rb', line 173 def initialize(data) @node = data.is_a?(String) ? document_for_xml(data) : data end |
Class Attribute Details
.backend ⇒ Object
Returns the value of attribute backend.
140 141 142 |
# File 'lib/adyen/api.rb', line 140 def backend @backend end |
Instance Method Details
#children ⇒ Object
186 187 188 |
# File 'lib/adyen/api.rb', line 186 def children @node.first.children end |
#empty? ⇒ Boolean
190 191 192 |
# File 'lib/adyen/api.rb', line 190 def empty? @node.empty? end |
#map(&block) ⇒ Object
198 199 200 |
# File 'lib/adyen/api.rb', line 198 def map(&block) @node.map { |n| self.class.new(n) }.map(&block) end |
#text(query) ⇒ Object
182 183 184 |
# File 'lib/adyen/api.rb', line 182 def text(query) xpath("#{query}/text()").to_s.strip end |
#to_s ⇒ Object
194 195 196 |
# File 'lib/adyen/api.rb', line 194 def to_s @node.to_s end |
#xpath(query) ⇒ Object
177 178 179 180 |
# File 'lib/adyen/api.rb', line 177 def xpath(query) result = self.class.new(perform_xpath(query)) block_given? ? yield(result) : result end |