Sha256: a3031f18f120f3ab0d27e8953fe9f7665f8b6f0abe44fbab249e7e5d64e345fc

Contents?: true

Size: 669 Bytes

Versions: 4

Compression:

Stored size: 669 Bytes

Contents

module Workarea
  module Listrak
    class DataApi::Products
      attr_reader :client

      def initialize(client)
        @client = client
      end

      # Starts a new import using the supplied product collection.
      #
      # @param [Array<Workarea::Listrak::Models::ProductForm>] products array of products to import
      #
      # @return [String] resource id
      #
      def import(products)
        request = Net::HTTP::Post.new("/data/v1/Product").tap do |post|
          post.body = products.to_json
        end
        response = client.request request
        body = JSON.parse(response.body)
        body["resourceId"]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-listrak-5.0.4 app/services/workarea/listrak/data_api/products.rb
workarea-listrak-5.0.3 app/services/workarea/listrak/data_api/products.rb
workarea-listrak-5.0.2 app/services/workarea/listrak/data_api/products.rb
workarea-listrak-5.0.1 app/services/workarea/listrak/data_api/products.rb