lib/jss/validate.rb in ruby-jss-0.10.1a2 vs lib/jss/validate.rb in ruby-jss-0.10.1

- old
+ new

@@ -73,11 +73,11 @@ # # @param val[Object] The value to check for uniqueness # # @return [Object] the validated unique value # - def self.unique_identifier(klass, identifier, val) - raise JSS::AlreadyExistsError, "A #{klass} already exists with #{identifier} '#{val}'" if klass.all.map { |i| i[identifier] }.include? val + def self.unique_identifier(klass, identifier, val, api: JSS.api) + raise JSS::AlreadyExistsError, "A #{klass} already exists with #{identifier} '#{val}'" if klass.all(:refresh, api: api).map { |i| i[identifier] }.include? val val end end # module validate