Method: JSS::Extendable#validate_popup_value
- Defined in:
- lib/jss/api_object/extendable.rb
#validate_popup_value(name, value, refresh) ⇒ Object
Used by set_ext_attr
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/jss/api_object/extendable.rb', line 252 def validate_popup_value(name, value, refresh) # all popups can take blanks return if value == JSS::BLANK # get the ea def. instance from the api cache, or the api api.ext_attr_definition_cache[self.class] ||= {} api.ext_attr_definition_cache[self.class][name] = nil if refresh api.ext_attr_definition_cache[self.class][name] ||= self.class::EXT_ATTRIB_CLASS.fetch name: name, api: api ea_def = api.ext_attr_definition_cache[self.class][name] return unless ea_def. return if ea_def.popup_choices.include? value.to_s raise JSS::UnsupportedError, "The value for #{name} must be one of: '#{ea_def.popup_choices.join("' '")}'" end |