helper.rb 715 B

12345678910111213141516171819202122232425262728293031323334353637
  1. module Import
  2. module OTRS
  3. module Helper
  4. # rubocop:disable Style/ModuleFunction
  5. extend self
  6. private
  7. def from_mapping(record)
  8. result = {}
  9. # use the mapping of the class in which
  10. # this module gets extended
  11. self.class::MAPPING.each do |key_sym, value|
  12. key = key_sym.to_s
  13. next if !record.key?(key)
  14. result[value] = record[key]
  15. end
  16. result
  17. end
  18. def active?(record)
  19. case record['ValidID'].to_s
  20. when '3'
  21. false
  22. when '2'
  23. false
  24. when '1'
  25. true
  26. when '0'
  27. false
  28. else
  29. true
  30. end
  31. end
  32. end
  33. end
  34. end