ruby-jss 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +29 -22
- data/README.md +66 -86
- data/bin/jamfHelperBackgrounder +148 -0
- data/bin/netseg-update +0 -1
- data/lib/jss.rb +20 -9
- data/lib/jss/api_connection.rb +369 -295
- data/lib/jss/api_object.rb +651 -418
- data/lib/jss/api_object/account.rb +69 -77
- data/lib/jss/api_object/advanced_search.rb +201 -236
- data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +42 -42
- data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +33 -43
- data/lib/jss/api_object/advanced_search/advanced_user_search.rb +33 -43
- data/lib/jss/api_object/building.rb +39 -52
- data/lib/jss/api_object/categorizable.rb +221 -0
- data/lib/jss/api_object/category.rb +81 -89
- data/lib/jss/api_object/computer.rb +486 -525
- data/lib/jss/api_object/computer_invitation.rb +73 -86
- data/lib/jss/api_object/criteriable.rb +6 -7
- data/lib/jss/api_object/ebook.rb +21 -0
- data/lib/jss/api_object/extendable.rb +6 -8
- data/lib/jss/api_object/group.rb +0 -3
- data/lib/jss/api_object/locatable.rb +19 -20
- data/lib/jss/api_object/mac_application.rb +21 -0
- data/lib/jss/api_object/mobile_device.rb +30 -21
- data/lib/jss/api_object/mobile_device_application.rb +447 -0
- data/lib/jss/api_object/mobile_device_configuration_profile.rb +21 -0
- data/lib/jss/api_object/osx_configuration_profile.rb +0 -3
- data/lib/jss/api_object/package.rb +21 -34
- data/lib/jss/api_object/peripheral.rb +16 -18
- data/lib/jss/api_object/policy.rb +5 -83
- data/lib/jss/api_object/purchasable.rb +11 -13
- data/lib/jss/api_object/scopable.rb +11 -12
- data/lib/jss/api_object/script.rb +3 -17
- data/lib/jss/api_object/self_servable.rb +419 -205
- data/lib/jss/api_object/self_servable/icon.rb +179 -0
- data/lib/jss/api_object/updatable.rb +35 -34
- data/lib/jss/api_object/uploadable.rb +72 -70
- data/lib/jss/api_object/user.rb +6 -7
- data/lib/jss/api_object/vppable.rb +117 -0
- data/lib/jss/client.rb +264 -225
- data/lib/jss/db_connection.rb +7 -5
- data/lib/jss/exceptions.rb +50 -42
- data/lib/jss/ruby_extensions.rb +8 -7
- data/lib/jss/ruby_extensions/object.rb +19 -0
- data/lib/jss/utility.rb +82 -40
- data/lib/jss/version.rb +1 -1
- metadata +37 -68
- data/bin/jss-webhook-server +0 -3
- data/lib/jss/webhooks.rb +0 -53
- data/lib/jss/webhooks/README.md +0 -269
- data/lib/jss/webhooks/configuration.rb +0 -213
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation-executable +0 -91
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation.rb +0 -45
- data/lib/jss/webhooks/data/sample_jsons/ComputerAdded.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerCheckIn.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerInventoryCompleted.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerPolicyFinished.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerPushCapabilityChanged.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/JSSShutdown.json +0 -14
- data/lib/jss/webhooks/data/sample_jsons/JSSStartup.json +0 -14
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCheckIn.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCommandCompleted.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceEnrolled.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDevicePushSent.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceUnEnrolled.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/PatchSoftwareTitleUpdated.json +0 -14
- data/lib/jss/webhooks/data/sample_jsons/PushSent.json +0 -11
- data/lib/jss/webhooks/data/sample_jsons/RestAPIOperation.json +0 -15
- data/lib/jss/webhooks/data/sample_jsons/SCEPChallenge.json +0 -10
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupComputerMembershipChange.json +0 -13
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupMobileDeviceMembershipChange.json +0 -13
- data/lib/jss/webhooks/event.rb +0 -139
- data/lib/jss/webhooks/event/computer_added.rb +0 -38
- data/lib/jss/webhooks/event/computer_check_in.rb +0 -38
- data/lib/jss/webhooks/event/computer_inventory_completed.rb +0 -38
- data/lib/jss/webhooks/event/computer_policy_finished.rb +0 -38
- data/lib/jss/webhooks/event/computer_push_capability_changed.rb +0 -38
- data/lib/jss/webhooks/event/handlers.rb +0 -192
- data/lib/jss/webhooks/event/jss_shutdown.rb +0 -38
- data/lib/jss/webhooks/event/jss_startup.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_check_in.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_command_completed.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_enrolled.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_push_sent.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_unenrolled.rb +0 -38
- data/lib/jss/webhooks/event/patch_software_title_updated.rb +0 -38
- data/lib/jss/webhooks/event/push_sent.rb +0 -38
- data/lib/jss/webhooks/event/rest_api_operation.rb +0 -38
- data/lib/jss/webhooks/event/scep_challenge.rb +0 -38
- data/lib/jss/webhooks/event/smart_group_computer_membership_change.rb +0 -38
- data/lib/jss/webhooks/event/smart_group_mobile_device_membership_change.rb +0 -38
- data/lib/jss/webhooks/event/webhook.rb +0 -40
- data/lib/jss/webhooks/event_objects.rb +0 -112
- data/lib/jss/webhooks/event_objects/computer.rb +0 -49
- data/lib/jss/webhooks/event_objects/jss.rb +0 -36
- data/lib/jss/webhooks/event_objects/mobile_device.rb +0 -48
- data/lib/jss/webhooks/event_objects/patch_software_title_update.rb +0 -38
- data/lib/jss/webhooks/event_objects/push.rb +0 -33
- data/lib/jss/webhooks/event_objects/rest_api_operation.rb +0 -37
- data/lib/jss/webhooks/event_objects/scep_challenge.rb +0 -32
- data/lib/jss/webhooks/event_objects/smart_group.rb +0 -35
- data/lib/jss/webhooks/server_app.rb +0 -37
- data/lib/jss/webhooks/server_app/routes.rb +0 -27
- data/lib/jss/webhooks/server_app/routes/handle_webhook_event.rb +0 -39
- data/lib/jss/webhooks/server_app/routes/home.rb +0 -37
- data/lib/jss/webhooks/server_app/self_signed_cert.rb +0 -65
- data/lib/jss/webhooks/server_app/server.rb +0 -60
- data/lib/jss/webhooks/version.rb +0 -32
data/lib/jss/db_connection.rb
CHANGED
|
@@ -141,6 +141,12 @@ module JSS
|
|
|
141
141
|
### @return [true] the connection was successfully made.
|
|
142
142
|
###
|
|
143
143
|
def connect(args = {})
|
|
144
|
+
begin
|
|
145
|
+
disconnect if @connected
|
|
146
|
+
rescue Mysql::ClientError::ServerGoneError
|
|
147
|
+
@connected = false
|
|
148
|
+
end
|
|
149
|
+
|
|
144
150
|
# server might come frome several places
|
|
145
151
|
# if not given in the args, use #hostname to figure out
|
|
146
152
|
# which
|
|
@@ -161,11 +167,7 @@ module JSS
|
|
|
161
167
|
args[:read_timeout] ||= args[:timeout] ? args[:timeout] : DFT_TIMEOUT
|
|
162
168
|
args[:write_timeout] ||= args[:timeout] ? args[:timeout] : DFT_TIMEOUT
|
|
163
169
|
|
|
164
|
-
|
|
165
|
-
@mysql.close if connected?
|
|
166
|
-
rescue Mysql::ClientError::ServerGoneError
|
|
167
|
-
@connected = false
|
|
168
|
-
end
|
|
170
|
+
|
|
169
171
|
|
|
170
172
|
@port = args[:port]
|
|
171
173
|
@socket = args[:socket]
|
data/lib/jss/exceptions.rb
CHANGED
|
@@ -1,96 +1,104 @@
|
|
|
1
1
|
### Copyright 2017 Pixar
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
###
|
|
4
4
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
5
5
|
### with the following modification; you may not use this file except in
|
|
6
6
|
### compliance with the Apache License and the following modification to it:
|
|
7
7
|
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
8
|
+
###
|
|
9
9
|
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
10
|
### names, trademarks, service marks, or product names of the Licensor
|
|
11
11
|
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
12
|
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
13
|
+
###
|
|
14
14
|
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
15
|
+
###
|
|
16
16
|
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
17
|
+
###
|
|
18
18
|
### Unless required by applicable law or agreed to in writing, software
|
|
19
19
|
### distributed under the Apache License with the above modification is
|
|
20
20
|
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
21
|
### KIND, either express or implied. See the Apache License for the specific
|
|
22
22
|
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
23
|
+
###
|
|
24
24
|
###
|
|
25
25
|
|
|
26
26
|
###
|
|
27
27
|
module JSS
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
#####################################
|
|
30
30
|
### Exceptions
|
|
31
31
|
#####################################
|
|
32
|
-
|
|
33
|
-
###
|
|
34
|
-
### MissingDataError - raise this error when we
|
|
32
|
+
|
|
33
|
+
###
|
|
34
|
+
### MissingDataError - raise this error when we
|
|
35
35
|
### are missing args, or other simliar stuff.
|
|
36
|
-
###
|
|
36
|
+
###
|
|
37
37
|
class MissingDataError < RuntimeError; end
|
|
38
|
-
|
|
39
|
-
###
|
|
40
|
-
### InvalidDataError - raise this error when
|
|
38
|
+
|
|
39
|
+
###
|
|
40
|
+
### InvalidDataError - raise this error when
|
|
41
41
|
### a data item isn't what we expected.
|
|
42
|
-
###
|
|
42
|
+
###
|
|
43
43
|
class InvalidDataError < RuntimeError; end
|
|
44
|
-
|
|
45
|
-
###
|
|
46
|
-
### InvalidConnectionError - raise this error when we
|
|
44
|
+
|
|
45
|
+
###
|
|
46
|
+
### InvalidConnectionError - raise this error when we
|
|
47
47
|
### don't have a usable connection to a network service, or
|
|
48
48
|
### don't have proper authentication/authorization.
|
|
49
|
-
###
|
|
49
|
+
###
|
|
50
50
|
class InvalidConnectionError < RuntimeError; end
|
|
51
|
-
|
|
52
|
-
###
|
|
53
|
-
### NoSuchItemError - raise this error when
|
|
51
|
+
|
|
52
|
+
###
|
|
53
|
+
### NoSuchItemError - raise this error when
|
|
54
54
|
### a desired item doesn't exist.
|
|
55
|
-
###
|
|
55
|
+
###
|
|
56
56
|
class NoSuchItemError < RuntimeError; end
|
|
57
|
-
|
|
58
|
-
###
|
|
59
|
-
### AlreadyExistsError - raise this error when
|
|
57
|
+
|
|
58
|
+
###
|
|
59
|
+
### AlreadyExistsError - raise this error when
|
|
60
60
|
### trying to create something that already exists.
|
|
61
|
-
###
|
|
61
|
+
###
|
|
62
62
|
class AlreadyExistsError < RuntimeError; end
|
|
63
|
-
|
|
64
|
-
###
|
|
65
|
-
### FileServiceError - raise this error when
|
|
63
|
+
|
|
64
|
+
###
|
|
65
|
+
### FileServiceError - raise this error when
|
|
66
66
|
### there's a problem accessing file service on a
|
|
67
67
|
### distribution point.
|
|
68
|
-
###
|
|
68
|
+
###
|
|
69
69
|
class FileServiceError < RuntimeError; end
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
###
|
|
72
|
-
### UnmanagedError - raise this when we
|
|
73
|
-
### try to do something managerial to
|
|
72
|
+
### UnmanagedError - raise this when we
|
|
73
|
+
### try to do something managerial to
|
|
74
74
|
### an unmanaged object
|
|
75
75
|
###
|
|
76
76
|
class UnmanagedError < RuntimeError; end
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
###
|
|
79
|
-
### UnsupportedError - raise this when we
|
|
79
|
+
### UnsupportedError - raise this when we
|
|
80
80
|
### try to do something not yet supported
|
|
81
81
|
###
|
|
82
82
|
class UnsupportedError < RuntimeError; end
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
###
|
|
85
|
-
### TimeoutError - raise this when we
|
|
85
|
+
### TimeoutError - raise this when we
|
|
86
86
|
### try to do and it times out
|
|
87
87
|
###
|
|
88
88
|
class TimeoutError < RuntimeError; end
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
###
|
|
91
|
-
### AuthenticationError - raise this when
|
|
91
|
+
### AuthenticationError - raise this when
|
|
92
92
|
### a name/pw are wrong
|
|
93
93
|
###
|
|
94
94
|
class AuthenticationError < RuntimeError; end
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
|
|
96
|
+
###
|
|
97
|
+
### ConflictError - raise this when
|
|
98
|
+
### attempts to PUT or PUSH to the API
|
|
99
|
+
### result in a 409 Conflict http error.
|
|
100
|
+
### See JSS::APIConnect.instance.raise_conflict_error
|
|
101
|
+
###
|
|
102
|
+
class ConflictError < RuntimeError; end
|
|
103
|
+
|
|
104
|
+
end # module JSS
|
data/lib/jss/ruby_extensions.rb
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
### Copyright 2017 Pixar
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
###
|
|
4
4
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
5
5
|
### with the following modification; you may not use this file except in
|
|
6
6
|
### compliance with the Apache License and the following modification to it:
|
|
7
7
|
### Section 6. Trademarks. is deleted and replaced with:
|
|
8
|
-
###
|
|
8
|
+
###
|
|
9
9
|
### 6. Trademarks. This License does not grant permission to use the trade
|
|
10
10
|
### names, trademarks, service marks, or product names of the Licensor
|
|
11
11
|
### and its affiliates, except as required to comply with Section 4(c) of
|
|
12
12
|
### the License and to reproduce the content of the NOTICE file.
|
|
13
|
-
###
|
|
13
|
+
###
|
|
14
14
|
### You may obtain a copy of the Apache License at
|
|
15
|
-
###
|
|
15
|
+
###
|
|
16
16
|
### http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
###
|
|
17
|
+
###
|
|
18
18
|
### Unless required by applicable law or agreed to in writing, software
|
|
19
19
|
### distributed under the Apache License with the above modification is
|
|
20
20
|
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
21
|
### KIND, either express or implied. See the Apache License for the specific
|
|
22
22
|
### language governing permissions and limitations under the Apache License.
|
|
23
|
-
###
|
|
23
|
+
###
|
|
24
24
|
###
|
|
25
25
|
|
|
26
|
-
### All monkey-patched convenience methods are either prefixed with "jss_" or
|
|
26
|
+
### All monkey-patched convenience methods are either prefixed with "jss_" or
|
|
27
27
|
### if they are type coercions, "to_jss_"
|
|
28
28
|
###
|
|
29
29
|
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
require "jss/ruby_extensions/filetest.rb"
|
|
32
32
|
require "jss/ruby_extensions/hash.rb"
|
|
33
33
|
require "jss/ruby_extensions/ipaddr.rb"
|
|
34
|
+
require "jss/ruby_extensions/object.rb"
|
|
34
35
|
require "jss/ruby_extensions/pathname.rb"
|
|
35
36
|
require "jss/ruby_extensions/time.rb"
|
|
36
37
|
require "jss/ruby_extensions/string.rb"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Extensions to Ruby Objects for use within the JSS module
|
|
2
|
+
class Object
|
|
3
|
+
|
|
4
|
+
# is an object an explict true or false?
|
|
5
|
+
#
|
|
6
|
+
# TODO: globally replace
|
|
7
|
+
# `JSS::TRUE_FALSE.include? xxx`
|
|
8
|
+
# with
|
|
9
|
+
# `xxx.jss_boolean?`
|
|
10
|
+
#
|
|
11
|
+
#
|
|
12
|
+
# @return [Boolean]
|
|
13
|
+
#
|
|
14
|
+
def jss_boolean?
|
|
15
|
+
[true, false].include? self
|
|
16
|
+
end
|
|
17
|
+
alias jss_bool? jss_boolean?
|
|
18
|
+
|
|
19
|
+
end
|
data/lib/jss/utility.rb
CHANGED
|
@@ -376,62 +376,104 @@ module JSS
|
|
|
376
376
|
xml_list
|
|
377
377
|
end
|
|
378
378
|
|
|
379
|
-
### Parse a JSS Version number into something comparable
|
|
379
|
+
### Parse a JSS Version number into something comparable.
|
|
380
380
|
###
|
|
381
|
-
###
|
|
382
|
-
### Version 9.32 should be version 9.3.2, so that it
|
|
383
|
-
### will be recognizable as being less than 9.4
|
|
381
|
+
### With Jamf Pro 9.99, "Semantic Versioning" is used, see http://semver.org/
|
|
384
382
|
###
|
|
385
|
-
###
|
|
386
|
-
###
|
|
387
|
-
###
|
|
388
|
-
###
|
|
383
|
+
### For versions less than 9.99 parsing is like this:
|
|
384
|
+
### - Digits before the first dot are the Major Version
|
|
385
|
+
### - The first digit after the first dot is the Minor Version
|
|
386
|
+
### - Any other digits after the first dot but before a non-digit
|
|
387
|
+
### are the Revision
|
|
388
|
+
### - Anything after a second dot is the build identifier
|
|
389
|
+
### - Any non-digit anywhere means that it and everything after it
|
|
390
|
+
### are the build identifier
|
|
389
391
|
###
|
|
390
|
-
###
|
|
391
|
-
###
|
|
392
|
-
### and 9.
|
|
393
|
-
### and 9.
|
|
392
|
+
### So 9.32 becomes major-9, minor-3, rev-2, build-''
|
|
393
|
+
### and 9.32.3764 becomes major-9, minor-3, rev-2, build-3764
|
|
394
|
+
### and 9.32a3764 becomes major-9, minor-3, rev-2, build-a3764
|
|
395
|
+
### and 9.32a1234.t234 becomes major-9, minor-3, rev-2, build-a1234.t234
|
|
394
396
|
###
|
|
395
|
-
### This method of parsing will break if the
|
|
396
|
-
### ever gets above
|
|
397
|
+
### This old style method of parsing will break if digits between the first
|
|
398
|
+
### dot and the second (or the end) ever gets above 99, since '100' will
|
|
399
|
+
### become minor-1, rev-0
|
|
397
400
|
###
|
|
398
|
-
###
|
|
401
|
+
### This method returns a Hash with these keys:
|
|
399
402
|
### * :major => the major version, Integer
|
|
400
403
|
### * :minor => the minor version, Integor
|
|
401
|
-
### * :
|
|
402
|
-
###
|
|
404
|
+
### * :maint => the revision, Integer
|
|
405
|
+
### (this is also available with the keys :patch and :revision)
|
|
406
|
+
### * :build => the revision, String
|
|
407
|
+
### * :version => a Gem::Version object built from :major, :minor, :revision
|
|
408
|
+
### which can be easily compared with other Gem::Version objects.
|
|
403
409
|
###
|
|
404
410
|
### @param version[String] a JSS version number from the API
|
|
405
411
|
###
|
|
406
412
|
### @return [Hash{Symbol => String, Gem::Version}] the parsed version data.
|
|
407
413
|
###
|
|
408
414
|
def self.parse_jss_version(version)
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
major = spl[0].to_i
|
|
418
|
-
minor = spl[1][0,1].to_i
|
|
419
|
-
revision = spl[1][1..-1]
|
|
420
|
-
revision = '0' if revision.empty?
|
|
421
|
-
else
|
|
422
|
-
major = spl[0].to_i
|
|
423
|
-
minor = spl[1][0,1].to_i
|
|
424
|
-
revision = spl[1..-1].join('.')[1..-1]
|
|
425
|
-
revision = revision[1..-1] if revision.start_with? '.'
|
|
415
|
+
major, second_part, *_rest = version.split('.')
|
|
416
|
+
raise JSS::InvalidDataError, 'JSS Versions must start with "x.x" where x is one or more digits' unless major =~ /\d$/ && second_part =~ /^\d/
|
|
417
|
+
|
|
418
|
+
# since ruby-jss requires 9.4 and up, this check works fine.
|
|
419
|
+
if major == '9' && !second_part.start_with?('99')
|
|
420
|
+
parse_jss_version_oldstyle version
|
|
421
|
+
else
|
|
422
|
+
parse_jss_version_newstyle version
|
|
426
423
|
end
|
|
424
|
+
end
|
|
427
425
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
426
|
+
# (see parse_jss_version)
|
|
427
|
+
def self.parse_jss_version_newstyle(version)
|
|
428
|
+
release, build = version.split '-'
|
|
429
|
+
major, minor, revision = release.split '.'
|
|
430
|
+
{
|
|
431
|
+
major: major.to_i,
|
|
432
|
+
minor: minor.to_i,
|
|
433
|
+
revision: revision.to_i,
|
|
434
|
+
maint: revision.to_i,
|
|
435
|
+
patch: revision.to_i,
|
|
436
|
+
build: build,
|
|
437
|
+
version: Gem::Version.new(version)
|
|
433
438
|
}
|
|
434
|
-
end
|
|
439
|
+
end # parse_jss_version_oldstyle
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
# (see parse_jss_version)
|
|
443
|
+
def self.parse_jss_version_oldstyle(version)
|
|
444
|
+
version =~ /^(\d+?)\.(.*)$/
|
|
445
|
+
major = Regexp.last_match[1]
|
|
446
|
+
second_part = Regexp.last_match[2].to_s
|
|
447
|
+
|
|
448
|
+
minor = second_part[0]
|
|
449
|
+
revision = second_part[1..-1]
|
|
450
|
+
|
|
451
|
+
# if there's a non-digit anywhere in any part, it and everything after
|
|
452
|
+
# is the build.
|
|
453
|
+
if revision.to_s =~ /^(\d*)(\D.*)$/
|
|
454
|
+
revision = Regexp.last_match[1]
|
|
455
|
+
build = Regexp.last_match[2]
|
|
456
|
+
# but remove a leading dot
|
|
457
|
+
build = build[1..-1] if build.start_with? '.'
|
|
458
|
+
end
|
|
459
|
+
minor ||= ''
|
|
460
|
+
revision ||= ''
|
|
461
|
+
|
|
462
|
+
version_string = major.to_s
|
|
463
|
+
unless minor.empty?
|
|
464
|
+
version_string << ".#{minor}"
|
|
465
|
+
version_string << ".#{revision}" unless revision.empty?
|
|
466
|
+
end
|
|
467
|
+
{
|
|
468
|
+
major: major.to_i,
|
|
469
|
+
minor: minor.to_i,
|
|
470
|
+
revision: revision.to_i,
|
|
471
|
+
maint: revision.to_i,
|
|
472
|
+
patch: revision.to_i,
|
|
473
|
+
build: build.to_s,
|
|
474
|
+
version: Gem::Version.new(version_string)
|
|
475
|
+
}
|
|
476
|
+
end # parse_jss_version_oldstyle
|
|
435
477
|
|
|
436
478
|
### @return [Boolean] is this code running as root?
|
|
437
479
|
###
|
data/lib/jss/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-jss
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Lasell
|
|
8
|
+
- Aurica Hayes
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
12
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: plist
|
|
@@ -78,17 +79,37 @@ dependencies:
|
|
|
78
79
|
- - "~>"
|
|
79
80
|
- !ruby/object:Gem::Version
|
|
80
81
|
version: '0.8'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: immutable-struct
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '2.2'
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: 2.2.2
|
|
92
|
+
type: :runtime
|
|
93
|
+
prerelease: false
|
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - "~>"
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '2.2'
|
|
99
|
+
- - ">="
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: 2.2.2
|
|
81
102
|
description: |2
|
|
82
103
|
The ruby-jss gem provides the JSS module, a framework for interacting with the REST API
|
|
83
|
-
of the
|
|
84
|
-
tool for managing Apple devices, from
|
|
104
|
+
of the Jamf Software Server (JSS), the core of Jamf Pro, an enterprise/education
|
|
105
|
+
tool for managing Apple devices, from Jamf Software LLC.
|
|
85
106
|
JSS API objects are implemented as Ruby classes, and interact with each oher to
|
|
86
|
-
allow simpler automation of
|
|
107
|
+
allow simpler automation of Jamf-related tasks. For details see the README file."
|
|
87
108
|
email: ruby-jss@pixar.com
|
|
88
109
|
executables:
|
|
89
110
|
- cgrouper
|
|
90
111
|
- netseg-update
|
|
91
|
-
-
|
|
112
|
+
- jamfHelperBackgrounder
|
|
92
113
|
extensions: []
|
|
93
114
|
extra_rdoc_files:
|
|
94
115
|
- README.md
|
|
@@ -102,7 +123,7 @@ files:
|
|
|
102
123
|
- README.md
|
|
103
124
|
- THANKS.md
|
|
104
125
|
- bin/cgrouper
|
|
105
|
-
- bin/
|
|
126
|
+
- bin/jamfHelperBackgrounder
|
|
106
127
|
- bin/netseg-update
|
|
107
128
|
- data/ruby-jss.conf.example
|
|
108
129
|
- lib/jss-api.rb
|
|
@@ -115,6 +136,7 @@ files:
|
|
|
115
136
|
- lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb
|
|
116
137
|
- lib/jss/api_object/advanced_search/advanced_user_search.rb
|
|
117
138
|
- lib/jss/api_object/building.rb
|
|
139
|
+
- lib/jss/api_object/categorizable.rb
|
|
118
140
|
- lib/jss/api_object/category.rb
|
|
119
141
|
- lib/jss/api_object/computer.rb
|
|
120
142
|
- lib/jss/api_object/computer_invitation.rb
|
|
@@ -124,6 +146,7 @@ files:
|
|
|
124
146
|
- lib/jss/api_object/criteriable/criterion.rb
|
|
125
147
|
- lib/jss/api_object/department.rb
|
|
126
148
|
- lib/jss/api_object/distribution_point.rb
|
|
149
|
+
- lib/jss/api_object/ebook.rb
|
|
127
150
|
- lib/jss/api_object/extendable.rb
|
|
128
151
|
- lib/jss/api_object/extension_attribute.rb
|
|
129
152
|
- lib/jss/api_object/extension_attribute/computer_extension_attribute.rb
|
|
@@ -135,8 +158,11 @@ files:
|
|
|
135
158
|
- lib/jss/api_object/group/user_group.rb
|
|
136
159
|
- lib/jss/api_object/ldap_server.rb
|
|
137
160
|
- lib/jss/api_object/locatable.rb
|
|
161
|
+
- lib/jss/api_object/mac_application.rb
|
|
138
162
|
- lib/jss/api_object/matchable.rb
|
|
139
163
|
- lib/jss/api_object/mobile_device.rb
|
|
164
|
+
- lib/jss/api_object/mobile_device_application.rb
|
|
165
|
+
- lib/jss/api_object/mobile_device_configuration_profile.rb
|
|
140
166
|
- lib/jss/api_object/netboot_server.rb
|
|
141
167
|
- lib/jss/api_object/network_segment.rb
|
|
142
168
|
- lib/jss/api_object/osx_configuration_profile.rb
|
|
@@ -151,11 +177,13 @@ files:
|
|
|
151
177
|
- lib/jss/api_object/scopable/scope.rb
|
|
152
178
|
- lib/jss/api_object/script.rb
|
|
153
179
|
- lib/jss/api_object/self_servable.rb
|
|
180
|
+
- lib/jss/api_object/self_servable/icon.rb
|
|
154
181
|
- lib/jss/api_object/site.rb
|
|
155
182
|
- lib/jss/api_object/software_update_server.rb
|
|
156
183
|
- lib/jss/api_object/updatable.rb
|
|
157
184
|
- lib/jss/api_object/uploadable.rb
|
|
158
185
|
- lib/jss/api_object/user.rb
|
|
186
|
+
- lib/jss/api_object/vppable.rb
|
|
159
187
|
- lib/jss/api_object/webhook.rb
|
|
160
188
|
- lib/jss/client.rb
|
|
161
189
|
- lib/jss/compatibility.rb
|
|
@@ -167,72 +195,13 @@ files:
|
|
|
167
195
|
- lib/jss/ruby_extensions/filetest.rb
|
|
168
196
|
- lib/jss/ruby_extensions/hash.rb
|
|
169
197
|
- lib/jss/ruby_extensions/ipaddr.rb
|
|
198
|
+
- lib/jss/ruby_extensions/object.rb
|
|
170
199
|
- lib/jss/ruby_extensions/pathname.rb
|
|
171
200
|
- lib/jss/ruby_extensions/string.rb
|
|
172
201
|
- lib/jss/ruby_extensions/time.rb
|
|
173
202
|
- lib/jss/server.rb
|
|
174
203
|
- lib/jss/utility.rb
|
|
175
204
|
- lib/jss/version.rb
|
|
176
|
-
- lib/jss/webhooks.rb
|
|
177
|
-
- lib/jss/webhooks/README.md
|
|
178
|
-
- lib/jss/webhooks/configuration.rb
|
|
179
|
-
- lib/jss/webhooks/data/sample_handlers/RestAPIOperation-executable
|
|
180
|
-
- lib/jss/webhooks/data/sample_handlers/RestAPIOperation.rb
|
|
181
|
-
- lib/jss/webhooks/data/sample_jsons/ComputerAdded.json
|
|
182
|
-
- lib/jss/webhooks/data/sample_jsons/ComputerCheckIn.json
|
|
183
|
-
- lib/jss/webhooks/data/sample_jsons/ComputerInventoryCompleted.json
|
|
184
|
-
- lib/jss/webhooks/data/sample_jsons/ComputerPolicyFinished.json
|
|
185
|
-
- lib/jss/webhooks/data/sample_jsons/ComputerPushCapabilityChanged.json
|
|
186
|
-
- lib/jss/webhooks/data/sample_jsons/JSSShutdown.json
|
|
187
|
-
- lib/jss/webhooks/data/sample_jsons/JSSStartup.json
|
|
188
|
-
- lib/jss/webhooks/data/sample_jsons/MobileDeviceCheckIn.json
|
|
189
|
-
- lib/jss/webhooks/data/sample_jsons/MobileDeviceCommandCompleted.json
|
|
190
|
-
- lib/jss/webhooks/data/sample_jsons/MobileDeviceEnrolled.json
|
|
191
|
-
- lib/jss/webhooks/data/sample_jsons/MobileDevicePushSent.json
|
|
192
|
-
- lib/jss/webhooks/data/sample_jsons/MobileDeviceUnEnrolled.json
|
|
193
|
-
- lib/jss/webhooks/data/sample_jsons/PatchSoftwareTitleUpdated.json
|
|
194
|
-
- lib/jss/webhooks/data/sample_jsons/PushSent.json
|
|
195
|
-
- lib/jss/webhooks/data/sample_jsons/RestAPIOperation.json
|
|
196
|
-
- lib/jss/webhooks/data/sample_jsons/SCEPChallenge.json
|
|
197
|
-
- lib/jss/webhooks/data/sample_jsons/SmartGroupComputerMembershipChange.json
|
|
198
|
-
- lib/jss/webhooks/data/sample_jsons/SmartGroupMobileDeviceMembershipChange.json
|
|
199
|
-
- lib/jss/webhooks/event.rb
|
|
200
|
-
- lib/jss/webhooks/event/computer_added.rb
|
|
201
|
-
- lib/jss/webhooks/event/computer_check_in.rb
|
|
202
|
-
- lib/jss/webhooks/event/computer_inventory_completed.rb
|
|
203
|
-
- lib/jss/webhooks/event/computer_policy_finished.rb
|
|
204
|
-
- lib/jss/webhooks/event/computer_push_capability_changed.rb
|
|
205
|
-
- lib/jss/webhooks/event/handlers.rb
|
|
206
|
-
- lib/jss/webhooks/event/jss_shutdown.rb
|
|
207
|
-
- lib/jss/webhooks/event/jss_startup.rb
|
|
208
|
-
- lib/jss/webhooks/event/mobile_device_check_in.rb
|
|
209
|
-
- lib/jss/webhooks/event/mobile_device_command_completed.rb
|
|
210
|
-
- lib/jss/webhooks/event/mobile_device_enrolled.rb
|
|
211
|
-
- lib/jss/webhooks/event/mobile_device_push_sent.rb
|
|
212
|
-
- lib/jss/webhooks/event/mobile_device_unenrolled.rb
|
|
213
|
-
- lib/jss/webhooks/event/patch_software_title_updated.rb
|
|
214
|
-
- lib/jss/webhooks/event/push_sent.rb
|
|
215
|
-
- lib/jss/webhooks/event/rest_api_operation.rb
|
|
216
|
-
- lib/jss/webhooks/event/scep_challenge.rb
|
|
217
|
-
- lib/jss/webhooks/event/smart_group_computer_membership_change.rb
|
|
218
|
-
- lib/jss/webhooks/event/smart_group_mobile_device_membership_change.rb
|
|
219
|
-
- lib/jss/webhooks/event/webhook.rb
|
|
220
|
-
- lib/jss/webhooks/event_objects.rb
|
|
221
|
-
- lib/jss/webhooks/event_objects/computer.rb
|
|
222
|
-
- lib/jss/webhooks/event_objects/jss.rb
|
|
223
|
-
- lib/jss/webhooks/event_objects/mobile_device.rb
|
|
224
|
-
- lib/jss/webhooks/event_objects/patch_software_title_update.rb
|
|
225
|
-
- lib/jss/webhooks/event_objects/push.rb
|
|
226
|
-
- lib/jss/webhooks/event_objects/rest_api_operation.rb
|
|
227
|
-
- lib/jss/webhooks/event_objects/scep_challenge.rb
|
|
228
|
-
- lib/jss/webhooks/event_objects/smart_group.rb
|
|
229
|
-
- lib/jss/webhooks/server_app.rb
|
|
230
|
-
- lib/jss/webhooks/server_app/routes.rb
|
|
231
|
-
- lib/jss/webhooks/server_app/routes/handle_webhook_event.rb
|
|
232
|
-
- lib/jss/webhooks/server_app/routes/home.rb
|
|
233
|
-
- lib/jss/webhooks/server_app/self_signed_cert.rb
|
|
234
|
-
- lib/jss/webhooks/server_app/server.rb
|
|
235
|
-
- lib/jss/webhooks/version.rb
|
|
236
205
|
- lib/ruby-jss.rb
|
|
237
206
|
homepage: http://pixaranimationstudios.github.io/ruby-jss/
|
|
238
207
|
licenses:
|
|
@@ -262,5 +231,5 @@ rubyforge_project:
|
|
|
262
231
|
rubygems_version: 2.6.8
|
|
263
232
|
signing_key:
|
|
264
233
|
specification_version: 4
|
|
265
|
-
summary: A Ruby interface to the
|
|
234
|
+
summary: A Ruby interface to the Jamf Pro REST API
|
|
266
235
|
test_files: []
|