helper.rb 671 B

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