ruby-jss 0.11.0a5 → 0.11.0a6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-jss might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGES.md +35 -29
- data/README.md +36 -48
- data/bin/cgrouper +1 -1
- data/bin/jamfHelperBackgrounder +1 -1
- data/bin/netseg-update +1 -1
- data/lib/jss.rb +1 -1
- data/lib/jss/api_connection.rb +1 -1
- data/lib/jss/api_object.rb +1 -1
- data/lib/jss/api_object/account.rb +1 -1
- data/lib/jss/api_object/advanced_search.rb +1 -1
- data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +1 -1
- data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +1 -1
- data/lib/jss/api_object/advanced_search/advanced_user_search.rb +1 -1
- data/lib/jss/api_object/building.rb +1 -1
- data/lib/jss/api_object/categorizable.rb +1 -1
- data/lib/jss/api_object/category.rb +1 -1
- data/lib/jss/api_object/computer.rb +6 -18
- data/lib/jss/api_object/computer_invitation.rb +1 -1
- data/lib/jss/api_object/creatable.rb +1 -1
- data/lib/jss/api_object/criteriable.rb +1 -1
- data/lib/jss/api_object/criteriable/criteria.rb +1 -1
- data/lib/jss/api_object/criteriable/criterion.rb +1 -1
- data/lib/jss/api_object/department.rb +1 -1
- data/lib/jss/api_object/distribution_point.rb +1 -1
- data/lib/jss/api_object/extendable.rb +1 -1
- data/lib/jss/api_object/extension_attribute.rb +1 -1
- data/lib/jss/api_object/extension_attribute/computer_extension_attribute.rb +1 -1
- data/lib/jss/api_object/extension_attribute/mobile_device_extension_attribute.rb +1 -1
- data/lib/jss/api_object/extension_attribute/user_extension_attribute.rb +1 -1
- data/lib/jss/api_object/group.rb +1 -1
- data/lib/jss/api_object/group/computer_group.rb +1 -1
- data/lib/jss/api_object/group/mobile_device_group.rb +1 -1
- data/lib/jss/api_object/group/user_group.rb +1 -1
- data/lib/jss/api_object/ldap_server.rb +1 -1
- data/lib/jss/api_object/locatable.rb +1 -1
- data/lib/jss/api_object/management_history.rb +29 -17
- data/lib/jss/api_object/management_history/audit_event.rb +1 -0
- data/lib/jss/api_object/management_history/casper_imaging_log.rb +1 -0
- data/lib/jss/api_object/management_history/casper_remote_log.rb +1 -0
- data/lib/jss/api_object/management_history/computer_usage_log.rb +1 -0
- data/lib/jss/api_object/management_history/ebook.rb +1 -0
- data/lib/jss/api_object/management_history/hashlike.rb +24 -0
- data/lib/jss/api_object/management_history/mac_app_store_app.rb +1 -0
- data/lib/jss/api_object/management_history/mdm_command.rb +1 -0
- data/lib/jss/api_object/management_history/mobile_device_app.rb +2 -0
- data/lib/jss/api_object/management_history/policy_log.rb +1 -0
- data/lib/jss/api_object/management_history/screen_sharing_log.rb +1 -0
- data/lib/jss/api_object/management_history/user_location_change.rb +3 -0
- data/lib/jss/api_object/matchable.rb +1 -1
- data/lib/jss/api_object/mdm.rb +1 -1
- data/lib/jss/api_object/mobile_device.rb +10 -12
- data/lib/jss/api_object/mobile_device_application.rb +1 -1
- data/lib/jss/api_object/netboot_server.rb +1 -1
- data/lib/jss/api_object/network_segment.rb +1 -1
- data/lib/jss/api_object/osx_configuration_profile.rb +1 -1
- data/lib/jss/api_object/package.rb +1 -1
- data/lib/jss/api_object/patch.rb +1 -1
- data/lib/jss/api_object/patch_policy.rb +1 -1
- data/lib/jss/api_object/peripheral.rb +1 -1
- data/lib/jss/api_object/peripheral_type.rb +1 -1
- data/lib/jss/api_object/policy.rb +1 -1
- data/lib/jss/api_object/purchasable.rb +1 -1
- data/lib/jss/api_object/removable_macaddr.rb +1 -1
- data/lib/jss/api_object/scopable.rb +1 -1
- data/lib/jss/api_object/scopable/scope.rb +1 -1
- data/lib/jss/api_object/script.rb +1 -1
- data/lib/jss/api_object/self_servable.rb +1 -1
- data/lib/jss/api_object/self_servable/icon.rb +1 -1
- data/lib/jss/api_object/sitable.rb +1 -1
- data/lib/jss/api_object/site.rb +1 -1
- data/lib/jss/api_object/software_update_server.rb +1 -1
- data/lib/jss/api_object/updatable.rb +1 -1
- data/lib/jss/api_object/uploadable.rb +1 -1
- data/lib/jss/api_object/user.rb +1 -1
- data/lib/jss/api_object/vppable.rb +1 -1
- data/lib/jss/api_object/webhook.rb +1 -1
- data/lib/jss/client.rb +1 -1
- data/lib/jss/compatibility.rb +1 -1
- data/lib/jss/composer.rb +1 -1
- data/lib/jss/configuration.rb +1 -1
- data/lib/jss/db_connection.rb +1 -1
- data/lib/jss/exceptions.rb +1 -1
- data/lib/jss/ruby_extensions.rb +1 -1
- data/lib/jss/ruby_extensions/array.rb +1 -1
- data/lib/jss/ruby_extensions/filetest.rb +1 -1
- data/lib/jss/ruby_extensions/hash.rb +1 -1
- data/lib/jss/ruby_extensions/ipaddr.rb +1 -1
- data/lib/jss/ruby_extensions/pathname.rb +1 -1
- data/lib/jss/ruby_extensions/string.rb +1 -1
- data/lib/jss/ruby_extensions/time.rb +1 -1
- data/lib/jss/server.rb +1 -1
- data/lib/jss/utility.rb +1 -1
- data/lib/jss/validate.rb +1 -1
- data/lib/jss/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 738e376502016631097bea927398750c1606a6f4
|
4
|
+
data.tar.gz: 9a82556c928e8cca44b4e37cd663b5959f9c774b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b309bc27a8314a2b588678d056760acfcf68abc9b75c4044c0c53c669a57b9b20750acce2a5837dc37d838a9a3b6f28ed8966018a8df48394e5245672a2166f
|
7
|
+
data.tar.gz: 0d5ba01aef444d7e3a24a877b6a9de341a01fce551f9362f850de49bf5a8e2691af8e610e9ae82b14be30e59c2112a882ba432b51fd19b8e94a1d70544650049
|
data/CHANGES.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Change History
|
2
2
|
|
3
|
-
## v 0.11.
|
4
|
-
|
5
|
-
- Fix: Updating JSS::Extendable objects with no changes to ext. attribs will no longer erase all ext attrib values. (!)
|
3
|
+
## v 0.11.0, 2018-02-19
|
6
4
|
|
7
5
|
- Improvement: Updated general attributes for computers and mobile devices
|
8
6
|
|
@@ -22,19 +20,23 @@
|
|
22
20
|
|
23
21
|
- Fix: Scope objects use the api connection of their container
|
24
22
|
|
23
|
+
- Improvement: 'devmode', use `JSS.devmode \[:on|:off]`` to set, and `JSS.devmode?`` to query. Useful for developers, esp. in `irb` who want, e.g. to have a method output some state when in devmode, instead of/as well as behaving normally. This is currently the case for `JSS::MDM.send_mdm_command`. When devmode? is true, the XML sent to the API for the command is printed to stdout before the command is sent to the target machine.
|
24
|
+
|
25
25
|
- Improvement: Computer app usage & mgmt data methods are now class methods, so can be used without instantiating the computer.
|
26
26
|
The instance methods remain, and they now just use the class methods.
|
27
27
|
|
28
|
-
- Improvement/Change: All handling of management history for Computers and MobileDevices is in the new ManagementHistory module.
|
28
|
+
- Improvement/Change: All handling of management history for Computers and MobileDevices is in the new ManagementHistory module. The module
|
29
|
+
is mixed into JSS::Computer and JSS::MobileDevice, so its methods are available to those classes and their instances. Note that some
|
30
|
+
history events are only available in Computers or MobileDevices, and some are available in both.
|
29
31
|
|
30
32
|
The primary query method (.management_history) returns the raw JSON data from the API, possibly for a subset of the data, as a Ruby Hash
|
31
|
-
with symbolized keys. This data is somewhat inconsistent in
|
33
|
+
with symbolized keys. This data is somewhat inconsistent in its structure and content across the different types of history events,
|
32
34
|
but you're welcome to use it if needed.
|
33
35
|
|
34
36
|
All other methods now return Arrays of various instances of classes defined in the module.
|
35
37
|
|
36
|
-
For example, the {JSS::
|
37
|
-
{JSS::
|
38
|
+
For example, the {JSS::MobileDevice.audit_history} method returns an Array of JSS::ManagementHistory::AuditEvent instances, and the
|
39
|
+
{JSS::Computer.completed_policies} gives an Array of JSS::ManagementHistory::PolicyLog objects. These objects are read-only and
|
38
40
|
provide access to their values via attribute-style methods.
|
39
41
|
|
40
42
|
As with MDM command handling, and computer app usage and mgmt data, the work is done by class methods, so that the data is available without creating instances of the Computers or MobileDevices, and the instance methods just
|
@@ -43,7 +45,11 @@
|
|
43
45
|
*WARNING* these changes mean that the methods returning Arrays of ManagementHistory class instances are not backward compatible,
|
44
46
|
since the earlier versions returned Hashes
|
45
47
|
|
46
|
-
## v 0.10.
|
48
|
+
## v 0.10.2, 2018-02-16
|
49
|
+
|
50
|
+
- *IMPORTANT BUG FIX*: Updating JSS::Extendable objects with no changes to ext. attribs will no longer erase all ext attrib values. (!)
|
51
|
+
|
52
|
+
## v 0.10.1, 2017-11-08
|
47
53
|
|
48
54
|
- Add: Extension Attribute values that are populated by Script or LDAP can now be modified via Extendable#set_ext_attr.
|
49
55
|
|
@@ -59,7 +65,7 @@
|
|
59
65
|
|
60
66
|
- Fix: A few lingering methods that weren't multi-APIConnection aware, are now aware
|
61
67
|
|
62
|
-
## v0.10.0 2017-10-09
|
68
|
+
## v0.10.0, 2017-10-09
|
63
69
|
|
64
70
|
- Improvement: Working with multiple APIConnections is now far more flexible!
|
65
71
|
|
@@ -90,7 +96,7 @@
|
|
90
96
|
|
91
97
|
- Add: Computer objects now have a `last_enrolled` attribute
|
92
98
|
|
93
|
-
## v0.9.3 2017-08-08
|
99
|
+
## v0.9.3, 2017-08-08
|
94
100
|
|
95
101
|
- Add: JSS::Computer instance now allow you to modify mac_address, alt_mac_address, udid, and serial_number.
|
96
102
|
Note: even tho the WebUI doesn't allow editing of the serial_number, the API does and doing so can be useful
|
@@ -99,11 +105,11 @@
|
|
99
105
|
- Add: JSS::Validate module, to consoliday generic data-validation methods. Methods will be moved to it from
|
100
106
|
other places over time.
|
101
107
|
|
102
|
-
## v0.9.2 2017-07-25
|
108
|
+
## v0.9.2, 2017-07-25
|
103
109
|
|
104
110
|
- Fix: parsing of JSS versions > 9.99
|
105
111
|
|
106
|
-
## v0.9.0 2017-07-17
|
112
|
+
## v0.9.0, 2017-07-17
|
107
113
|
|
108
114
|
- Add: JSS::MobileDevice.all_apple_tvs class method
|
109
115
|
- Add: JSS::MobileDevice.management_history method, and related methods in instances
|
@@ -135,17 +141,17 @@
|
|
135
141
|
- Improvement: JSS::Policy instances can now flush their logs
|
136
142
|
- Improvement: JSS::Policy now has setters for server_side_activation and server_side_expriation.
|
137
143
|
|
138
|
-
## v0.8.3 2017-06-07
|
144
|
+
## v0.8.3, 2017-06-07
|
139
145
|
|
140
146
|
- Fix: Version parsing: empty version parts default to 0, e.g. 10.2 parses as 10.2.0
|
141
147
|
|
142
|
-
## v0.8.2 2017-06-07
|
148
|
+
## v0.8.2, 2017-06-07
|
143
149
|
|
144
150
|
- Fix: Some objects failed to locate their 'main subset' (the chunk of API data that contains the object name and id) correctly.
|
145
151
|
- Fix: Some versions of Gem::Version don't like dashes (which are part of SemVers).
|
146
152
|
|
147
153
|
|
148
|
-
## v0.8.1 2017-06-05
|
154
|
+
## v0.8.1, 2017-06-05
|
149
155
|
|
150
156
|
- Improvement: Support for the new semantic versioning of Jamf products starting with Jamf Pro 9.99
|
151
157
|
- The alpha 'Webhooks framework' has been removed from ruby-jss and will reappear soon as it's own project with a new name.
|
@@ -153,7 +159,7 @@
|
|
153
159
|
- Improvement: JSS::APIObject and subclasses now have .fetch and .make class methods which are wrappers for .new. .fetch is the preferred way to retrieve instances of existing API objects, and .make for making not-yet-existing objects to be created in the JSS. The .new class method still works as before, but is considered deprecated.
|
154
160
|
- Improvement: JSS::APIConnection now has a #rest_url attribute that returns the base of the url for the current REST connection, e.g. "https://jamf.company.com:8443/JSSResource", or nil if not connected.
|
155
161
|
|
156
|
-
## v0.8.0 2017-04-07
|
162
|
+
## v0.8.0, 2017-04-07
|
157
163
|
|
158
164
|
- Change: Lots of code cleanup to follow RuboCop guidelines (more of this comming)
|
159
165
|
- Fix: sometimes the port would default to 80 rather than 8443
|
@@ -173,18 +179,18 @@
|
|
173
179
|
- Add: first attempts at adding SSL/TLS support to the Webhooks framework.
|
174
180
|
- NOTE: the Webhooks framework is still 'alpha' code, and will be moved into a separate git repo eventually. It doesn't rely on ruby-jss.
|
175
181
|
|
176
|
-
## v0.7.0 2017-02-01
|
182
|
+
## v0.7.0, 2017-02-01
|
177
183
|
|
178
184
|
- JSS::NetworkSegment - many bugfixes and cleanup. I didn't really have a proper grasp of IP CIDR masks before and how they (don't) relate to the IP ranges used by Network Segments in the JSS. The CIDRs and full netmasks can still be used to set the ending addresses of NetworkSegment objects, but the #cidr method is gone, since it was meaningless for segments that didn't match subnet-ranges.
|
179
185
|
- subnect-update, the example command in the bin directory, has been renamed to negseg-update. It's also been cleaned up and uses the new functionality of JSS::NetworkSegment.
|
180
186
|
- JSS::DBConnection - fixed a bug where meaningless IO 'stream closed' errors would appear when closing the DB connection.
|
181
187
|
|
182
|
-
## v0.6.7 2017-01-03
|
188
|
+
## v0.6.7, 2017-01-03
|
183
189
|
|
184
190
|
- Added class JSS::WebHook, which requires Jamf Pro 9.97 or higher.
|
185
191
|
- NOTE: This is access to the WebHooks themselves as defined in Jamf Pro, and is separate from the WebHook-handling framework included in the previous release for testing.
|
186
192
|
|
187
|
-
## v0.6.6 2016-11-30
|
193
|
+
## v0.6.6, 2016-11-30
|
188
194
|
|
189
195
|
- Added String#jss_to_pathname to convert Strings to Pathname instances in JSS::Configuration.
|
190
196
|
- JSS::DBConnection#connect now returns the server hostname, to match the behavior of JSS::APIConnection#connect
|
@@ -197,7 +203,7 @@
|
|
197
203
|
- Starting cleaning up code to better adhere to [RuboCop](http://rubocop.readthedocs.io/en/latest/) standards
|
198
204
|
- Added alpha version of a JSS WebHooks framwork
|
199
205
|
|
200
|
-
## v0.6.5 2016-08-10
|
206
|
+
## v0.6.5, 2016-08-10
|
201
207
|
|
202
208
|
- Cleanup of redundant constants (Thanks @aurica!)
|
203
209
|
- Added JSS::ComputerInvitation class (Thanks @tostart-pickagreatname!)
|
@@ -206,7 +212,7 @@
|
|
206
212
|
- JSS::Computer: added methods #boot_drive, #filevault2_enabled?, and #filevault1_accounts
|
207
213
|
- Various small bugfixes & improvements
|
208
214
|
|
209
|
-
## v0.6.4 2016-03-24
|
215
|
+
## v0.6.4, 2016-03-24
|
210
216
|
|
211
217
|
- JSS::Package#dlete can optionally delete the master file at the same time
|
212
218
|
- Added an example ruby-jss.conf file with internal documentation
|
@@ -214,11 +220,11 @@
|
|
214
220
|
- Updated the config file name to match the new gem name, maintaining backwards compatibility
|
215
221
|
- Improved error messages
|
216
222
|
|
217
|
-
## v0.6.3 2016-03-09
|
223
|
+
## v0.6.3, 2016-03-09
|
218
224
|
|
219
225
|
Maintenence version bump to fix an issue uploading to rubygems.org
|
220
226
|
|
221
|
-
## v0.6.2 2016-03-08
|
227
|
+
## v0.6.2, 2016-03-08
|
222
228
|
|
223
229
|
As of v0.6.2, the github project, and rubygem have been renamed to 'ruby-jss'. The 'require' name is now 'jss'.
|
224
230
|
|
@@ -239,14 +245,14 @@ The 'jss-api' gem has been updated one last time, also to v0.6.2. That gem has a
|
|
239
245
|
- JSS::Composer::mk_dmg fix for building/indexing dmg's, no longer creates an unreadable .Trashes folder.
|
240
246
|
- Several small typos and other tiny bugs.
|
241
247
|
|
242
|
-
## v0.6.1 2016-03-01
|
248
|
+
## v0.6.1, 2016-03-01
|
243
249
|
|
244
250
|
#### additions & features
|
245
251
|
|
246
252
|
- JSS::Package#install now takes :alt_download_url argument.Can be used to specify a custom URL from which to download a pkg/dmg for installation with 'jamf install'. This allows the use of cloud distribution points.
|
247
253
|
- JSS::DistributionPoint: Added reachability methods, improved assessment of mount-success. #reachable_for_download? and #reachable_for_upload? will now return a boolean indicating if the DistPoint is reachable.
|
248
254
|
|
249
|
-
## v0.6.0 2016-01-06
|
255
|
+
## v0.6.0, 2016-01-06
|
250
256
|
|
251
257
|
This version of the jss-api gem incorporates changes needed for the upcoming release of d3 (a.k.a. depot3),
|
252
258
|
a package/patch management system for Casper, which was the reason for the jss-api gem to begin with.
|
@@ -284,7 +290,7 @@ Now the actual install command is examined, and if its exitstatus is zero, Packa
|
|
284
290
|
Also: As of casper 9.72, the argument requirements havechanged for 'jamf install' with http downloads. This is now handled correctly
|
285
291
|
|
286
292
|
|
287
|
-
## v0.5.8 2015-09-22
|
293
|
+
## v0.5.8, 2015-09-22
|
288
294
|
|
289
295
|
#### bugfixes & cleanup
|
290
296
|
|
@@ -299,7 +305,7 @@ Also: As of casper 9.72, the argument requirements havechanged for 'jamf install
|
|
299
305
|
- TimeoutError and AuthenticationError have been added to exceptions
|
300
306
|
- Policy objects now have a #run method - attempts to execute the policy locally.
|
301
307
|
|
302
|
-
## v0.5.7 2015-05-26
|
308
|
+
## v0.5.7, 2015-05-26
|
303
309
|
|
304
310
|
#### bugfixes & cleanup
|
305
311
|
|
@@ -313,7 +319,7 @@ Also: As of casper 9.72, the argument requirements havechanged for 'jamf install
|
|
313
319
|
- Package#required_processor: remove buggy line of ancient, deprecated code
|
314
320
|
- Package#upload_master_file: move autoupdate to appropriate location
|
315
321
|
|
316
|
-
## v0.5.6 2014-11-04
|
322
|
+
## v0.5.6, 2014-11-04
|
317
323
|
|
318
324
|
- now requires Ruby >= 1.9.3 and rest-client >= 1.7.0. Needed for Casper >= 9.61's lack of support for SSLv3.
|
319
325
|
- APIConnection now accepts :ssl_version option in the argument hash. Defaults to 'TLSv1'
|
@@ -322,6 +328,6 @@ Also: As of casper 9.72, the argument requirements havechanged for 'jamf install
|
|
322
328
|
- many documentation updates as we adjust to being live
|
323
329
|
- minor bugfixes
|
324
330
|
|
325
|
-
## v0.5.0 2014-10-23
|
331
|
+
## v0.5.0, 2014-10-23
|
326
332
|
|
327
333
|
- first opensource release
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ruby-jss:
|
1
|
+
# ruby-jss: Working with the Jamf Pro API in Ruby
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/ruby-jss.svg)](http://badge.fury.io/rb/ruby-jss)
|
3
3
|
|
4
4
|
### Table of contents
|
@@ -29,14 +29,14 @@
|
|
29
29
|
|
30
30
|
The ruby-jss project provides a Ruby module called JSS, which is used for accessing the REST API of
|
31
31
|
the JAMF Software Server (JSS), the core of Jamf Pro, an enterprise-level management tool for Apple
|
32
|
-
devices from [
|
32
|
+
devices from [Jamf.com](http://www.jamf.com/). It is available as a
|
33
33
|
[rubygem](https://rubygems.org/gems/ruby-jss), and the
|
34
34
|
[source is on github](https://github.com/PixarAnimationStudios/ruby-jss).
|
35
35
|
|
36
36
|
The module abstracts API resources as Ruby objects, and provides methods for interacting with those
|
37
37
|
resources. It also provides some features that aren't a part of the API itself, but come with other
|
38
38
|
Jamf-related tools, such as uploading .pkg and .dmg {JSS::Package} data to the master distribution
|
39
|
-
point, and the installation of {JSS::Package} objects on client machines. (See [BEYOND THE API](#beyond-the-api)
|
39
|
+
point, and the installation of {JSS::Package} objects on client machines. (See [BEYOND THE API](#beyond-the-api))
|
40
40
|
|
41
41
|
The module is not a complete implementation of the Jamf API. Only some API objects are modeled, some
|
42
42
|
only minimally. Of those, some are read-only, some partially writable, some fully read-write (all
|
@@ -50,6 +50,8 @@ Hopefully others will find it useful, and add more to it as well.
|
|
50
50
|
|
51
51
|
## SYNOPSIS
|
52
52
|
|
53
|
+
Here are some simple examples of using ruby-jss
|
54
|
+
|
53
55
|
```ruby
|
54
56
|
require 'ruby-jss'
|
55
57
|
|
@@ -100,13 +102,13 @@ Before you can work with JSS Objects via the API, you have to connect to it.
|
|
100
102
|
|
101
103
|
The method `JSS.api` retruns the currently active connection to the API (an instance of a {JSS::APIConnection}, q.v.).
|
102
104
|
|
103
|
-
When the JSS Module is first loaded, that connection isn't connected. To remedy that, use JSS.api.connect
|
105
|
+
When the JSS Module is first loaded, that connection object isn't connected to anything. To remedy that, use `JSS.api.connect`, passing it values for the connection. In this example, those values are stored in the local variables jss_user, jss_user_pw, and jss_server_hostname, and others are left as default.
|
104
106
|
|
105
107
|
```ruby
|
106
108
|
JSS.api.connect user: jss_user, pw: jss_user_pw, server: jss_server_hostname
|
107
109
|
```
|
108
110
|
|
109
|
-
Make sure the user has privileges in the JSS to do things with desired
|
111
|
+
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.
|
110
112
|
|
111
113
|
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.
|
112
114
|
|
@@ -118,7 +120,7 @@ server connection parameters in a simple config file.
|
|
118
120
|
|
119
121
|
### Working with JSS Objects (a.k.a REST Resources)
|
120
122
|
|
121
|
-
All
|
123
|
+
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.
|
122
124
|
|
123
125
|
--------
|
124
126
|
|
@@ -138,14 +140,13 @@ JSS::Computer.all_names # => ["cephei", "peterparker", "rowdy", ...]
|
|
138
140
|
JSS::Computer.all_ids # => [1122, 1218, 931, ...]
|
139
141
|
```
|
140
142
|
|
141
|
-
Some Classes provide other ways to list objects, depending on the data available, e.g. JSS::MobileDevice.all\_udids
|
143
|
+
Some Classes provide other ways to list objects, depending on the data available, e.g. JSS::MobileDevice.all\_udids or JSS::Computer.all\_laptops
|
142
144
|
|
143
145
|
--------
|
144
146
|
|
145
147
|
#### Retrieving Objects
|
146
148
|
|
147
|
-
To retrieve a single object call the class's
|
148
|
-
lookup attribute.
|
149
|
+
To retrieve a single object call the class's `.fetch` method and provide a name:, id:, or other valid identfier.
|
149
150
|
|
150
151
|
|
151
152
|
```ruby
|
@@ -154,14 +155,16 @@ a_dept = JSS::Department.fetch name: 'Payroll'# => #<JSS::Department:0x10b4c081
|
|
154
155
|
|
155
156
|
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.
|
156
157
|
|
157
|
-
|
158
|
-
|
158
|
+
You can even fetch objects without specifying the kind of identifier, e.g. `JSS::Computer.fetch 3241`, but this will be slower, since ruby-jss searches by matching the given value with all available identifiers, returning the first match.
|
159
|
+
|
160
|
+
*NOTE*: A class's '.fetch' method is now the preferred method to use for retrieving existing objects.
|
161
|
+
The '.new' method still works as before, but is deprecated for object retrieval and doing so may raise errors in the future. See below for using .make to create new objects in the JSS.
|
159
162
|
|
160
163
|
--------
|
161
164
|
|
162
165
|
#### Creating Objects
|
163
166
|
|
164
|
-
Some Objects can be created anew in the JSS via ruby. To do so, first make a Ruby object using the class's
|
167
|
+
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.
|
165
168
|
|
166
169
|
```ruby
|
167
170
|
new_pkg = JSS::Package.make name: "transmogrifier-2.3-1.pkg"
|
@@ -217,13 +220,15 @@ To delete an object without fetching it, use the class's .delete method and prov
|
|
217
220
|
JSS::Script.delete [321, 543, 374]
|
218
221
|
```
|
219
222
|
|
220
|
-
See JSS::APIObject, the parent class of all API resources, for general information about creating, reading, updating/saving, and deleting resources.
|
223
|
+
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.
|
221
224
|
|
222
225
|
See the individual subclasses for any details specific to them.
|
223
226
|
|
224
227
|
## OBJECTS IMPLEMENTED
|
225
228
|
|
226
|
-
|
229
|
+
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.
|
230
|
+
|
231
|
+
Here's what we've implemented so far. See each Class's [documentation(http://www.rubydoc.info/gems/ruby-jss)] for details.
|
227
232
|
|
228
233
|
### Creatable and Updatable
|
229
234
|
|
@@ -250,34 +255,15 @@ See each Class's documentation for details.
|
|
250
255
|
* {JSS::UserExtensionAttribute}
|
251
256
|
* {JSS::UserGroup}
|
252
257
|
* {JSS::WebHook}
|
258
|
+
* {JSS::Computer}
|
259
|
+
* {JSS::MobileDevice}
|
260
|
+
* {JSS::Policy} (still not fully implemented)
|
253
261
|
|
254
|
-
|
255
|
-
|
256
|
-
* {JSS::Computer} - limited to modifying
|
257
|
-
* name
|
258
|
-
* barcodes
|
259
|
-
* asset tag
|
260
|
-
* ip address
|
261
|
-
* location data
|
262
|
-
* purchasing data
|
263
|
-
* editable extension attributes
|
264
|
-
* {JSS::MobileDevice} - limited to modifying
|
265
|
-
* asset tag
|
266
|
-
* location data
|
267
|
-
* purchasing data
|
268
|
-
* editable extension attributes
|
269
|
-
* {JSS::Policy} - limited to modifying
|
270
|
-
* scope (see {JSS::Scopable::Scope})
|
271
|
-
* name
|
272
|
-
* enabled
|
273
|
-
* category
|
274
|
-
* triggers
|
275
|
-
* packages
|
276
|
-
* scripts
|
277
|
-
* file & process actions
|
278
|
-
* {JSS::OSXConfigurationProfile}
|
262
|
+
**NOTE** Computer and Mobile Device data gathered by an Inventory Upate (a.k.a. 'recon') is not editable.
|
279
263
|
|
280
|
-
|
264
|
+
### Updatable, but must be created in the Web UI
|
265
|
+
|
266
|
+
* {JSS::OSXConfigurationProfile}
|
281
267
|
|
282
268
|
### Creatable only
|
283
269
|
|
@@ -296,19 +282,21 @@ These must be created and edited via the JSS WebApp
|
|
296
282
|
|
297
283
|
All supported API Objects can be deleted
|
298
284
|
|
299
|
-
Other useful classes:
|
285
|
+
Other useful classes & modules:
|
300
286
|
|
301
287
|
* {JSS::APIConnection} - An object representing the connection to the REST API
|
302
|
-
* {JSS::DBConnection} - An object representing the connection to MySQL database, if used
|
288
|
+
* {JSS::DBConnection} - An object representing the connection to MySQL database, if used.
|
303
289
|
* {JSS::Server} - An encapsulation of some info about the JamfPro server, such as the version and license. An instance is available as an attribute of the {JSS::APIConnection} singleton.
|
304
290
|
* {JSS::Client} - An object representing the local machine as a Casper-managed client, and JAMF-related info and methods
|
305
|
-
|
291
|
+
* {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.
|
292
|
+
* {JSS::Scopable} - a module that handles Scope for those objects that can be scoped. It defines the Scope class used in those objects.
|
293
|
+
* {JSS::MDM} - a module that handles sending MDM commands to Computers and Mobile Devices
|
306
294
|
|
307
295
|
## CONFIGURATION
|
308
296
|
|
309
|
-
The {JSS::Configuration} singleton class is used to read, write, and use site-specific defaults for the JSS module. When
|
297
|
+
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.
|
310
298
|
|
311
|
-
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::
|
299
|
+
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.
|
312
300
|
|
313
301
|
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:
|
314
302
|
|
@@ -325,7 +313,7 @@ The currently known attributes are:
|
|
325
313
|
* api_timeout_open [Integer] the number of seconds for the open-connection timeout
|
326
314
|
* api_timeout [Integer] the number of seconds for the response timeout
|
327
315
|
|
328
|
-
To put a standard server & username on all client machines, and auto-accept the JSS's self-signed https certificate, create the file /etc/
|
316
|
+
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:
|
329
317
|
|
330
318
|
```
|
331
319
|
api_server_name: casper.myschool.edu
|
@@ -413,13 +401,13 @@ In general, you can install ruby-jss with this command:
|
|
413
401
|
|
414
402
|
Full documentation is available at [rubydoc.info](http://www.rubydoc.info/gems/ruby-jss/)
|
415
403
|
|
416
|
-
[Email the
|
404
|
+
[Email the developers](mailto:ruby-jss@pixar.com)
|
417
405
|
|
418
406
|
[Macadmins Slack Channel](https://macadmins.slack.com/messages/#jss-api/)
|
419
407
|
|
420
408
|
## LICENSE
|
421
409
|
|
422
|
-
Copyright
|
410
|
+
Copyright 2018 Pixar
|
423
411
|
|
424
412
|
Licensed under the Apache License, Version 2.0 (the "Apache License") with
|
425
413
|
modifications. See LICENSE.txt for details
|
data/bin/cgrouper
CHANGED
data/bin/jamfHelperBackgrounder
CHANGED