lib/jss/api_object/extendable.rb
# Raise an error if the named EA has a popup menu,
# but the provided value isn't one of the menu items
#
Raise an error if the named EA has a popup menu,
but the provided value isn't one of the menu items
Raise an error if the named EA has a popup menu but the provided value isn ' t one of the menu items
def validate_popup_value(ea_name, value, refresh)
      api.ext_attr_definition_cache[self.class] ||= {}
      api.ext_attr_definition_cache[self.class][ea_name] = nil if refresh
      api.ext_attr_definition_cache[self.class][ea_name] ||= self.class::EXT_ATTRIB_CLASS.fetch name: ea_name, api: api
      ea_def = api.ext_attr_definition_cache[self.class][ea_name]
      return unless ea_def.from_popup_menu?
      return if ea_def.popup_choices.include? value.to_s
      raise JSS::UnsupportedError, "The value for #{ea_name} must be one of: '#{ea_def.popup_choices.join("' '")}'"
    end
def validate_popup_value ( ea_name , value , refresh ) api . ext_attr_definition_cache [ self . class ] ||= { } api . ext_attr_definition_cache [ self . class ] [ ea_name ] = nil if refresh api . ext_attr_definition_cache [ self . class ] [ ea_name ] ||= self . class :: EXT_ATTRIB_CLASS . fetch name : ea_name , api : api ea_def = api . ext_attr_definition_cache [ self . class ] [ ea_name ] return unless ea_def . from_popup_menu? return if ea_def . popup_choices . include? value . to_s raise JSS :: UnsupportedError , "The value for #{ea_name} must be one of: '#{ea_def.popup_choices.join("' '")}'" end
Raise an error if the named EA has a popup menu,
but the provided value isn't one of the menu items
Raise an error if the named EA has a popup menu but the provided value isn ' t one of the menu items
# get the ea def. instance from the api cache, or the api
ea_name
value
refresh