Sha256: bcc12cf620b479225ed972e2e8ae1ba670134a4b10c60feffb1a90032157bab6

Contents?: true

Size: 527 Bytes

Versions: 3

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

require 'peddler/xml_parser'

module Peddler
  # @!visibility private
  class XMLResponseParser < XMLParser
    MATCHER = /^Message$|^Node$|Report|Result/.freeze
    private_constant :MATCHER

    def next_token
      parse.fetch('NextToken', false)
    end

    private

    # FIXME: In next major version bump, stop assuming we know report internals.
    def find_data
      payload = xml.values.first
      found = payload.find { |k, _| k.match(MATCHER) }

      found&.last
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
peddler-2.4.5 lib/peddler/xml_response_parser.rb
peddler-2.4.4 lib/peddler/xml_response_parser.rb
peddler-2.4.3 lib/peddler/xml_response_parser.rb