Sha256: e70450dc855dc7a08949069c4ca059eb876478d530c13ba189a9070d3735b9da

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true

module MWS
  module Orders
    # Wraps a Nokogiri node
    class Document
      attr_reader :node

      def initialize(node)
        @node = node
      end

      def xpath(path)
        node.xpath(add_namespace(path))
      end

      def at_xpath(path)
        node.at_xpath(add_namespace(path))
      end

      private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mws-orders-0.5.0 lib/mws/orders/document.rb