lib/embulk/input/zendesk/client.rb in embulk-input-zendesk-0.1.1 vs lib/embulk/input/zendesk/client.rb in embulk-input-zendesk-0.1.2
- old
+ new
@@ -9,10 +9,11 @@
PARTIAL_RECORDS_SIZE = 50
AVAILABLE_TARGETS = %w(
tickets ticket_events users organizations
ticket_fields ticket_forms
).freeze
+ AVAILABLE_INCREMENTAL_EXPORT = AVAILABLE_TARGETS - %w(ticket_fields ticket_forms)
def initialize(config)
@config = config
end
@@ -93,10 +94,12 @@
end
data[key].each do |record|
block.call record
end
+
+ nil # this is necessary different with incremental_export
end
def incremental_export(path, key, start_time = 0, known_ids = [], &block)
# for `embulk run` to fetch all records.
response = request(path, start_time: start_time)
@@ -121,9 +124,11 @@
# NOTE: If count is less than 1000, then stop paginating.
# Otherwise, use the next_page URL to get the next page of results.
# https://developer.zendesk.com/rest_api/docs/core/incremental_export#pagination
if data["count"] == 1000
incremental_export(path, key, data["end_time"], known_ids, &block)
+ else
+ data
end
end
def retryer
PerfectRetry.new do |config|