ruby-jss 2.0.0b3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,37 +1,55 @@
1
- # ruby-jss: Working with the Jamf Pro Classic API in Ruby
1
+ # ruby-jss: Working with the Jamf Pro APIs in Ruby
2
2
  [![Gem Version](https://badge.fury.io/rb/ruby-jss.svg)](http://badge.fury.io/rb/ruby-jss)
3
3
 
4
- ## **IMPORTANT: Known Security Issue in v1.5.3 and below**
4
+ ## Version 2.0.0 has been released
5
5
 
6
- Versions of ruby-jss prior to 1.6.0 contain a known security issue due to the use of the 'plist' gem.
6
+ Version 2.0.0 has major changes! While we've strived for _mostly_ being backward compatible, and have done lots of testing, YMMV. Please report any issues.
7
+
8
+ _NOTE_: ruby-jss 2.0 is not completely backward compatible, please see [README-2.0.0.md](README-2.0.0.md) for more info
9
+
10
+ ### Highlights
11
+
12
+ - Support for Ruby 3.x
13
+ - tested in 3.0 and 3.1
14
+ - Combined access to both the Classic and Jamf Pro APIs
15
+ - A single namespace module
16
+ - Connection objects talk to both APIs & automatically handle details like bearer tokens
17
+ - Auto-generated code for Jamf Pro API objects
18
+ - Autoloading of code using [Zeitwerk](https://github.com/fxn/zeitwerk)
19
+
20
+ For details about the changes, the document [README-2.0.0.md](README-2.0.0.md).
21
+
22
+ ## _IMPORTANT_: Known Security Issue in v1.5.3 and below
23
+
24
+ Versions of ruby-jss prior to 1.6.0 contain a known security issue due to how we were using the 'plist' gem.
7
25
 
8
26
  This has been resolved in 1.6.0, which now uses the CFProperlyList gem.
9
27
 
10
- Please update all installations of ruby-jss to at least v1.6.0.
28
+ __Please update all installations of ruby-jss to at least v1.6.0.__
11
29
 
12
30
  Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
13
31
 
14
- ### Table of contents
32
+ ------
33
+
34
+ # Table of contents
15
35
 
16
36
  <!-- TOC -->
17
37
 
38
+ - [Version 2.0.0 has been released](#version-200-has-been-released)
39
+ - [Highlights](#highlights)
40
+ - [_IMPORTANT_: Known Security Issue in v1.5.3 and below](#_important_-known-security-issue-in-v153-and-below)
18
41
  - [DESCRIPTION](#description)
19
- - [Contact](#contact)
20
42
  - [SYNOPSIS](#synopsis)
21
43
  - [USAGE](#usage)
22
- - [Connecting to the API](#connecting-to-the-api)
23
- - [Working with JSS Objects](#working-with-jss-objects)
44
+ - [Connecting to the Server](#connecting-to-the-server)
45
+ - [Using multiple connections](#using-multiple-connections)
46
+ - [Working with Jamf Objects](#working-with-jamf-objects)
24
47
  - [Listing Objects](#listing-objects)
25
48
  - [Retrieving Objects](#retrieving-objects)
26
49
  - [Creating Objects](#creating-objects)
27
50
  - [Updating Objects](#updating-objects)
28
51
  - [Deleting Objects](#deleting-objects)
29
52
  - [OBJECTS IMPLEMENTED](#objects-implemented)
30
- - [Creatable and Updatable](#creatable-and-updatable)
31
- - [Updatable, but must be created in the Web UI](#updatable-but-must-be-created-in-the-web-ui)
32
- - [Creatable only](#creatable-only)
33
- - [Read-Only](#read-only)
34
- - [Deletable](#deletable)
35
53
  - [Other useful classes & modules:](#other-useful-classes--modules)
36
54
  - [Object-related API endpoints](#object-related-api-endpoints)
37
55
  - [CONFIGURATION](#configuration)
@@ -39,38 +57,35 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
39
57
  - [BEYOND THE API](#beyond-the-api)
40
58
  - [INSTALL](#install)
41
59
  - [REQUIREMENTS](#requirements)
42
- - [HELP](#help)
60
+ - [Contact](#contact)
61
+ - [HELP & CONTACT INFO](#help--contact-info)
43
62
  - [LICENSE](#license)
44
63
 
45
64
  <!-- /TOC -->
46
65
 
47
66
  ## DESCRIPTION
48
67
 
49
- ruby-jss defines a Ruby module called JSS, which is used for accessing the 'classic' REST API of
50
- the JAMF Software Server (JSS), the core of Jamf Pro, an enterprise-level management tool for Apple
51
- devices from [Jamf.com](http://www.jamf.com/). It is available as a
52
- [ruby gem](https://rubygems.org/gems/ruby-jss), and the
68
+ ruby-jss defines a Ruby module called `Jamf`, which is used for accessing the 'Classic' and
69
+ 'Jamf Pro' APIs of a Jamf Pro server. Jamf Pro is an enterprise-level management tool for Apple
70
+ devices from [Jamf.com](http://www.jamf.com/). It is available as a[ruby gem](https://rubygems.org/gems/ruby-jss), and the
53
71
  [source is on github](https://github.com/PixarAnimationStudios/ruby-jss).
54
72
 
55
- The module abstracts many API resources as Ruby objects, and provides methods for interacting with those
56
- resources. It also provides some features that aren't a part of the API itself, but come with other
57
- Jamf-related tools, such as uploading .pkg and .dmg {JSS::Package} data to the master distribution
58
- point, and the installation of {JSS::Package} objects on client machines. (See [BEYOND THE API](#beyond-the-api))
73
+ The Jamf module maintains connections to both APIs simultaneously, and uses which ever is appropriate as needed.
74
+ Details like authentication tokens, token refreshing, JSON and XML parsing, and even knowing which resources use
75
+ which API are all handled under-the-hood.
59
76
 
60
- The module is not a complete implementation of the Jamf Pro Classic API. Only some API objects are modeled, some only minimally. Of those, some are read-only, some partially writable, some fully read-write (all implemented objects can be deleted) See [OBJECTS IMPLEMENTED](#objects-implemented) for a list.
77
+ The Jamf module abstracts many API resources as Ruby objects, and provides methods for interacting with those
78
+ resources. It also provides some features that aren't a part of the API itself, but come with other
79
+ Jamf-related tools, such as uploading {Jamf::Package} files to the master distribution
80
+ point, and the installation of those objects on client machines. (See [BEYOND THE API](#beyond-the-api))
61
81
 
82
+ The Jamf module is not a complete implementation of the Jamf Pro APIs. Only some objects are modeled,
83
+ some only minimally. Of those, some are read-only, some partially writable, some fully read-write.
62
84
  We've implemented the things we need in our environment, and as our needs grow, we'll add more.
63
85
  Hopefully others will find it useful, and add more to it as well.
64
86
 
65
87
  [Full technical documentation can be found here.](http://www.rubydoc.info/gems/ruby-jss/)
66
88
 
67
- NOTE: ruby-jss 2.0.0 is in testing, see [README-2.0.0.md](README-2.0.0.md) for more info.
68
-
69
- ### Contact
70
-
71
- If you have questions or feedback about ruby-jss, please reach out in the [#ruby-jss channel of Macadmins Slack](https://macadmins.slack.com/archives/C03C7F563MK), or open an issue on GitHub, or email ruby-jss@pixar.com.
72
-
73
-
74
89
  ## SYNOPSIS
75
90
 
76
91
  Here are some simple examples of using ruby-jss
@@ -79,97 +94,138 @@ Here are some simple examples of using ruby-jss
79
94
  require 'ruby-jss'
80
95
 
81
96
  # Connect to the API
82
- Jamf.cnx.connect user: jss_user, pw: jss_user_pw, server: jss_server_hostname
97
+ Jamf.cnx.connect "https://#{jamf_user}:#{jamf_pw}@my.jamf.server.com/"
83
98
 
84
- # get an array of basic data about all JSS::Package objects in the JSS:
85
- pkgs = JSS::Package.all
99
+ # get an array of basic data about all Jamf::Package objects in Jamf Pro:
100
+ pkgs = Jamf::Package.all
86
101
 
87
- # get an array of names of all JSS::Package objects in the JSS:
88
- pkg_names = JSS::Package.all_names
102
+ # get an array of names of all Jamf::Package objects in the Jamf Pro:
103
+ pkg_names = Jamf::Package.all_names
89
104
 
90
105
  # Get a static computer group. This creates a new Ruby object
91
- # representing the existing JSS computer group.
92
- mg = JSS::ComputerGroup.fetch name: "Macs of interest"
106
+ # representing the existing Jamf computer group.
107
+ mac_group = Jamf::ComputerGroup.fetch name: "Macs of interest"
93
108
 
94
109
  # Add a computer to the group
95
- mg.add_member "pricklepants"
110
+ mac_group.add_member "pricklepants"
96
111
 
97
- # save changes back to the JSS, mg.update works also
98
- mg.save
112
+ # save changes back to the server
113
+ mac_group.save
99
114
 
100
- # Create a new network segment to store in the JSS.
101
- # This makes a new Ruby Object that doesn't yet exist in the JSS.
102
- ns = JSS::NetworkSegment.make(
115
+ # Create a new network segment to store on the server.
116
+ # This makes a new Ruby Object that doesn't yet exist in Jamf Pro.
117
+ ns = Jamf::NetworkSegment.create(
103
118
  name: 'Private Class C',
104
119
  starting_address: '192.168.0.0',
105
120
  ending_address: '192.168.0.255'
106
121
  )
107
122
 
108
123
  # Associate this network segment with a specific building,
109
- # which must exist in the JSS, and be listed in JSS::Building.all_names
124
+ # which must exist in Jamf Pro, and be listed in Jamf::Building.all_names
110
125
  ns.building = "Main Office"
111
126
 
112
127
  # Associate this network segment with a specific software update server,
113
- # which must exist in the JSS, and be listed in JSS::SoftwareUpdateServer.all_names
128
+ # which must exist in Jamf Pro, and be listed in Jamf::SoftwareUpdateServer.all_names
114
129
  ns.swu_server = "Main SWU Server"
115
130
 
116
- # save the new network segment in the JSS, ns.create works as well
131
+ # save the new network segment to the server
117
132
  ns.save
118
133
  ```
119
134
 
120
135
  ## USAGE
121
136
 
122
- ### Connecting to the API
137
+ ### Connecting to the Server
123
138
 
124
- Before you can work with JSS Objects via the API, you have to connect to it.
139
+ Before you can work with Jamf Pros Objects via the APIs, you have to connect to the server.
125
140
 
126
- The method `Jamf.cnx` returns the currently active connection to the API (an instance of a {JSS::APIConnection}, q.v.).
141
+ The method `Jamf.cnx` returns the 'default' connection object (an instance of a {Jamf::APIConnection}, q.v.).
142
+ A connection object holds all the data needed to communicate with the server to which it's connected, as well as
143
+ any data cached from that server.
144
+ The default connection object is used for all communication unless a different one is explicitly passed to methods
145
+ that can accept one. See 'Using multiple connections' below.
127
146
 
128
- When the JSS Module is first loaded, that connection object isn't connected to anything. To remedy that, use `Jamf.cnx.connect`, passing it parameters for the connection. In this example, those parameters are stored in the local variables jss_user, jss_user_pw, and jss_server_hostname, and others are left as default.
147
+ When the Jamf Module is first loaded, the default connection isn't connected a server. To remedy that, use `Jamf.cnx.connect`,
148
+ passing it parameters for the connection. In this example, those parameters are stored in the local variables jss_user,
149
+ jss_user_pw, and jss_server_hostname, and others are left as default.
129
150
 
130
151
  ```ruby
131
152
  Jamf.cnx.connect user: jss_user, pw: jss_user_pw, server: jss_server_hostname
132
153
  ```
133
154
 
134
- Make sure the user has privileges in the JSS to do things with desired objects. Note that these might be more than you think, since some objects refer to other objects, like Sites and Categories.
155
+ You can also provide a URL, optionally including the credentials, and port number. Any value not available in the URL can be passed as a normal parameter.
135
156
 
136
- If the server name given ends with 'jamfcloud.com' the port number will default to 443 via SSL. Otherwise, it defaults to 8443 with SSL (the default port for locally-hosted servers). In other situations, you can specify it with the `port:` and `use_ssl:` parameters.
157
+ ```ruby
158
+ Jamf.cnx.connect "https://#{jamf_user}@my.jamf.server.com/", pw: jamf_user_pw, port: 8443
159
+ ```
160
+
161
+ Make sure the user has privileges in the Jamf to do things with desired objects. Note that these might be more than you think, since some objects refer to other objects, like Sites and Categories.
162
+
163
+ If the server name given ends with 'jamfcloud.com' the port number will default to 443 via SSL. Otherwise, it defaults to 8443 with SSL (the default port for on-prem. servers). In other situations, you can specify it with the `port:` and `use_ssl:` parameters.
137
164
 
138
165
  The connect method also accepts the symbols :stdin and :prompt as values for pw:, which will cause it to read the
139
- password from stdin, or prompt for it in the shell. See the {JSS::APIConnection} class for more connection options and details about its methods.
166
+ password from stdin, or prompt for it in the shell. See the {Jamf::Connection} class for more connection options and details about its methods.
140
167
 
141
- Also see JSS::Configuration, and the [CONFIGURATION](#configuration) section below, for how to store
168
+ Also see Jamf::Configuration, and the [CONFIGURATION](#configuration) section below, for how to store
142
169
  server connection parameters in a simple config file.
143
170
 
144
- ### Working with JSS Objects
171
+ #### Using multiple connections
172
+
173
+ Most of the time, you'll only need a single connection to a single server, and the default connection will be sufficient. However
174
+ you can also create multiple Connection objects, to different servers, or perhaps the same server with different credentials and
175
+ access, and pass those connection objects into methods using the `cnx:` parameter as appropriate.
145
176
 
146
- All of the ruby classes representing objects in Jamf Pro are subclasse of, or modules within, JSS::APIObject and share methods for creating, listing, retrieving, updating, and deleting via the API. All supported objects can be listed, retrieved and deleted, but only some can be updated or created. See below for the level of implementation of each class.
177
+ ```ruby
178
+ # Make connections to 2 different Jamf servers.
179
+ # The .new class method accepts the same parameters as the #connect instance method,
180
+ # and will automatically pass them to the #connect method when instantiating
181
+ # the new connection object.
182
+ connection_1 = Jamf::Connection.new user: jss_user, pw: jss_user_pw, server: jss_server_hostname
183
+ connection_2 = Jamf::Connection.new user: jss_user2, pw: jss_user_pw2, server: jss_server_hostname2
184
+
185
+ # Get an array of the serialNumbers from all InventoryPreloadRecords in server 1
186
+ ipr_sns_1 = Jamf::InventoryPreloadRecord.all_serialNumbers cnx: connection_1
187
+
188
+ # Get an array of the serialNumbers from all InventoryPreloadRecords in server 2
189
+ ipr_sns_2 = Jamf::InventoryPreloadRecord.all_serialNumbers cnx: connection_2
190
+
191
+ # Find the SNs that appear in both
192
+ common_ipr_sns = ipr_sns_1 & ipr_sns_2
193
+ ```
194
+
195
+ ### Working with Jamf Objects
147
196
 
148
- Some of those objects also provide access to more 'functional' API resources. For example, the API resources for sending MDM commands to computers and mobile devices are available as class and instance methods of JSS::Computer and JSS::MobileDevice, as are the API resources for accessing management history.
197
+ All of the ruby classes representing objects in Jamf Pro have common methods for creating, listing, retrieving, updating, and deleting via the API.
198
+ All supported objects can be listed, retrieved and deleted, but only some can be updated or created, mostly becase we haven't needed to do that ourselves
199
+ yet and haven't implemented that functionality. If you need additional features implemented, please get in touch (see 'Contact' above) or feel free to
200
+ try implementing it yourself and send us a merge request.
201
+
202
+ Some of the implemented objects also provide access to more 'functional' API resources. For example, the API resources for
203
+ sending MDM commands to computers and mobile devices are available as class and instance methods of Jamf::Computer and Jamf::MobileDevice,
204
+ as are the API resources for accessing management history.
149
205
 
150
206
  --------
151
207
 
152
208
  #### Listing Objects
153
209
 
154
- To get an Array with a summary of every object in the JSS of some Class, call that Class's .all method:
210
+ To get an Array with a summary of every object in the Jamf of some Class, call that Class's .all method:
155
211
 
156
212
  ```ruby
157
- JSS::Computer.all # => [{:name=>"cephei", :id=>1122},{:name=>"peterparker", :id=>1218}, {:name=>"rowdy", :id=>931}, ...]
213
+ Jamf::Computer.all # => [{:name=>"cephei", :id=>1122},{:name=>"peterparker", :id=>1218}, {:name=>"rowdy", :id=>931}, ...]
158
214
  ```
159
215
 
160
216
  The Array will contain a Hash for each item, with at least a :name and an :id. Some classes provide more summary data for each item.
161
217
  To get just the names or just the ids in an Array, use the .all\_names or .all\_ids Class method
162
218
 
163
219
  ```ruby
164
- JSS::Computer.all_names # => ["cephei", "peterparker", "rowdy", ...]
165
- JSS::Computer.all_ids # => [1122, 1218, 931, ...]
220
+ Jamf::Computer.all_names # => ["cephei", "peterparker", "rowdy", ...]
221
+ Jamf::Computer.all_ids # => [1122, 1218, 931, ...]
166
222
  ```
167
223
 
168
- Some Classes provide other ways to list objects, or subsets of them, depending on the data available, e.g. JSS::MobileDevice.all\_udids or JSS::Computer.all\_laptops
224
+ Some Classes provide other ways to list objects, or subsets of them, depending on the data available, e.g. Jamf::MobileDevice.all\_udids or Jamf::Computer.all\_laptops
169
225
 
170
- You can also perform simple searches for JSS::Computer, JSS::MobileDevice and JSS::User with the `.match` class method. This is the API equivalent of using the simple search field at the top of the Computers, Devices, or Users pages in the Jamf Pro Web interface. This method will return an Array of Hashes for the matching items. Each Hash is a summary of info about a matching item, similar to the summaries returned by the `.all` methods for those items.
226
+ You can also perform simple searches for Jamf::Computer, Jamf::MobileDevice and Jamf::User with the `.match` class method. This is the API equivalent of using the simple search field at the top of the Computers, Devices, or Users pages in the Jamf Pro Web interface. This method will return an Array of Hashes for the matching items. Each Hash is a summary of info about a matching item, similar to the summaries returned by the `.all` methods for those items.
171
227
 
172
- To create, modify, or perform advanced searches, use the classes JSS::AdvancedComputerSearch, JSS::AdvancedMobileDeviceSearch, and JSS::AdvancedUserSearch.
228
+ To create, modify, or perform advanced searches, use the classes Jamf::AdvancedComputerSearch, Jamf::AdvancedMobileDeviceSearch, and Jamf::AdvancedUserSearch.
173
229
 
174
230
  --------
175
231
 
@@ -179,23 +235,23 @@ To retrieve a single object call the class's `.fetch` method and provide a name:
179
235
 
180
236
 
181
237
  ```ruby
182
- a_dept = JSS::Department.fetch name: 'Payroll'# => #<JSS::Department:0x10b4c0818...
238
+ a_dept = Jamf::Department.fetch name: 'Payroll'# => #<Jamf::Department:0x10b4c0818...
183
239
  ```
184
240
 
185
241
  Some classes can use more than just the :id and name: keys for lookups, e.g. computers can be looked up with udid:, serial_number:, or mac_address:.
186
242
 
187
- You can even fetch objects without specifying the kind of identifier, e.g. `JSS::Computer.fetch 'VM3X9483HD78'`, but this will be slower, since ruby-jss searches by matching the given value with all available identifiers, returning the first match.
243
+ You can even fetch objects without specifying the kind of identifier, e.g. `Jamf::Computer.fetch 'VM3X9483HD78'`, but this will be slower, since ruby-jss searches by matching the given value with all available identifiers, returning the first match.
188
244
 
189
245
  --------
190
246
 
191
247
  #### Creating Objects
192
248
 
193
- Some Objects can be created anew in the JSS via ruby. To do so, first make a Ruby object using the class's `.make` method and providing a unique :name:, e.g.
249
+ Some Objects can be created anew in the Jamf via ruby. To do so, first make a Ruby object using the class's `.create` method and providing a unique :name:, e.g.
194
250
 
195
251
  ```ruby
196
- new_pkg = JSS::Package.make name: "transmogrifier-2.3-1.pkg"
252
+ new_pkg = Jamf::Package.create name: "transmogrifier-2.3-1.pkg"
197
253
  ```
198
- *NOTE*: some classes require more data than just a name: when created with .make
254
+ *NOTE*: some classes require more data than just a name: when created with .create
199
255
 
200
256
  Then set the attributes of the new object as needed
201
257
 
@@ -205,7 +261,7 @@ new_pkg.category = "CoolTools"
205
261
  # etc..
206
262
  ```
207
263
 
208
- Then use the #save method to create it in the JSS. The #create method is the same
264
+ Then use the #save method to send the data to the API, creating it in Jamf Pro.
209
265
 
210
266
  ```ruby
211
267
  new_pkg.save # returns 453, the id number of the object just created
@@ -215,14 +271,14 @@ new_pkg.save # returns 453, the id number of the object just created
215
271
 
216
272
  #### Updating Objects
217
273
 
218
- Some objects can be modified in the JSS.
274
+ Some objects can be modified.
219
275
 
220
276
  ```ruby
221
- existing_script = JSS::Script.fetch id: 321
277
+ existing_script = Jamf::Script.fetch id: 321
222
278
  existing_script.name = "transmogrifier-2.3-1.post-install"
223
279
  ```
224
280
 
225
- After changing any attributes, use the #save method (also aliased to #update) to push the changes to the JSS.
281
+ After changing any attributes, use the #save method to push the changes to the sever.
226
282
 
227
283
  ```ruby
228
284
  existing_script.save # => returns the id number of the object just saved
@@ -235,16 +291,19 @@ existing_script.save # => returns the id number of the object just saved
235
291
  To delete an object, just call its #delete method
236
292
 
237
293
  ```ruby
238
- existing_script = JSS::Script.fetch id: 321
294
+ existing_script = Jamf::Script.fetch id: 321
239
295
  existing_script.delete # => true # the delete was successful
240
296
  ```
241
297
  To delete an object without fetching it, use the class's .delete method and provide the id, or an array of ids.
242
298
 
243
299
  ```ruby
244
- JSS::Script.delete [321, 543, 374]
300
+ Jamf::Script.delete [321, 543, 374]
245
301
  ```
246
302
 
247
- See [JSS::APIObject](http://www.rubydoc.info/gems/ruby-jss/JSS/APIObject), the parent class of all API resources, for general information about creating, reading, updating/saving, and deleting resources.
303
+ For more details see the docs for:
304
+ - [Jamf::APIObject](http://www.rubydoc.info/gems/ruby-jss/Jamf/APIObject), the parent class of all Classic API resources
305
+ - [Jamf::OAPIObject](http://www.rubydoc.info/gems/ruby-jss/Jamf/OAPIObject), the parent class of all Jamf Pro API objects
306
+ - [Jamf::CollectionResource](http://www.rubydoc.info/gems/ruby-jss/Jamf/CollectionResource), the parent class of all Jamf Pro API collection resources
248
307
 
249
308
  See the individual subclasses for any details specific to them.
250
309
 
@@ -252,77 +311,64 @@ See the individual subclasses for any details specific to them.
252
311
 
253
312
  While the API itself supports nearly full CRUD (Create,Read,Update,Delete) for all objects, ruby-jss doesn't yet do so. Why? Because implementing the data validation and other parts needed for creating & updating can be time-consuming and we've focused on what we needed. As we keep developing ruby-jss, this list changes. If you'd like to help implement some of these objects more fully, please fork the github project and reach out to us at ruby-jss@pixar.com.
254
313
 
255
- Here's what we've implemented so far. See each Class's [documentation(http://www.rubydoc.info/gems/ruby-jss)] for details.
256
-
257
- ### Creatable and Updatable
258
-
259
- * {JSS::AdvancedComputerSearch}
260
- * {JSS::AdvancedMobileDeviceSearch}
261
- * {JSS::AdvancedUserSearch}
262
- * {JSS::Building}
263
- * {JSS::Category}
264
- * {JSS::Computer}
265
- * {JSS::ComputerExtensionAttribute}
266
- * {JSS::ComputerGroup}
267
- * {JSS::Department}
268
- * {JSS::DistributionPoint}
269
- * {JSS::MobileDevice}
270
- * {JSS::MobileDeviceApplication}
271
- * {JSS::MobileDeviceExtensionAttribute}
272
- * {JSS::MobileDeviceGroup}
273
- * {JSS::NetworkSegment}
274
- * {JSS::Package}
275
- * {JSS::PatchTitle}
276
- * {JSS::PatchTitle::Version}
277
- * {JSS::PatchExternalSource}
278
- * {JSS::PatchPolicy}
279
- * {JSS::Peripheral}
280
- * {JSS::PeripheralType}
281
- * {JSS::Policy} (not fully implemented)
282
- * {JSS::RemovableMacAddress}
283
- * {JSS::RestrictedSoftware}
284
- * {JSS::Script}
285
- * {JSS::Site}
286
- * {JSS::User}
287
- * {JSS::UserExtensionAttribute}
288
- * {JSS::UserGroup}
289
- * {JSS::WebHook}
290
-
314
+ Here's some of what we've implemented so far. See each Class's [documentation(http://www.rubydoc.info/gems/ruby-jss)] for details.
315
+
316
+
317
+ * {Jamf::AdvancedComputerSearch}
318
+ * {Jamf::AdvancedMobileDeviceSearch}
319
+ * {Jamf::AdvancedUserSearch}
320
+ * {Jamf::Building}
321
+ * {Jamf::Category}
322
+ * {Jamf::Computer}
323
+ * {Jamf::ComputerExtensionAttribute}
324
+ * {Jamf::ComputerGroup}
325
+ * {Jamf::ComputerInvitation}
326
+ * {Jamf::Department}
327
+ * {Jamf::DistributionPoint}
328
+ * {Jamf::DockItem}
329
+ * {Jamf::EBook}
330
+ * {Jamf::IBeacon}
331
+ * {Jamf::LdapServer}
332
+ * {Jamf::MobileDevice}
333
+ * {Jamf::MobileDeviceApplication}
334
+ * {Jamf::MobileDeviceConfigurationProfile}
335
+ * {Jamf::MobileDeviceExtensionAttribute}
336
+ * {Jamf::MobileDeviceGroup}
337
+ * {Jamf::NetBootServer}
338
+ * {Jamf::NetworkSegment}
339
+ * {Jamf::OSXConfigurationProfile}
340
+ * {Jamf::Package}
341
+ * {Jamf::PatchTitle}
342
+ * {Jamf::PatchTitle::Version}
343
+ * {Jamf::PatchExternalSource}
344
+ * {Jamf::PatchInternalSource}
345
+ * {Jamf::PatchPolicy}
346
+ * {Jamf::Peripheral}
347
+ * {Jamf::PeripheralType}
348
+ * {Jamf::Policy} (not fully implemented)
349
+ * {Jamf::RemovableMacAddress}
350
+ * {Jamf::RestrictedSoftware}
351
+ * {Jamf::Script}
352
+ * {Jamf::Site}
353
+ * {Jamf::SoftwareUpdateServer}
354
+ * {Jamf::User}
355
+ * {Jamf::UserExtensionAttribute}
356
+ * {Jamf::UserGroup}
357
+ * {Jamf::WebHook}
291
358
 
292
359
  **NOTE** Most Computer and MobileDevice data gathered by an Inventory Upate (a.k.a. 'recon') is not editable.
293
360
 
294
- ### Updatable, but must be created in the Web UI
295
-
296
- * {JSS::OSXConfigurationProfile}
297
- * {JSS::MobileDeviceConfigurationProfile}
298
- * {JSS::PatchInternalSource}
299
-
300
- ### Creatable only
301
-
302
- * {JSS::ComputerInvitation}
303
-
304
- ### Read-Only
361
+ #### Other useful classes & modules:
305
362
 
306
- These must be created and edited via the JSS WebApp
363
+ These modules either provide stand-alone methods, or are mixed in to other classes to extend their functionality. See their documentation for details
307
364
 
308
- * {JSS::DistributionPoint}
309
- * {JSS::LdapServer}
310
- * {JSS::NetBootServer}
311
- * {JSS::SoftwareUpdateServer}
365
+ * {Jamf::Client} - An object representing the local machine as a Jamf-managed client, and provifing Jamf-related info and methods
312
366
 
313
- ### Deletable
367
+ * {Jamf::ManagementHistory} - a module for handing the management history for Computers and Mobile Devices. It defines many read-only classes representing events in a machine's history. It is accessed via the Computer and MobileDevice classes and their instances.
314
368
 
315
- All supported API Objects can be deleted
369
+ * {Jamf::Scopable} - a module that handles Scope for those objects that can be scoped. It defines the Scope class used in those objects. Instances of Scope are where you change targets, limitations, and exclusions.
316
370
 
317
- #### Other useful classes & modules:
318
-
319
- * {JSS::APIConnection} - An object representing a connection to the Classic API on some server. The 'default' connection object is available via `Jamf.cnx` but you can create others, and pass them into calls like `.fetch` as needed. This is useful when working with multiple servers at a time, such as a production and a test server. Objects retrieved from a connection know which connection they came from, and will only send changes via that connection.
320
- * {JSS::DBConnection} - An object representing the connection to MySQL database, if used.
321
- * {JSS::Server} - An object representing the Jamf Pro server being used by a connection. An instance is available in the #server attribute of a {JSS::APIConnection}.
322
- * {JSS::Client} - An object representing the local machine as a Jamf-managed client, and provifing Jamf-related info and methods
323
- * {JSS::ManagementHistory} - a module for handing the management history for Computers and Mobile Devices. It defines many read-only classes representing events in a machine's history. It is accessed via the Computer and MobileDevice classes and their instances.
324
- * {JSS::Scopable} - a module that handles Scope for those objects that can be scoped. It defines the Scope class used in those objects.
325
- * {JSS::MDM} - a module that handles sending MDM commands. It is accessed via the Computer and MobileDevice classes and their instances.
371
+ * {Jamf::MDM} - a module that handles sending MDM commands. It is accessed via the Computer and MobileDevice classes and their instances.
326
372
 
327
373
  ## Object-related API endpoints
328
374
 
@@ -331,19 +377,19 @@ The classic API provides many endpoints not just for objects stored in Jamf Pro,
331
377
  For example:
332
378
 
333
379
  * /computerapplications, /computerapplicationusage, /computerhardwaresoftwarereports, /computerhistory, etc.
334
- - The data provided by these endpoints are accessible via class and instance methods for {JSS::Computer}
380
+ - The data provided by these endpoints are accessible via class and instance methods for {Jamf::Computer}
335
381
  * /computercheckin, /computerinventorycollection
336
- - These endpoints deal with server-wide settings regarding computer management, and are available via {JSS::Computer} class methods
382
+ - These endpoints deal with server-wide settings regarding computer management, and are available via {Jamf::Computer} class methods
337
383
  * /computercommands, /mobiledevicecommands, /commandflush, etc.
338
- - These endpoints provide access to the MDM infrastructure, and can be used to send MDM commands. Ruby-jss provides these as class and instance methods in {JSS::Computer}, {JSS::ComputerGroup}, {JSS::MobileDevice}, and {JSS::MobileDeviceGroup}
384
+ - These endpoints provide access to the MDM infrastructure, and can be used to send MDM commands. Ruby-jss provides these as class and instance methods in {Jamf::Computer}, {Jamf::ComputerGroup}, {Jamf::MobileDevice}, and {Jamf::MobileDeviceGroup}
339
385
 
340
386
  ## CONFIGURATION
341
387
 
342
- The {JSS::Configuration} singleton class is used to read, write, and use site-specific defaults for the JSS module. When ruby-jss is required, the single instance of {JSS::Configuration} is created and stored in the constant {JSS::CONFIG}. At that time the system-wide file /etc/ruby-jss.conf is examined if it exists, and the items in it are loaded into the attributes of {JSS::CONFIG}. The user-specific file ~/.ruby-hss.conf then is examined if it exists, and any items defined there will override those values from the system-wide file.
388
+ The {Jamf::Configuration} singleton class is used to read, write, and use site-specific defaults for the Jamf module. When ruby-jss is required, the single instance of {Jamf::Configuration} is created and accessible via the `Jamf.config` method. At that time the system-wide file /etc/ruby-jss.conf is examined if it exists, and the items in it are loaded into the attributes of Configuration instance. The user-specific file ~/.ruby-jss.conf then is examined if it exists, and any items defined there will override those values from the system-wide file.
343
389
 
344
- The values defined in those files are used as defaults throughout the module. Currently, those values are only related to establishing the API connection. For example, if a server name is defined, then a :server does not have to be specified when calling {JSS::APIConnection#connect}. Values provided explicitly when calling JSS::APIConnection#connect will override the config values.
390
+ The values defined in those files are used as defaults throughout the module. Currently, those values are only related to establishing the API connection. For example, if a server name is defined, then a server: does not have to be specified when calling {Jamf::Connection#connect}. Values provided explicitly when calling Jamf::Connection#connect will override the config values.
345
391
 
346
- While the {JSS::Configuration} class provides methods for changing the values, saving the files, and re-reading them, or reading an arbitrary file, the files are text files with a simple format, and can be created by any means desired. The file format is one attribute per line, thus:
392
+ While the {Jamf::Configuration} class provides methods for changing the values, saving the files, and re-reading them, or reading an arbitrary file, the files are text files with a simple format, and can be created by any means desired. The file format is one attribute per line, thus:
347
393
 
348
394
  attr_name: value
349
395
 
@@ -351,30 +397,30 @@ Lines that don’t start with a known attribute name followed by a colon are ign
351
397
 
352
398
  The currently known attributes are:
353
399
 
354
- * api_server_name [String] the hostname of the JSS API server
400
+ * api_server_name [String] the hostname of the Jamf API server
355
401
  * api_server_port [Integer] the port number for the API connection
356
402
  * api_verify_cert [Boolean] 'true' or 'false' - if SSL is used, should the certificate be verified? (usually false for a self-signed cert)
357
- * api_username [String] the JSS username for connecting to the API
403
+ * api_username [String] the Jamf username for connecting to the API
358
404
  * api_timeout_open [Integer] the number of seconds for the open-connection timeout
359
405
  * api_timeout [Integer] the number of seconds for the response timeout
360
406
 
361
- To put a standard server & username on all client machines, and auto-accept the JSS's self-signed https certificate, create the file /etc/ruby-jss.conf containing three lines like this:
407
+ To put a standard server & username on all client machines, and auto-accept the Jamf's self-signed https certificate, create the file /etc/ruby-jss.conf containing three lines like this:
362
408
 
363
409
  ```
364
410
  api_server_name: jamfpro.myschool.edu
365
411
  api_username: readonly-api-user
366
- api_verify_cert: false
412
+ api_timeout: 90
367
413
  ```
368
414
 
369
- and then any calls to Jamf.cnx.connect will assume that server and username, and won't complain about the self-signed certificate.
415
+ and then any calls to Jamf.cnx.connect will assume that server and username, and use a timeout of 90 seconds.
370
416
 
371
417
  ### Passwords
372
418
 
373
- The config files don't store passwords and the {JSS::Configuration} instance doesn't work with them. You'll have to use your own methods for acquiring the password for the Jamf.cnx.connect call.
419
+ The config files don't store passwords and the {Jamf::Configuration} instance doesn't work with them. You'll have to use your own methods for acquiring the password for the Jamf.cnx.connect call.
374
420
 
375
- The {JSS::APIConnection.connect} method also accepts the symbols :stdin# and :prompt as values for the :pw argument, which will cause it to read the password from a line of stdin, or prompt for it in the shell.
421
+ The {Jamf::APIConnection.connect} method also accepts the symbols :stdin# and :prompt as values for the :pw argument, which will cause it to read the password from a line of stdin, or prompt for it in the shell.
376
422
 
377
- If you must store a password in a file, or retrieve it from the network, make sure it's stored securely, and that the JSS user has limited permissions.
423
+ If you must store a password in a file, or retrieve it from the network, make sure it's stored securely, and that the Jamf user has limited permissions.
378
424
 
379
425
  Here's an example of how to use a password stored in a file:
380
426
 
@@ -393,56 +439,62 @@ Jamf.cnx.connect pw: password # other arguments used from the config settings
393
439
 
394
440
  ## BEYOND THE API
395
441
 
396
- While the Jamf Pro Classic API provides access to object data in the JSS, ruby-jss tries to use that data to provide more than just information exchange. Here are some examples of how ruby-jss uses the API to provide functionality found in various Jamf tools:
442
+ While the Jamf Pro APIs provide access to object data in the Jamf, ruby-jss tries to use that data to provide more than just information exchange. Here are some examples of how ruby-jss uses the API to provide functionality found in various Jamf tools:
397
443
 
398
444
  * Client Machine Access
399
- * The {JSS::Client} module provides the ability to run jamf binary commands, and access the local cache of package receipts
445
+ * The {Jamf::Client} module provides the ability to run jamf binary commands, and access the local cache of package receipts
400
446
  * Package Installation
401
- * {JSS::Package} objects can be installed on the local machine, from the appropriate distribution point
447
+ * {Jamf::Package} objects can be installed on the local machine, from the appropriate distribution point
402
448
  * Script Execution
403
- * {JSS::Script} objects can be executed locally on demand
449
+ * {Jamf::Script} objects can be executed locally on demand
404
450
  * Package Creation
405
- * The {JSS::Composer} module provides creation of very simple .pkg and .dmg packages
406
- * {JSS::Package} objects can upload their .pkg or .dmg files to the master distribution point ({JSS::Script} objects can also if you store them there.)
451
+ * The {Jamf::Composer} module provides creation of very simple .pkg and .dmg packages
452
+ * {Jamf::Package} objects can upload their .pkg or .dmg files to the master distribution point
407
453
  * Reporting/AdvancedSearch exporting
408
- * {JSS::AdvancedSearch} subclasses can export their results to csv, tab, and xml files.
454
+ * {Jamf::AdvancedSearch} subclasses can export their results to csv, tab, and xml files.
409
455
  * MDM Commands
410
- * {JSS::MobileDevice}s (and eventually {JSS::Computer}s) can be sent MDM commands
456
+ * {Jamf::MobileDevice}s and {Jamf::Computer}s can be sent MDM commands
411
457
  * Extension Attributes
412
- * {JSS::ExtensionAttribute} work with {JSS::AdvancedSearch} subclasses to provide extra reporting about Ext. Attrib. values.
458
+ * {Jamf::ExtensionAttribute} work with {Jamf::AdvancedSearch} subclasses to provide extra reporting about Extension Attribute values.
413
459
 
414
460
  ## INSTALL
415
461
 
416
- NOTE: You may need to install XCode, or it's CLI tools, in order to install the required gems.
417
-
418
462
  In general, you can install ruby-jss with this command:
419
463
 
420
464
  `gem install ruby-jss`
421
465
 
422
466
  ## REQUIREMENTS
423
467
 
424
- ruby-jss was written for:
468
+ ruby-jss 2.0.0 requires:
425
469
 
426
- * Mac OS X 10.9 or higher
427
- * Ruby 2.0 or higher
428
- * Casper Suite version 10.4 or higher
470
+ * Ruby 2.6.3 or higher (the OS-installed ruby version for macOS 10.15 Catalina)
471
+ * Jamf Pro server version 10.35 or higher
429
472
 
430
473
  It also requires other ruby gems, which will be installed automatically if you install with `gem install ruby-jss`
431
474
  See the .gemspec file for details
432
475
 
433
476
 
434
- ## HELP
477
+ ### Contact
478
+
479
+ If you have questions or feedback about ruby-jss, please reach out to us via:
480
+ - The [#ruby-jss channel of Macadmins Slack](https://macadmins.slack.com/archives/C03C7F563MK)
481
+ - Open an issue on GitHub
482
+ - Email ruby-jss@pixar.com
483
+
484
+
485
+ ## HELP & CONTACT INFO
435
486
 
436
487
  Full documentation is available at [rubydoc.info](http://www.rubydoc.info/gems/ruby-jss/).
437
488
 
438
489
  There's a [wiki on the github page](https://github.com/PixarAnimationStudios/ruby-jss/wiki), feel free to contribute examples and tidbits.
439
490
 
440
- [Email the developers](mailto:ruby-jss@pixar.com)
441
-
442
- [Macadmins Slack Channel](https://macadmins.slack.com/messages/#jss-api/)
491
+ You can report issues in several ways:
492
+ - [Open an issue on github](https://github.com/PixarAnimationStudios/ruby-jss/issues)
493
+ - [Email the developers at ruby-jss@pixar.com](mailto:ruby-jss@pixar.com)
494
+ - Join the conversation in the [#ruby-jss Macadmins Slack Channel](https://macadmins.slack.com/archives/C03C7F563MK)
443
495
 
444
496
  ## LICENSE
445
497
 
446
498
  Copyright 2022 Pixar
447
499
 
448
- Licensed under the Apache License, Version 2.0 (the "Apache License") with modifications. See LICENSE.txt for details
500
+ Licensed under a modified Apache License, Version 2.0. See LICENSE.txt for details