lib/embulk/input/zendesk/client.rb in embulk-input-zendesk-0.1.10 vs lib/embulk/input/zendesk/client.rb in embulk-input-zendesk-0.1.11

- old
+ new

@@ -178,9 +178,21 @@ raise Embulk::DataError.new(e) end actual_fetched = 0 records = data[key] records.each do |record| + # https://developer.zendesk.com/rest_api/docs/core/incremental_export#excluding-system-updates + # "generated_timestamp" will be updated when Zendesk internal changing + # "updated_at" will be updated when ticket data was changed + # start_time for query parameter will be processed on Zendesk with generated_timestamp, + # but it was calculated by record' updated_at time. + # So the doesn't changed record from previous import would be appear by Zendesk internal changes. + # We ignore record that has updated_at <= start_time + if start_time && record["generated_timestamp"] && record["updated_at"] + updated_at = Time.parse(record["updated_at"]) + next if updated_at <= Time.at(start_time) + end + # de-duplicated records. # https://developer.zendesk.com/rest_api/docs/core/incremental_export#usage-notes # https://github.com/zendesk/zendesk_api_client_rb/issues/251 next if known_ids.include?(record["id"])