Sha256: f197e17ad23e7415c85848f9fcda86555cecc619dc1a3113ef1674036aa400ac

Contents?: true

Size: 677 Bytes

Versions: 4

Compression:

Stored size: 677 Bytes

Contents

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

      def initialize(client)
        @client = client
      end

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