lib/jss/api_object.rb
# If we're making a new object in the JSS, make sure we were given
# valid data to do so, raise exceptions otherwise.
#
# NOTE: some subclasses may do further validation.
#
# TODO: support for objects that can have duplicate names.
#
# @param args[Hash] The args passed to #initialize
#
# @return [void]
#
If we're making a new object in the JSS, make sure we were given
valid data to do so, raise exceptions otherwise.

some subclasses may do further validation.

support for objects that can have duplicate names.
If we ' re making a new object in the JSS make sure we were given valid data to do so raise exceptions otherwise . some subclasses may do further validation . support for objects that can have duplicate names .
def validate_init_for_creation(args)
      raise JSS::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows." unless creatable?
      raise JSS::MissingDataError, "You must provide a :name to create a #{self.class::RSRC_OBJECT_KEY}." unless args[:name]
      return if defined? self.class::NON_UNIQUE_NAMES
      matches = self.class.all_names(:refresh, api: @api).select { |n| n.casecmp? args[:name] }
      raise JSS::AlreadyExistsError, "A #{self.class::RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" unless matches.empty?
    end
def validate_init_for_creation ( args ) raise JSS :: UnsupportedError , "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows." unless creatable? raise JSS :: MissingDataError , "You must provide a :name to create a #{self.class::RSRC_OBJECT_KEY}." unless args [ :name ] return if defined? self . class :: NON_UNIQUE_NAMES matches = self . class . all_names ( :refresh , api : @api ) . select { | n | n . casecmp? args [ :name ] } raise JSS :: AlreadyExistsError , "A #{self.class::RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" unless matches . empty? end
If we're making a new object in the JSS, make sure we were given
valid data to do so, raise exceptions otherwise.
If we ' re making a new object in the JSS make sure we were given valid data to do so raise exceptions otherwise .
None
void
args
The args passed to #initialize
The args passed to #initialize