ruby-jss 1.4.1 → 1.5.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.
Potentially problematic release.
This version of ruby-jss might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGES.md +38 -0
- data/lib/jamf.rb +10 -3
- data/lib/jamf/api/abstract_classes/collection_resource.rb +329 -150
- data/lib/jamf/api/abstract_classes/generic_reference.rb +9 -1
- data/lib/jamf/api/abstract_classes/json_object.rb +106 -82
- data/lib/jamf/api/abstract_classes/prestage.rb +54 -29
- data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +21 -0
- data/lib/jamf/api/abstract_classes/resource.rb +4 -4
- data/lib/jamf/api/abstract_classes/singleton_resource.rb +1 -1
- data/lib/jamf/api/connection.rb +13 -9
- data/lib/jamf/api/connection/api_error.rb +8 -8
- data/lib/jamf/api/connection/token.rb +16 -15
- data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +14 -1
- data/lib/jamf/api/json_objects/device_enrollment_device.rb +14 -7
- data/lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb +81 -0
- data/lib/jamf/api/json_objects/locale.rb +59 -0
- data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +50 -1
- data/lib/jamf/api/json_objects/prestage_location.rb +3 -3
- data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +7 -7
- data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
- data/lib/jamf/api/{resources/collection_resources → json_objects}/time_zone.rb +9 -23
- data/lib/jamf/api/mixins/bulk_deletable.rb +27 -6
- data/lib/jamf/api/mixins/change_log.rb +201 -51
- data/lib/jamf/api/mixins/filterable.rb +51 -0
- data/lib/jamf/api/mixins/pageable.rb +208 -0
- data/lib/jamf/api/mixins/sortable.rb +59 -0
- data/lib/jamf/api/resources/collection_resources/building.rb +19 -8
- data/lib/jamf/api/resources/collection_resources/category.rb +5 -3
- data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +11 -4
- data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +10 -10
- data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +11 -3
- data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +24 -22
- data/lib/jamf/api/resources/collection_resources/script.rb +61 -25
- data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +15 -5
- data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +14 -14
- data/lib/jamf/api/resources/singleton_resources/locales.rb +155 -0
- data/lib/jamf/api/resources/singleton_resources/time_zones.rb +213 -0
- data/lib/jamf/validate.rb +63 -24
- data/lib/jamf/version.rb +1 -1
- data/lib/jss.rb +2 -1
- data/lib/jss/api_connection.rb +110 -370
- data/lib/jss/api_object.rb +3 -19
- data/lib/jss/api_object/categorizable.rb +1 -1
- data/lib/jss/api_object/configuration_profile.rb +34 -3
- data/lib/jss/api_object/directory_binding_type.rb +66 -60
- data/lib/jss/api_object/directory_binding_type/active_directory.rb +71 -34
- data/lib/jss/api_object/directory_binding_type/admitmac.rb +536 -467
- data/lib/jss/api_object/directory_binding_type/centrify.rb +21 -7
- data/lib/jss/api_object/directory_binding_type/open_directory.rb +4 -4
- data/lib/jss/api_object/distribution_point.rb +2 -2
- data/lib/jss/api_object/dock_item.rb +102 -96
- data/lib/jss/api_object/extendable.rb +1 -1
- data/lib/jss/api_object/group.rb +33 -2
- data/lib/jss/api_object/network_segment.rb +43 -12
- data/lib/jss/api_object/patch_source.rb +10 -9
- data/lib/jss/api_object/printer.rb +10 -4
- data/lib/jss/api_object/scopable.rb +10 -15
- data/lib/jss/exceptions.rb +3 -0
- data/lib/jss/server.rb +15 -0
- data/lib/jss/version.rb +1 -1
- metadata +37 -22
@@ -120,30 +120,31 @@ module JSS
|
|
120
120
|
|
121
121
|
# Fetch either an internal or external patch source
|
122
122
|
#
|
123
|
-
# BUG: there's an API bug: fetching a non-existent
|
123
|
+
# BUG: there's an API bug: fetching a non-existent
|
124
124
|
# which is why we rescue internal server errors.
|
125
125
|
#
|
126
126
|
# @see APIObject.fetch
|
127
127
|
#
|
128
|
-
def self.fetch(
|
128
|
+
def self.fetch(searchterm = nil, **args)
|
129
129
|
if self == JSS::PatchSource
|
130
130
|
begin
|
131
|
-
fetched = JSS::PatchInternalSource.fetch
|
132
|
-
rescue
|
131
|
+
fetched = JSS::PatchInternalSource.fetch searchterm, **args
|
132
|
+
rescue
|
133
133
|
fetched = nil
|
134
134
|
end
|
135
135
|
unless fetched
|
136
136
|
begin
|
137
|
-
fetched = JSS::PatchExternalSource.fetch
|
138
|
-
rescue
|
137
|
+
fetched = JSS::PatchExternalSource.fetch searchterm, **args
|
138
|
+
rescue
|
139
139
|
raise JSS::NoSuchItemError, 'No matching PatchSource found'
|
140
140
|
end
|
141
141
|
end
|
142
142
|
return fetched
|
143
143
|
end # if self == JSS::PatchSource
|
144
|
+
|
144
145
|
begin
|
145
|
-
super
|
146
|
-
rescue
|
146
|
+
super searchterm, **args
|
147
|
+
rescue JSS::NoSuchItemError
|
147
148
|
raise JSS::NoSuchItemError, "No matching #{self::RSRC_OBJECT_KEY} found"
|
148
149
|
end
|
149
150
|
end
|
@@ -211,7 +212,7 @@ module JSS
|
|
211
212
|
begin
|
212
213
|
# TODO: remove this and adjust parsing when jamf fixes the JSON
|
213
214
|
raw = JSS::XMLWorkaround.data_via_xml(rsrc, AVAILABLE_TITLES_DATA_MAP, api)
|
214
|
-
rescue
|
215
|
+
rescue JSS::NoSuchItemError
|
215
216
|
return []
|
216
217
|
end
|
217
218
|
|
@@ -376,9 +376,9 @@ module JSS
|
|
376
376
|
#
|
377
377
|
# @author Tyler Morgan
|
378
378
|
#
|
379
|
-
# @param newvalue [String]
|
379
|
+
# @param newvalue [String, Float, Array[String], Array[Float]]
|
380
380
|
#
|
381
|
-
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
381
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String, Float, Array containing Strings, or Array containing Floats.
|
382
382
|
#
|
383
383
|
# @example Limit Printer object to only High Sierra devices and Mojave 10.14.5 OS versions
|
384
384
|
# printer.os_requirements = "10.13.x, 10.14.5"
|
@@ -386,8 +386,14 @@ module JSS
|
|
386
386
|
# @return [void]
|
387
387
|
def os_requirements=(newvalue)
|
388
388
|
|
389
|
-
|
390
|
-
|
389
|
+
if newvalue.is_a? Array
|
390
|
+
# Parse Array
|
391
|
+
raise JSS::InvalidDataError, "If setting os_requirements with an array, it must contain strings or floats." unless newvalue[0].is_a?(String) || newvalue[0].is_a?(Float)
|
392
|
+
newvalue = newvalue.map { |x| x.to_s }.join(',')
|
393
|
+
else
|
394
|
+
raise JSS::InvalidDataError, "os_requirements must either be a string, float, or an array containing strings or floats." unless (newvalue.is_a?(String) || newvalue.is_a?(Float)) && !newvalue.nil?
|
395
|
+
end
|
396
|
+
|
391
397
|
@os_requirements = newvalue
|
392
398
|
|
393
399
|
@need_to_update = true
|
@@ -100,22 +100,17 @@ module JSS
|
|
100
100
|
@need_to_update = true if @in_jss
|
101
101
|
end
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
###
|
103
|
+
# A wrapper around the update method, to try catching 409 conflict errors
|
104
|
+
# when we couldn't verify all ldap users/groups due to lack of ldap connections
|
105
|
+
#
|
107
106
|
def update
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
raise conflict
|
116
|
-
end
|
117
|
-
|
118
|
-
end # begin
|
107
|
+
super
|
108
|
+
rescue JSS::ConflictError => conflict
|
109
|
+
if scope.unable_to_verify_ldap_entries == true
|
110
|
+
raise JSS::InvalidDataError, "Potentially non-existant LDAP user or group in new scope values."
|
111
|
+
else
|
112
|
+
raise conflict
|
113
|
+
end
|
119
114
|
end # update
|
120
115
|
|
121
116
|
end # module Scopable
|
data/lib/jss/exceptions.rb
CHANGED
data/lib/jss/server.rb
CHANGED
@@ -110,6 +110,21 @@ module JSS
|
|
110
110
|
@act_code_data[:code]
|
111
111
|
end
|
112
112
|
|
113
|
+
# Update the activation code and organization name for this server
|
114
|
+
#
|
115
|
+
# @param org: [String] the organization to which the server is licensed
|
116
|
+
# @param code: [String ] the activation code for the server licence
|
117
|
+
#
|
118
|
+
# @return [void]
|
119
|
+
def update_activation_code(org:, code:)
|
120
|
+
xml = REXML::Document.new JSS::APIConnection::XML_HEADER
|
121
|
+
acode = xml.add_element ACTIVATION_CODE_KEY.to_s
|
122
|
+
acode.add_element('organization_name').text = org
|
123
|
+
acode.add_element('code').text = code
|
124
|
+
|
125
|
+
@api.put_rsrc ACTIVATION_CODE_RSRC, xml.to_s
|
126
|
+
end
|
127
|
+
|
113
128
|
# Remove the api object from
|
114
129
|
# the instance_variables used to create
|
115
130
|
# pretty-print (pp) output.
|
data/lib/jss/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Lasell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plist
|
@@ -46,39 +46,45 @@ dependencies:
|
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.9.12
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: faraday
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
- - "
|
54
|
+
version: 1.0.0
|
55
|
+
- - "<="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
57
|
+
version: 1.0.1
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
65
|
-
- - "
|
64
|
+
version: 1.0.0
|
65
|
+
- - "<="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 1.0.1
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: faraday_middleware
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.0
|
75
|
+
- - "<="
|
73
76
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
77
|
+
version: 1.0.1
|
75
78
|
type: :runtime
|
76
79
|
prerelease: false
|
77
80
|
version_requirements: !ruby/object:Gem::Requirement
|
78
81
|
requirements:
|
79
|
-
- - "
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.0.0
|
85
|
+
- - "<="
|
80
86
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
87
|
+
version: 1.0.1
|
82
88
|
- !ruby/object:Gem::Dependency
|
83
89
|
name: immutable-struct
|
84
90
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,11 +126,13 @@ dependencies:
|
|
120
126
|
- !ruby/object:Gem::Version
|
121
127
|
version: '1.1'
|
122
128
|
description: |2
|
123
|
-
The ruby-jss gem provides
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
129
|
+
The ruby-jss gem provides native ruby access to the REST APIs of Jamf Pro,
|
130
|
+
an enterprise/education tool for managing Apple devices, from jamf.com.
|
131
|
+
The JSS module provides access to the 'Classic' API, while the Jamf module
|
132
|
+
provides access to the more modern 'Jamf Pro' API. Jamf Pro objects are
|
133
|
+
implemented as classes and, within each module, can interact with each other.
|
134
|
+
The underlying data transfer using JSON or XML is handled automatically
|
135
|
+
under the hood to allow simpler, intuitive automation of Jamf-related Tasks.
|
128
136
|
email: ruby-jss@pixar.com
|
129
137
|
executables:
|
130
138
|
- cgrouper
|
@@ -171,6 +179,7 @@ files:
|
|
171
179
|
- lib/jamf/api/json_objects/country.rb
|
172
180
|
- lib/jamf/api/json_objects/criterion.rb
|
173
181
|
- lib/jamf/api/json_objects/device_enrollment_device.rb
|
182
|
+
- lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb
|
174
183
|
- lib/jamf/api/json_objects/device_enrollment_sync_status.rb
|
175
184
|
- lib/jamf/api/json_objects/extension_attribute_value.rb
|
176
185
|
- lib/jamf/api/json_objects/installed_application.rb
|
@@ -180,6 +189,7 @@ files:
|
|
180
189
|
- lib/jamf/api/json_objects/installed_provisioning_profile.rb
|
181
190
|
- lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb
|
182
191
|
- lib/jamf/api/json_objects/ios_details.rb
|
192
|
+
- lib/jamf/api/json_objects/locale.rb
|
183
193
|
- lib/jamf/api/json_objects/location.rb
|
184
194
|
- lib/jamf/api/json_objects/md_prestage_name.rb
|
185
195
|
- lib/jamf/api/json_objects/md_prestage_names.rb
|
@@ -192,15 +202,19 @@ files:
|
|
192
202
|
- lib/jamf/api/json_objects/prestage_scope.rb
|
193
203
|
- lib/jamf/api/json_objects/prestage_sync_status.rb
|
194
204
|
- lib/jamf/api/json_objects/purchasing_data.rb
|
205
|
+
- lib/jamf/api/json_objects/time_zone.rb
|
195
206
|
- lib/jamf/api/mixins/abstract.rb
|
196
207
|
- lib/jamf/api/mixins/bulk_deletable.rb
|
197
208
|
- lib/jamf/api/mixins/change_log.rb
|
198
209
|
- lib/jamf/api/mixins/extendable.rb
|
210
|
+
- lib/jamf/api/mixins/filterable.rb
|
199
211
|
- lib/jamf/api/mixins/immutable.rb
|
200
212
|
- lib/jamf/api/mixins/locatable.rb
|
201
213
|
- lib/jamf/api/mixins/lockable.rb
|
214
|
+
- lib/jamf/api/mixins/pageable.rb
|
202
215
|
- lib/jamf/api/mixins/referable.rb
|
203
216
|
- lib/jamf/api/mixins/searchable.rb
|
217
|
+
- lib/jamf/api/mixins/sortable.rb
|
204
218
|
- lib/jamf/api/mixins/uncreatable.rb
|
205
219
|
- lib/jamf/api/mixins/undeletable.rb
|
206
220
|
- lib/jamf/api/resources/collection_resources/account.rb
|
@@ -218,11 +232,12 @@ files:
|
|
218
232
|
- lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb
|
219
233
|
- lib/jamf/api/resources/collection_resources/script.rb
|
220
234
|
- lib/jamf/api/resources/collection_resources/site.rb
|
221
|
-
- lib/jamf/api/resources/collection_resources/time_zone.rb
|
222
235
|
- lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb
|
223
236
|
- lib/jamf/api/resources/singleton_resources/authorization.rb
|
224
237
|
- lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb
|
238
|
+
- lib/jamf/api/resources/singleton_resources/locales.rb
|
225
239
|
- lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb
|
240
|
+
- lib/jamf/api/resources/singleton_resources/time_zones.rb
|
226
241
|
- lib/jamf/client.rb
|
227
242
|
- lib/jamf/client/jamf_binary.rb
|
228
243
|
- lib/jamf/client/jamf_helper.rb
|
@@ -407,7 +422,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
407
422
|
requirements:
|
408
423
|
- - ">="
|
409
424
|
- !ruby/object:Gem::Version
|
410
|
-
version: 2.
|
425
|
+
version: 2.3.0
|
411
426
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
412
427
|
requirements:
|
413
428
|
- - ">="
|
@@ -417,5 +432,5 @@ requirements: []
|
|
417
432
|
rubygems_version: 3.0.3
|
418
433
|
signing_key:
|
419
434
|
specification_version: 4
|
420
|
-
summary: A Ruby interface to the Jamf Pro REST
|
435
|
+
summary: A Ruby interface to the Jamf Pro REST APIs
|
421
436
|
test_files: []
|