remote_id.rb 785 B

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer
  3. class Unit
  4. module Import
  5. module Common
  6. module Model
  7. module Attributes
  8. class RemoteId < Sequencer::Unit::Base
  9. include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure
  10. uses :resource
  11. provides :remote_id
  12. def process
  13. state.provide(:remote_id) do
  14. resource.fetch(attribute).dup.to_s
  15. end
  16. rescue KeyError => e
  17. handle_failure(e)
  18. end
  19. private
  20. def attribute
  21. :id
  22. end
  23. end
  24. end
  25. end
  26. end
  27. end
  28. end
  29. end