Method: JSS::APIObject.new

Defined in:
lib/jss/api_object.rb

.new(**args) ⇒ Object

Disallow direct use of ruby’s .new class method for creating instances. Require use of .fetch or .make



984
985
986
987
988
989
990
991
992
993
# File 'lib/jss/api_object.rb', line 984

def self.new(**args)
  validate_not_metaclass(self)

  calling_method = caller_locations(1..1).first.label
  unless OK_INSTANTIATORS.include? calling_method
    raise JSS::UnsupportedError, 'Use .fetch or .make to instantiate APIObject classes'
  end

  super
end