Working on issue #558 - Archived Zendesk tickets won't get imported.

This commit is contained in:
Thorsten Eckel 2016-12-20 16:18:33 +01:00
parent d96d02c83f
commit 0d20c9095f

View file

@ -25,7 +25,7 @@ module Import::Zendesk
Import::Zendesk::UserFactory.import(client.users)
Import::Zendesk::TicketFieldFactory.import(client.ticket_fields)
Import::Zendesk::TicketFactory.import(client.tickets)
Import::Zendesk::TicketFactory.import(all_tickets)
# TODO
Setting.set( 'system_init_done', true )
@ -40,6 +40,22 @@ module Import::Zendesk
private
# this special ticket logic is needed since Zendesk archives tickets
# after 120 days and doesn't return them via the client.tickets
# endpoint as described here:
# https://github.com/zammad/zammad/issues/558#issuecomment-267951351
# the proper way is to use the 'incremental' endpoint which is not available
# via the ruby gem yet but a pull request is pending:
# https://github.com/zendesk/zendesk_api_client_rb/pull/287
# the following workaround is needed to use this functionality
def all_tickets
ZendeskAPI::Collection.new(
client,
ZendeskAPI::Ticket,
path: 'incremental/tickets?start_time=1'
)
end
def client
Import::Zendesk::Requester.client
end