Method: Jamf::APIObject#initialize
- Defined in:
- lib/jamf/api/classic/base_classes/api_object.rb
#initialize(**args) ⇒ APIObject
The args hash must include :id, :name, or :data.
-
:id or :name will be looked up via the API
-
if the subclass includes Jamf::Creatable, :id can be :new, to create a new object in the JSS. and :name is required
-
-
:data must be the JSON output of a separate Connection query (a Hash of valid object data)
Some subclasses can accept other options, by pasing their keys in a final Array
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 |
# File 'lib/jamf/api/classic/base_classes/api_object.rb', line 1271 def initialize(**args) @cnx = args[:cnx] @cnx ||= args[:api] @cnx ||= Jamf.cnx # we're making a new one in the JSS if args[:id] == :new validate_init_for_creation(args) setup_object_for_creation(args) @need_to_update = true # we're instantiating an existing one in the jss else @init_data = look_up_object_data(args) @need_to_update = false end ## end arg parsing parse_init_data end |