lib/jss/api_object/extension_attribute.rb in ruby-jss-0.10.0a3 vs lib/jss/api_object/extension_attribute.rb in ruby-jss-0.10.0

- old
+ new

@@ -97,10 +97,13 @@ DEFAULT_INPUT_TYPE = "Text Field" ### These input types can be modified, the others cannot. EDITABLE_INPUT_TYPES = ["Text Field", "Pop-up Menu"] + ### Popup choices can, for now, take empty strings + BLANK = ''.freeze + ### Where can it be displayed in the WebApp? ### subclasses can add to this list WEB_DISPLAY_CHOICES = [ "General", "Operating System", @@ -160,10 +163,12 @@ if @init_data[:input_type] @input_type = @init_data[:input_type][:type] || DEFAULT_INPUT_TYPE @popup_choices = @init_data[:input_type][:popup_choices] + # popups can always contain blank + @popup_choices << JSS::BLANK if @popup_choices else @input_type = DEFAULT_INPUT_TYPE end ### the name of the EA might have spaces and caps, which the will come to us as symbols with the spaces @@ -389,11 +394,11 @@ raise JSS::NoSuchItemError, "EA Not In JSS! Use #create to create this #{self.class::RSRC_OBJECT_KEY}." unless @in_jss tmp_advsrch = "ruby-jss-EA-latest-search-#{Time.now.to_jss_epoch}" begin search_class = self.class::TARGET_CLASS::SEARCH_CLASS - acs = search_class.new id: :new, name: tmp_advsrch, api: @api + acs = search_class.make name: tmp_advsrch, api: @api acs.display_fields = self.class::TARGET_CLASS == JSS::User ? [@name, USERNAME_FIELD] : [@name, USERNAME_FIELD, LAST_RECON_FIELD] # search for 'Username like "" ' because all searchable object classes have a "Username" value crit = JSS::Criteriable::Criterion.new(:and_or => "and", :name => "Username", :search_type => "like", :value => '') # crit = self.class::ALL_TARGETS_CRITERION @@ -414,10 +419,10 @@ results << {:id => i[:id], :name => i[:name], :username => i[USERNAME_FIELD_SYM] , :value => value, :as_of => as_of } end #acs.search_results.each ensure if defined? acs - acs.delete + acs.delete if acs else search_class.fetch(:name => tmp_advsrch, api: @api).delete if search_class.all_names(:refresh, api: @api).include? tmp_advsrch end end