id_path_map.rb 765 B

1234567891011121314151617181920212223242526272829
  1. class Sequencer
  2. class Unit
  3. module Exchange
  4. module Folders
  5. class IdPathMap < Sequencer::Unit::Base
  6. include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder
  7. provides :ews_folder_id_path_map
  8. def process
  9. state.provide(:ews_folder_id_path_map) do
  10. ids = state.optional(:ews_folder_ids)
  11. ids ||= []
  12. ews_folder.id_folder_map.collect do |id, folder|
  13. next if ids.present? && ids.exclude?(id)
  14. next if folder.total_count.blank?
  15. next if folder.total_count.zero?
  16. [id, ews_folder.display_path(folder)]
  17. end.compact.to_h
  18. end
  19. end
  20. end
  21. end
  22. end
  23. end
  24. end