Sha256: 4ae27466ff8bfb19cea44f90220af10e5496eaaa7dfdad1f1195d5eeb5628c3d

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

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

      def initialize(client)
        @client = client
      end

      # Starts a new import using the supplied order collection.
      #
      # @param [Array<Workarea::Listrak::Models::OrderForm>] orders array of orders to import
      #
      # @return [String] resource id
      #
      def import(orders)
        request = Net::HTTP::Post.new("/data/v1/Order").tap do |post|
          post.body = orders.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/orders.rb
workarea-listrak-5.0.3 app/services/workarea/listrak/data_api/orders.rb
workarea-listrak-5.0.2 app/services/workarea/listrak/data_api/orders.rb
workarea-listrak-5.0.1 app/services/workarea/listrak/data_api/orders.rb