Sha256: 0635f2f4dcf195d0d789309db80781593c9391886f98978212941e3cfaa394f9

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 Bytes

Contents

# frozen_string_literal: true

require 'peddler/xml_parser'

module Peddler
  # @api 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

2 entries across 2 versions & 1 rubygems

Version Path
peddler-2.1.1 lib/peddler/xml_response_parser.rb
peddler-2.1.0 lib/peddler/xml_response_parser.rb