available.rb 668 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Freshdesk::TimeEntry::Available < Sequencer::Unit::Common::Provider::Attribute
  3. extend ::Sequencer::Unit::Import::Freshdesk::Requester
  4. uses :skip_time_entries
  5. provides :time_entry_available
  6. def process
  7. return state.provide(:time_entry_available, false) if skip_time_entries
  8. state.provide(:time_entry_available, time_entry_available)
  9. end
  10. private
  11. def time_entry_available
  12. response = self.class.perform_request(
  13. api_path: 'time_entries',
  14. )
  15. response.is_a?(Net::HTTPOK)
  16. rescue => e
  17. logger.info e
  18. nil
  19. end
  20. end