mapping.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer
  3. class Unit
  4. module Import
  5. module Zendesk
  6. module Ticket
  7. module Comment
  8. class Mapping < Sequencer::Unit::Base
  9. include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
  10. uses :instance, :resource, :user_id, :from, :to, :article_sender_id, :article_type_id
  11. provides :mapped
  12. def process
  13. provide_mapped do
  14. {
  15. from: from,
  16. to: to,
  17. ticket_id: instance.id,
  18. body: resource.html_body,
  19. content_type: 'text/html',
  20. internal: !resource.public,
  21. message_id: resource.id,
  22. updated_by_id: user_id,
  23. created_by_id: user_id,
  24. updated_at: resource.created_at,
  25. created_at: resource.created_at,
  26. sender_id: article_sender_id,
  27. type_id: article_type_id,
  28. }
  29. end
  30. end
  31. end
  32. end
  33. end
  34. end
  35. end
  36. end
  37. end