mapping.rb 630 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Kayako::Organization::Mapping < Sequencer::Unit::Base
  3. include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
  4. uses :resource
  5. def process
  6. provide_mapped do
  7. {
  8. name: resource['name'],
  9. domain: domain,
  10. domain_assignment: domain.present?,
  11. }
  12. end
  13. end
  14. private
  15. def domain
  16. @domain ||= begin
  17. primary_domain = resource['domains']&.detect { |item| item['is_primary'] }
  18. primary_domain&.fetch('domain')
  19. end
  20. end
  21. end