2018-01-08 15:29:34 +00:00
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Zendesk
|
|
|
|
module User
|
|
|
|
class Groups < Sequencer::Unit::Common::Provider::Named
|
|
|
|
|
|
|
|
uses :resource, :group_map, :user_group_map
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def groups
|
|
|
|
remote_ids.map { |remote_id| group_map[remote_id] }
|
|
|
|
.compact
|
|
|
|
.map { |local_id| ::Group.find(local_id) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def remote_ids
|
|
|
|
return [] if user_group_map.blank?
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2018-01-08 15:29:34 +00:00
|
|
|
user_group_map.fetch(resource.id, [])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|