Sha256: 39c864c56694dab59cdd0ab24f4394504e57bec56ef0bd8cb337345cdb804ab6

Contents?: true

Size: 494 Bytes

Versions: 2

Compression:

Stored size: 494 Bytes

Contents

module MWS
  module Orders
    module Parser
      class Base
        attr :document

        def initialize(document)
          @document = document
        end

        private

        def at_xpath(path)
          document.at_xpath(with_namespace(path))
        end

        def xpath(path)
          document.xpath(with_namespace(path))
        end

        def with_namespace(path)
          path.split('/').map { |attr| "xmlns:#{attr}" }.join('/')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mws-orders-0.0.2 lib/mws/orders/parsers/base.rb
mws-orders-0.0.1 lib/mws/orders/parsers/base.rb