lib/embulk/output/zendesk_users.rb in embulk-output-zendesk_users-0.0.1 vs lib/embulk/output/zendesk_users.rb in embulk-output-zendesk_users-0.0.2
- old
+ new
@@ -82,12 +82,11 @@
def close
end
def add(page)
Embulk.logger.info { "Connecting to #{@login_url}" }
- Embulk.logger.info { "Start to upload #{page.size} records" }
- if @method == "update" then
+ if @method == "update" then
# Batch Update updates up to 100 users.
page.each_slice(100).with_index do |records, index|
Embulk.logger.info { "Uploading #{records.size} records" }
update_users(records)
end
@@ -106,19 +105,19 @@
Embulk.logger.debug {"Uploading data: #{temp}"}
requests << temp
end
job_status = @client.users.update_many!(requests)
-
+
# https://github.com/zendesk/zendesk_api_client_rb#apps-api
# Note: job statuses are currently not supported, so you must manually poll the job status API for app creation.
body = {}
until %w{failed completed}.include?(job_status['status'])
response = @client.connection.get(job_status['url'])
job_status = response.body['job_status']
sleep(1)
end
-
+
job_status['results'].each do |result|
Embulk.logger.warn { "ID:#{result['id']}, Error:#{result['error']}" } unless result['success']
end
end