select.rb 831 B

12345678910111213141516171819202122232425262728293031323334
  1. # this require is required (hehe) because of Rails autoloading
  2. # which causes strange behavior not inheriting correctly
  3. # from Import::OTRS::DynamicField
  4. require_dependency 'import/zendesk/object_attribute/base'
  5. module Import
  6. class Zendesk
  7. module ObjectAttribute
  8. class Select < Import::Zendesk::ObjectAttribute::Base
  9. def init_callback(object_attribte)
  10. @data_option.merge!(
  11. default: '',
  12. options: options(object_attribte),
  13. )
  14. end
  15. private
  16. def data_type(_attribute)
  17. 'select'
  18. end
  19. def options(object_attribte)
  20. result = {}
  21. object_attribte.custom_field_options.each do |entry|
  22. result[ entry['value'] ] = entry['name']
  23. end
  24. result
  25. end
  26. end
  27. end
  28. end
  29. end