lib/jss/api_object.rb in ruby-jss-1.1.0b5 vs lib/jss/api_object.rb in ruby-jss-1.1.3
- old
+ new
@@ -584,11 +584,11 @@
def self.valid_id(identifier, refresh = false, api: JSS.api)
# refresh if needed
all(refresh, api: api) if refresh
# it its a valid id, return it
- return identifier if all_ids.include? identifier
+ return identifier if all_ids(api: api).include? identifier
keys_to_check = lookup_keys(no_aliases: true)
keys_to_check.delete :id # we've already checked :id
# downcase for speedy case-insensitivity -
@@ -827,11 +827,11 @@
if fetch_key
validate_unique_name(fetch_val) if fetch_key == :name
# does this lookup key have a fetch_rsrc_key?
fetch_rsrc_key = fetch_rsrc_key(fetch_key)
- return new fetch_rsrc: "#{self::RSRC_BASE}/#{fetch_rsrc_key}/#{fetch_val}", api: api if fetch_rsrc_key
+ return new fetch_rsrc: "#{self::RSRC_BASE}/#{fetch_rsrc_key}/#{CGI.escape fetch_val.to_s}", api: api if fetch_rsrc_key
end
# if we'ere here, we need to get the id from either the lookup key/val or
# the searchterm
if fetch_key
@@ -1114,11 +1114,11 @@
# @return [void]
#
def delete
return nil unless @in_jss
@api.delete_rsrc @rest_rsrc
- @rest_rsrc = "#{self.class::RSRC_BASE}/name/#{CGI.escape @name}"
+ @rest_rsrc = "#{self.class::RSRC_BASE}/name/#{CGI.escape @name.to_s}"
@id = nil
@in_jss = false
@need_to_update = false
:deleted
end # delete
@@ -1442,10 +1442,10 @@
# NOTE: subclasses may want to pre-populate more keys in @init_data when :id == :new
# then parse them into attributes later.
@init_data = args
@name = args[:name]
@in_jss = false
- @rest_rsrc = "#{self.class::RSRC_BASE}/name/#{CGI.escape @name}"
+ @rest_rsrc = "#{self.class::RSRC_BASE}/name/#{CGI.escape @name.to_s}"
@need_to_update = true
end
# Return a String with the XML Resource
# for submitting creation or changes to the JSS via