Fixes #2694 - Zendesk import doesn't consider all tickets.
This commit is contained in:
parent
f1f93b773e
commit
f1eee78381
6 changed files with 35 additions and 4 deletions
|
@ -0,0 +1,20 @@
|
||||||
|
class Sequencer
|
||||||
|
class Unit
|
||||||
|
module Import
|
||||||
|
module Zendesk
|
||||||
|
module Mixin
|
||||||
|
module IncrementalExport
|
||||||
|
|
||||||
|
def self.included(base)
|
||||||
|
base.uses :client
|
||||||
|
end
|
||||||
|
|
||||||
|
def resource_collection
|
||||||
|
"::ZendeskAPI::#{resource_klass}".constantize.incremental_export(client, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,6 +3,7 @@ class Sequencer
|
||||||
module Import
|
module Import
|
||||||
module Zendesk
|
module Zendesk
|
||||||
class Organizations < Sequencer::Unit::Import::Zendesk::SubSequence::Object
|
class Organizations < Sequencer::Unit::Import::Zendesk::SubSequence::Object
|
||||||
|
include ::Sequencer::Unit::Import::Zendesk::Mixin::IncrementalExport
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Sequencer
|
||||||
|
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.extend(ClassMethods)
|
base.extend(ClassMethods)
|
||||||
|
|
||||||
base.uses :dry_run, :import_job
|
base.uses :dry_run, :import_job
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ class Sequencer
|
||||||
module Import
|
module Import
|
||||||
module Zendesk
|
module Zendesk
|
||||||
class Tickets < Sequencer::Unit::Import::Zendesk::SubSequence::Object
|
class Tickets < Sequencer::Unit::Import::Zendesk::SubSequence::Object
|
||||||
|
include ::Sequencer::Unit::Import::Zendesk::Mixin::IncrementalExport
|
||||||
|
|
||||||
uses :user_map, :organization_map, :group_map, :ticket_field_map
|
uses :user_map, :organization_map, :group_map, :ticket_field_map
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ class Sequencer
|
||||||
module Import
|
module Import
|
||||||
module Zendesk
|
module Zendesk
|
||||||
class Users < Sequencer::Unit::Import::Zendesk::SubSequence::Object
|
class Users < Sequencer::Unit::Import::Zendesk::SubSequence::Object
|
||||||
|
include ::Sequencer::Unit::Import::Zendesk::Mixin::IncrementalExport
|
||||||
|
|
||||||
uses :organization_map, :group_map, :user_group_map
|
uses :organization_map, :group_map, :user_group_map
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,13 @@ RSpec.shared_examples 'Sequencer::Unit::Import::Zendesk::SubSequence::Base' do
|
||||||
describe 'error handling' do
|
describe 'error handling' do
|
||||||
before do
|
before do
|
||||||
allow(params[:client]).to receive(collection_name).and_return(client_collection)
|
allow(params[:client]).to receive(collection_name).and_return(client_collection)
|
||||||
|
|
||||||
|
# if method 'incremental_export' is defined in class add additional receive via incremental_export
|
||||||
|
# for Users, Tickets and Organizations we are using Mixin 'IncrementalExport' to get the correct resource_collection method
|
||||||
|
if "ZendeskAPI/#{collection_name}".classify.safe_constantize.respond_to?(:incremental_export)
|
||||||
|
allow("ZendeskAPI/#{collection_name}".classify.safe_constantize).to receive(:incremental_export).and_return(client_collection)
|
||||||
|
end
|
||||||
|
|
||||||
allow(client_collection).to receive(:all!).and_raise(api_error)
|
allow(client_collection).to receive(:all!).and_raise(api_error)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue