Class: Puree::XMLExtractor::Collection
- Defined in:
- lib/puree/xml_extractor/collection.rb
Overview
Collection XML extractor.
Instance Method Summary collapse
-
#count ⇒ Fixnum
Records available in collection.
-
#get_data? ⇒ Boolean
Is there any data after get?.
-
#initialize(xml:) ⇒ Collection
constructor
A new instance of Collection.
-
#uuids ⇒ Array<String>
Resource UUIDs in collection response.
Methods inherited from Base
#xpath_query_for_multi_value, #xpath_query_for_single_value
Constructor Details
#initialize(xml:) ⇒ Collection
Returns a new instance of Collection.
9 10 11 |
# File 'lib/puree/xml_extractor/collection.rb', line 9 def initialize(xml:) super end |
Instance Method Details
#count ⇒ Fixnum
Records available in collection.
16 17 18 |
# File 'lib/puree/xml_extractor/collection.rb', line 16 def count @doc.xpath('//count').text.strip.to_i end |
#get_data? ⇒ Boolean
Is there any data after get?
32 33 34 |
# File 'lib/puree/xml_extractor/collection.rb', line 32 def get_data? count >= 1 ? true : false end |
#uuids ⇒ Array<String>
Resource UUIDs in collection response.
23 24 25 26 27 28 |
# File 'lib/puree/xml_extractor/collection.rb', line 23 def uuids arr = [] xpath_result = @doc.xpath '//renderedItem/@renderedContentUUID' xpath_result.each { |i| arr << i.text.strip } arr end |