Sha256: e0760a62e4ad6de0432153b03adf86392d452e7a50ad97ef5d61b1a1bc104ad9

Contents?: true

Size: 388 Bytes

Versions: 6

Compression:

Stored size: 388 Bytes

Contents

require 'delegate'
require 'multi_xml'

module Peddler
  # @api private
  class XMLParser < SimpleDelegator
    def next_token
      parse.fetch('NextToken', false)
    end

    def parse
      @result ||= find_result
    end

    def xml
      MultiXml.parse(body)
    end

    private

    def find_result
      xml.values[0].find { |k, v| k.include?('Result') }.last
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
peddler-0.7.6 lib/peddler/xml_parser.rb
peddler-0.7.5 lib/peddler/xml_parser.rb
peddler-0.7.3 lib/peddler/xml_parser.rb
peddler-0.7.2 lib/peddler/xml_parser.rb
peddler-0.7.1 lib/peddler/xml_parser.rb
peddler-0.7.0 lib/peddler/xml_parser.rb