ruby-jss 1.5.1 → 1.5.2
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 +26 -0
- data/lib/jamf.rb +8 -13
- data/lib/jamf/api/{abstract_classes → base_classes}/collection_resource.rb +6 -5
- data/lib/jamf/api/{abstract_classes → base_classes}/json_object.rb +4 -20
- data/lib/jamf/api/{abstract_classes → base_classes}/prestage.rb +1 -1
- data/lib/jamf/api/{abstract_classes → base_classes}/resource.rb +6 -2
- data/lib/jamf/api/{abstract_classes → base_classes}/singleton_resource.rb +3 -2
- data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_names.rb +2 -2
- data/lib/jamf/api/json_objects/prestage_assignment.rb +2 -2
- data/lib/jamf/api/mixins/{abstract.rb → base_class.rb} +34 -16
- data/lib/jamf/api/resources/collection_resources/building.rb +0 -4
- data/lib/jamf/api/resources/collection_resources/category.rb +0 -1
- data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/department.rb +0 -2
- data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +1 -1
- data/lib/jamf/version.rb +1 -1
- data/lib/jss/api_connection.rb +1 -36
- data/lib/jss/api_object/computer.rb +13 -0
- data/lib/jss/api_object/configuration_profile.rb +28 -3
- data/lib/jss/api_object/policy.rb +105 -25
- data/lib/jss/api_object/scopable/scope.rb +31 -30
- data/lib/jss/utility.rb +142 -37
- data/lib/jss/version.rb +1 -1
- metadata +8 -41
- data/lib/jamf/api/abstract_classes/advanced_search.rb +0 -86
- data/lib/jamf/api/abstract_classes/generic_reference.rb +0 -153
- data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +0 -147
- data/lib/jamf/api/json_objects/account_prefs.rb +0 -79
- data/lib/jamf/api/json_objects/android_details.rb +0 -139
- data/lib/jamf/api/json_objects/appletv_details.rb +0 -110
- data/lib/jamf/api/json_objects/attachment.rb +0 -68
- data/lib/jamf/api/json_objects/cellular_network.rb +0 -151
- data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +0 -80
- data/lib/jamf/api/json_objects/criterion.rb +0 -152
- data/lib/jamf/api/json_objects/extension_attribute_value.rb +0 -128
- data/lib/jamf/api/json_objects/installed_application.rb +0 -59
- data/lib/jamf/api/json_objects/installed_certificate.rb +0 -53
- data/lib/jamf/api/json_objects/installed_configuration_profile.rb +0 -67
- data/lib/jamf/api/json_objects/installed_ebook.rb +0 -58
- data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +0 -59
- data/lib/jamf/api/json_objects/ios_details.rb +0 -244
- data/lib/jamf/api/json_objects/location.rb +0 -95
- data/lib/jamf/api/json_objects/mobile_device_details.rb +0 -219
- data/lib/jamf/api/json_objects/mobile_device_security.rb +0 -101
- data/lib/jamf/api/json_objects/purchasing_data.rb +0 -125
- data/lib/jamf/api/mixins/locatable.rb +0 -124
- data/lib/jamf/api/mixins/referable.rb +0 -92
- data/lib/jamf/api/resources/collection_resources/account.rb +0 -163
- data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +0 -52
- data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +0 -52
- data/lib/jamf/api/resources/collection_resources/computer.rb +0 -49
- data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +0 -45
- data/lib/jamf/api/resources/collection_resources/mobile_device.rb +0 -315
- data/lib/jamf/api/resources/collection_resources/site.rb +0 -77
- data/lib/jamf/api/resources/singleton_resources/authorization.rb +0 -88
- data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +0 -139
- data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +0 -95
@@ -1,219 +0,0 @@
|
|
1
|
-
# Copyright 2020 Pixar
|
2
|
-
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
-
# with the following modification; you may not use this file except in
|
6
|
-
# compliance with the Apache License and the following modification to it:
|
7
|
-
# Section 6. Trademarks. is deleted and replaced with:
|
8
|
-
#
|
9
|
-
# 6. Trademarks. This License does not grant permission to use the trade
|
10
|
-
# names, trademarks, service marks, or product names of the Licensor
|
11
|
-
# and its affiliates, except as required to comply with Section 4(c) of
|
12
|
-
# the License and to reproduce the content of the NOTICE file.
|
13
|
-
#
|
14
|
-
# You may obtain a copy of the Apache License at
|
15
|
-
#
|
16
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
#
|
18
|
-
# Unless required by applicable law or agreed to in writing, software
|
19
|
-
# distributed under the Apache License with the above modification is
|
20
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
-
# KIND, either express or implied. See the Apache License for the specific
|
22
|
-
# language governing permissions and limitations under the Apache License.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
26
|
-
# The module
|
27
|
-
module Jamf
|
28
|
-
|
29
|
-
# Classes
|
30
|
-
#####################################
|
31
|
-
|
32
|
-
# details of a mob dev
|
33
|
-
class MobileDeviceDetails < Jamf::JSONObject
|
34
|
-
|
35
|
-
# Mixins
|
36
|
-
#####################################
|
37
|
-
|
38
|
-
# Class Constants
|
39
|
-
#####################################
|
40
|
-
|
41
|
-
OBJECT_MODEL = {
|
42
|
-
|
43
|
-
# @!attribute [r] id
|
44
|
-
# @return [Integer]
|
45
|
-
id: {
|
46
|
-
class: :integer,
|
47
|
-
identifier: :primary,
|
48
|
-
readonly: true
|
49
|
-
},
|
50
|
-
|
51
|
-
# @!attribute [r] name
|
52
|
-
# This is readonly becuase the name attribute of
|
53
|
-
# the enclosing MobileDevice is used.
|
54
|
-
# @return [String]
|
55
|
-
name: {
|
56
|
-
class: :string,
|
57
|
-
readonly: true
|
58
|
-
},
|
59
|
-
|
60
|
-
# @!attribute assetTag
|
61
|
-
# @param [String]
|
62
|
-
# @return [String]
|
63
|
-
assetTag: {
|
64
|
-
class: :string
|
65
|
-
# TODO: make this an identifier?
|
66
|
-
},
|
67
|
-
|
68
|
-
# @!attribute [r] lastInventoryUpdateTimestamp
|
69
|
-
# @return [String]
|
70
|
-
lastInventoryUpdateTimestamp: {
|
71
|
-
class: Jamf::Timestamp,
|
72
|
-
aliases: [:lastInventoryUpdate],
|
73
|
-
readonly: true
|
74
|
-
},
|
75
|
-
|
76
|
-
# @!attribute [r] osVersion
|
77
|
-
# @return [String]
|
78
|
-
osVersion: {
|
79
|
-
class: :string,
|
80
|
-
readonly: true
|
81
|
-
},
|
82
|
-
|
83
|
-
# @!attribute [r] osBuild
|
84
|
-
# @return [String]
|
85
|
-
osBuild: {
|
86
|
-
class: :string,
|
87
|
-
readonly: true
|
88
|
-
},
|
89
|
-
|
90
|
-
# @!attribute [r] serialNumber
|
91
|
-
# @param [String]
|
92
|
-
# @return [String]
|
93
|
-
serialNumber: {
|
94
|
-
class: :string,
|
95
|
-
identifier: true,
|
96
|
-
readonly: true
|
97
|
-
},
|
98
|
-
|
99
|
-
# @!attribute [r] udid
|
100
|
-
# @param [String]
|
101
|
-
# @return [String]
|
102
|
-
udid: {
|
103
|
-
class: :string,
|
104
|
-
identifier: true,
|
105
|
-
readonly: true
|
106
|
-
},
|
107
|
-
|
108
|
-
# @!attribute [r] ipAddress
|
109
|
-
# @return [Jamf::IPAddress]
|
110
|
-
ipAddress: {
|
111
|
-
class: Jamf::IPAddress,
|
112
|
-
readonly: true
|
113
|
-
},
|
114
|
-
|
115
|
-
# @!attribute [r] wifiMacAddress
|
116
|
-
# @param [String]
|
117
|
-
# @return [String]
|
118
|
-
wifiMacAddress: {
|
119
|
-
class: :string,
|
120
|
-
identifier: true,
|
121
|
-
readonly: true
|
122
|
-
},
|
123
|
-
|
124
|
-
# @!attribute [r] bluetoothMacAddress
|
125
|
-
# @return [String]
|
126
|
-
bluetoothMacAddress: {
|
127
|
-
class: :string,
|
128
|
-
readonly: true
|
129
|
-
},
|
130
|
-
|
131
|
-
# @!attribute [r] isManaged
|
132
|
-
# see Jamf::MobileDevice#unmanage
|
133
|
-
# @return [Boolean]
|
134
|
-
isManaged: {
|
135
|
-
class: :boolean,
|
136
|
-
readonly: true
|
137
|
-
},
|
138
|
-
|
139
|
-
# @!attribute [r] initialEntryTimestamp
|
140
|
-
# @return [Jamf::Timestamp]
|
141
|
-
initialEntryTimestamp: {
|
142
|
-
class: Jamf::Timestamp,
|
143
|
-
readonly: true,
|
144
|
-
aliases: %i[initialEntry firstEnrolled]
|
145
|
-
},
|
146
|
-
|
147
|
-
# @!attribute [r] lastEnrollmentTimestamp
|
148
|
-
# @return [Boolean]
|
149
|
-
lastEnrollmentTimestamp: {
|
150
|
-
class: Jamf::Timestamp,
|
151
|
-
readonly: true,
|
152
|
-
aliases: %i[lastEnrollment lastEnrolled]
|
153
|
-
},
|
154
|
-
|
155
|
-
# @!attribute deviceOwnershipLevel
|
156
|
-
# @return [String]
|
157
|
-
deviceOwnershipLevel: {
|
158
|
-
class: :string,
|
159
|
-
readonly: true
|
160
|
-
},
|
161
|
-
|
162
|
-
# @!attribute site
|
163
|
-
# @param @see Jamf::Site::Reference#initialize
|
164
|
-
# @return [Jamf::Site::Reference]
|
165
|
-
site: {
|
166
|
-
class: Jamf::Site::Reference
|
167
|
-
},
|
168
|
-
|
169
|
-
# @!attribute [r] extensionAttributes
|
170
|
-
# see Jamf::Extendable
|
171
|
-
# @return [Array<Jamf::ExtensionAttribute::Value>]
|
172
|
-
extensionAttributes: {
|
173
|
-
class: Jamf::ExtensionAttributeValue,
|
174
|
-
multi: true,
|
175
|
-
readonly: true
|
176
|
-
},
|
177
|
-
|
178
|
-
# @!attribute [r] location
|
179
|
-
# see Jamf::Locatable
|
180
|
-
# @return [Jamf::Location]
|
181
|
-
location: {
|
182
|
-
class: Jamf::Location
|
183
|
-
},
|
184
|
-
|
185
|
-
# @!attribute [r] ios
|
186
|
-
# @return [Jamf::MobileDevice::IosDetails]
|
187
|
-
ios: {
|
188
|
-
class: Jamf::IosDetails,
|
189
|
-
readonly: true
|
190
|
-
},
|
191
|
-
|
192
|
-
# @!attribute [r] appleTv
|
193
|
-
# @return [Jamf::MobileDevice::AppleTvDetails]
|
194
|
-
appleTv: {
|
195
|
-
class: Jamf::AppleTVDetails,
|
196
|
-
readonly: true
|
197
|
-
},
|
198
|
-
|
199
|
-
# @!attribute [r] android
|
200
|
-
# @return [Jamf::MobileDevice::AndroidDetails]
|
201
|
-
android: {
|
202
|
-
class: Jamf::AndroidDetails,
|
203
|
-
readonly: true
|
204
|
-
}
|
205
|
-
|
206
|
-
}.freeze
|
207
|
-
parse_object_model
|
208
|
-
|
209
|
-
# Class Methods
|
210
|
-
###################################################
|
211
|
-
|
212
|
-
def self.fetch(id, cnx)
|
213
|
-
data = cnx.get "#{Jamf::MobileDevice::RSRC_PATH}/#{id}/detail"
|
214
|
-
new data, cnx: cnx
|
215
|
-
end
|
216
|
-
|
217
|
-
end # class Mobile Device Details
|
218
|
-
|
219
|
-
end # module
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# Copyright 2020 Pixar
|
2
|
-
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
-
# with the following modification; you may not use this file except in
|
6
|
-
# compliance with the Apache License and the following modification to it:
|
7
|
-
# Section 6. Trademarks. is deleted and replaced with:
|
8
|
-
#
|
9
|
-
# 6. Trademarks. This License does not grant permission to use the trade
|
10
|
-
# names, trademarks, service marks, or product names of the Licensor
|
11
|
-
# and its affiliates, except as required to comply with Section 4(c) of
|
12
|
-
# the License and to reproduce the content of the NOTICE file.
|
13
|
-
#
|
14
|
-
# You may obtain a copy of the Apache License at
|
15
|
-
#
|
16
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
#
|
18
|
-
# Unless required by applicable law or agreed to in writing, software
|
19
|
-
# distributed under the Apache License with the above modification is
|
20
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
-
# KIND, either express or implied. See the Apache License for the specific
|
22
|
-
# language governing permissions and limitations under the Apache License.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
26
|
-
# The module
|
27
|
-
module Jamf
|
28
|
-
|
29
|
-
# The collection of security settings for a device
|
30
|
-
class MobileDeviceSecurity < Jamf::JSONObject
|
31
|
-
|
32
|
-
OBJECT_MODEL = {
|
33
|
-
|
34
|
-
# @!attribute [r] isDataProtected
|
35
|
-
# @return [Boolean]
|
36
|
-
isDataProtected: {
|
37
|
-
class: :boolean,
|
38
|
-
readonly: true
|
39
|
-
},
|
40
|
-
|
41
|
-
# @!attribute [r] isBlockLevelEncryptionCapable
|
42
|
-
# @return [Boolean]
|
43
|
-
isBlockLevelEncryptionCapable: {
|
44
|
-
class: :boolean,
|
45
|
-
readonly: true
|
46
|
-
},
|
47
|
-
|
48
|
-
# @!attribute [r] isFileLevelEncryptionCapable
|
49
|
-
# @return [Boolean]
|
50
|
-
isFileLevelEncryptionCapable: {
|
51
|
-
class: :boolean,
|
52
|
-
readonly: true
|
53
|
-
},
|
54
|
-
|
55
|
-
# @!attribute [r] isPasscodePresent
|
56
|
-
# @return [Boolean]
|
57
|
-
isPasscodePresent: {
|
58
|
-
class: :boolean,
|
59
|
-
readonly: true
|
60
|
-
},
|
61
|
-
|
62
|
-
# @!attribute [r] isPasscodeCompliant
|
63
|
-
# @return [Boolean]
|
64
|
-
isPasscodeCompliant: {
|
65
|
-
class: :boolean,
|
66
|
-
readonly: true
|
67
|
-
},
|
68
|
-
|
69
|
-
# @!attribute [r] isPasscodeCompliantWithProfile
|
70
|
-
# @return [Boolean]
|
71
|
-
isPasscodeCompliantWithProfile: {
|
72
|
-
class: :boolean,
|
73
|
-
readonly: true
|
74
|
-
},
|
75
|
-
|
76
|
-
# @!attribute [r] hardwareEncryption
|
77
|
-
# @return [Integer]
|
78
|
-
hardwareEncryption: {
|
79
|
-
class: :integer,
|
80
|
-
readonly: true
|
81
|
-
},
|
82
|
-
|
83
|
-
# @!attribute [r] isActivationLockEnabled
|
84
|
-
# @return [Boolean]
|
85
|
-
isActivationLockEnabled: {
|
86
|
-
class: :boolean,
|
87
|
-
readonly: true
|
88
|
-
},
|
89
|
-
|
90
|
-
# @!attribute [r] isJailBreakDetected
|
91
|
-
# @return [Boolean]
|
92
|
-
isJailBreakDetected: {
|
93
|
-
class: :boolean,
|
94
|
-
readonly: true
|
95
|
-
}
|
96
|
-
}.freeze
|
97
|
-
parse_object_model
|
98
|
-
|
99
|
-
end # class Mobile Device security
|
100
|
-
|
101
|
-
end # module
|
@@ -1,125 +0,0 @@
|
|
1
|
-
# Copyright 2020 Pixar
|
2
|
-
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
-
# with the following modification; you may not use this file except in
|
6
|
-
# compliance with the Apache License and the following modification to it:
|
7
|
-
# Section 6. Trademarks. is deleted and replaced with:
|
8
|
-
#
|
9
|
-
# 6. Trademarks. This License does not grant permission to use the trade
|
10
|
-
# names, trademarks, service marks, or product names of the Licensor
|
11
|
-
# and its affiliates, except as required to comply with Section 4(c) of
|
12
|
-
# the License and to reproduce the content of the NOTICE file.
|
13
|
-
#
|
14
|
-
# You may obtain a copy of the Apache License at
|
15
|
-
#
|
16
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
#
|
18
|
-
# Unless required by applicable law or agreed to in writing, software
|
19
|
-
# distributed under the Apache License with the above modification is
|
20
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
-
# KIND, either express or implied. See the Apache License for the specific
|
22
|
-
# language governing permissions and limitations under the Apache License.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
26
|
-
# The module
|
27
|
-
module Jamf
|
28
|
-
|
29
|
-
# A 'location' for a managed object in Jamf Pro
|
30
|
-
class PurchasingData < Jamf::JSONObject
|
31
|
-
|
32
|
-
# TODO: setters or an uncreated device?
|
33
|
-
|
34
|
-
OBJECT_MODEL = {
|
35
|
-
|
36
|
-
# @!attribute isPurchased
|
37
|
-
# @param [String]
|
38
|
-
# @return [String]
|
39
|
-
isPurchased: {
|
40
|
-
class: :boolean
|
41
|
-
},
|
42
|
-
|
43
|
-
# @!attribute isLeased
|
44
|
-
# @param [String]
|
45
|
-
# @return [String]
|
46
|
-
isLeased: {
|
47
|
-
class: :boolean
|
48
|
-
},
|
49
|
-
|
50
|
-
# @!attribute poNumber
|
51
|
-
# @param [String]
|
52
|
-
# @return [String]
|
53
|
-
poNumber: {
|
54
|
-
class: :string
|
55
|
-
},
|
56
|
-
|
57
|
-
# @!attribute appleCareId
|
58
|
-
# @param [String]
|
59
|
-
# @return [String]
|
60
|
-
appleCareId: {
|
61
|
-
class: :string
|
62
|
-
},
|
63
|
-
|
64
|
-
# @!attribute vendor
|
65
|
-
# @param [String]
|
66
|
-
# @return [String]
|
67
|
-
vendor: {
|
68
|
-
class: :string
|
69
|
-
},
|
70
|
-
|
71
|
-
# @!attribute purchasePrice
|
72
|
-
# @param [String]
|
73
|
-
# @return [String]
|
74
|
-
purchasePrice: {
|
75
|
-
class: :string
|
76
|
-
},
|
77
|
-
|
78
|
-
# @!attribute purchasingAccount
|
79
|
-
# @param [String]
|
80
|
-
# @return [String]
|
81
|
-
purchasingAccount: {
|
82
|
-
class: :string
|
83
|
-
},
|
84
|
-
|
85
|
-
# @!attribute poDate
|
86
|
-
# @param [String]
|
87
|
-
# @return [String]
|
88
|
-
poDate: {
|
89
|
-
class: Jamf::Timestamp
|
90
|
-
},
|
91
|
-
|
92
|
-
# @!attribute warrantyExpiresDate
|
93
|
-
# @param [String]
|
94
|
-
# @return [String]
|
95
|
-
warrantyExpiresDate: {
|
96
|
-
class: Jamf::Timestamp
|
97
|
-
},
|
98
|
-
|
99
|
-
# @!attribute leaseExpiresDate
|
100
|
-
# @param [String]
|
101
|
-
# @return [String]
|
102
|
-
leaseExpiresDate: {
|
103
|
-
class: Jamf::Timestamp
|
104
|
-
},
|
105
|
-
|
106
|
-
# @!attribute lifeExpectancy
|
107
|
-
# @param [String]
|
108
|
-
# @return [String]
|
109
|
-
lifeExpectancy: {
|
110
|
-
class: :integer
|
111
|
-
},
|
112
|
-
|
113
|
-
# @!attribute purchasingContact
|
114
|
-
# @param [String]
|
115
|
-
# @return [String]
|
116
|
-
purchasingContact: {
|
117
|
-
class: :string
|
118
|
-
}
|
119
|
-
}.freeze
|
120
|
-
|
121
|
-
parse_object_model
|
122
|
-
|
123
|
-
end # class location
|
124
|
-
|
125
|
-
end # module
|
@@ -1,124 +0,0 @@
|
|
1
|
-
# Copyright 2020 Pixar
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
-
# with the following modification; you may not use this file except in
|
5
|
-
# compliance with the Apache License and the following modification to it:
|
6
|
-
# Section 6. Trademarks. is deleted and replaced with:
|
7
|
-
#
|
8
|
-
# 6. Trademarks. This License does not grant permission to use the trade
|
9
|
-
# names, trademarks, service marks, or product names of the Licensor
|
10
|
-
# and its affiliates, except as required to comply with Section 4(c) of
|
11
|
-
# the License and to reproduce the content of the NOTICE file.
|
12
|
-
#
|
13
|
-
# You may obtain a copy of the Apache License at
|
14
|
-
#
|
15
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
16
|
-
#
|
17
|
-
# Unless required by applicable law or agreed to in writing, software
|
18
|
-
# distributed under the Apache License with the above modification is
|
19
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
-
# KIND, either express or implied. See the Apache License for the specific
|
21
|
-
# language governing permissions and limitations under the Apache License.
|
22
|
-
#
|
23
|
-
#
|
24
|
-
|
25
|
-
module Jamf
|
26
|
-
|
27
|
-
# Classes mixing this in have a Jamf::Location instance in their :location
|
28
|
-
# attribute.
|
29
|
-
#
|
30
|
-
# See the Jamf::JSONObject docs for OBJECT_MODEL for defining the
|
31
|
-
# :location attribute. It should always be marked `readonly: true`,
|
32
|
-
# since attempting to set the location as a whole will raise an error.
|
33
|
-
#
|
34
|
-
# Instead of setting it as a whole, you must use the Jamf::Location object
|
35
|
-
# stored in the :location attribute to access it's values, like so:
|
36
|
-
#
|
37
|
-
# mycomputer.location.department # => 'Muggle Studies'
|
38
|
-
# mycomputer.location.room = 'Great Hall'
|
39
|
-
#
|
40
|
-
# All location attributes can be set that way, but building, room, department,
|
41
|
-
# & phoneNumber are more related to the physical location, so must be used
|
42
|
-
# that way.
|
43
|
-
#
|
44
|
-
# The other attributes, username, realName, position, and emailAddress, are
|
45
|
-
# more related to the assinged user than the physical location, and are also
|
46
|
-
# acessible via the #user method, which returns a simple wrapper for those
|
47
|
-
# attributes, like this:
|
48
|
-
#
|
49
|
-
# mycomputer.user.name # => 'adumble' user.username works too
|
50
|
-
# mycomputer.user.realName = 'Albus Dumbledore'
|
51
|
-
# mycomputer.user.position = 'Headmaster'
|
52
|
-
# mycomputer.user.emailAddress = 'adumble@hogwarts.edu.uk'
|
53
|
-
#
|
54
|
-
# are more related to the machine and its physical location
|
55
|
-
# than to the user responsible for the machine.
|
56
|
-
#
|
57
|
-
module Locatable
|
58
|
-
|
59
|
-
def location=(_loc)
|
60
|
-
raise Jamf::UnsupportedError, 'Location cannot be set as a whole, set its attributes individually'
|
61
|
-
end
|
62
|
-
|
63
|
-
def user
|
64
|
-
@location_user ||= Jamf::Locatable::User.new(self)
|
65
|
-
end
|
66
|
-
|
67
|
-
# a class for user-specific data in a Location object
|
68
|
-
class User
|
69
|
-
|
70
|
-
def initialize(assigned_object)
|
71
|
-
@assigned_object = assigned_object
|
72
|
-
end
|
73
|
-
|
74
|
-
def username
|
75
|
-
@assigned_object.location.username
|
76
|
-
end
|
77
|
-
alias name username
|
78
|
-
|
79
|
-
def username=(val)
|
80
|
-
@assigned_object.location.username = val
|
81
|
-
end
|
82
|
-
alias name= username=
|
83
|
-
|
84
|
-
def realName
|
85
|
-
@assigned_object.location.realName
|
86
|
-
end
|
87
|
-
|
88
|
-
def realName=(val)
|
89
|
-
@assigned_object.location.realName = val
|
90
|
-
end
|
91
|
-
|
92
|
-
def emailAddress
|
93
|
-
@assigned_object.location.emailAddress
|
94
|
-
end
|
95
|
-
|
96
|
-
def emailAddress=(val)
|
97
|
-
@assigned_object.location.emailAddress = val
|
98
|
-
end
|
99
|
-
|
100
|
-
def position
|
101
|
-
@assigned_object.location.position
|
102
|
-
end
|
103
|
-
|
104
|
-
def position=(val)
|
105
|
-
@assigned_object.location.position = val
|
106
|
-
end
|
107
|
-
|
108
|
-
# Remove large cached items from
|
109
|
-
# the instance_variables used to create
|
110
|
-
# pretty-print (pp) output.
|
111
|
-
#
|
112
|
-
# @return [Array] the desired instance_variables
|
113
|
-
#
|
114
|
-
def pretty_print_instance_variables
|
115
|
-
vars = instance_variables.sort
|
116
|
-
vars.delete :@assigned_object
|
117
|
-
vars
|
118
|
-
end
|
119
|
-
|
120
|
-
end # class user
|
121
|
-
|
122
|
-
end # locatable
|
123
|
-
|
124
|
-
end # Jamf
|