Sha256: 08423e3558dadf8f7afdfc0432de36c2fc8644a65efd8fb65745bbea209d447a

Contents?: true

Size: 439 Bytes

Versions: 3

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

require 'peddler/xml_parser'

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

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

    private

    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.1 lib/peddler/xml_response_parser.rb
peddler-2.4.0 lib/peddler/xml_response_parser.rb
peddler-2.3.0 lib/peddler/xml_response_parser.rb