ruby-jss 0.10.2a5 → 0.10.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 +5 -0
- data/lib/jss/api_connection.rb +19 -38
- data/lib/jss/api_object/advanced_search.rb +1 -5
- data/lib/jss/api_object/computer.rb +292 -316
- data/lib/jss/api_object/computer_invitation.rb +3 -5
- data/lib/jss/api_object/ebook.rb +0 -5
- data/lib/jss/api_object/group/computer_group.rb +0 -4
- data/lib/jss/api_object/group/mobile_device_group.rb +1 -4
- data/lib/jss/api_object/group.rb +1 -6
- data/lib/jss/api_object/mac_application.rb +0 -5
- data/lib/jss/api_object/mobile_device.rb +336 -57
- data/lib/jss/api_object/mobile_device_application.rb +0 -6
- data/lib/jss/api_object/mobile_device_configuration_profile.rb +0 -36
- data/lib/jss/api_object/osx_configuration_profile.rb +151 -115
- data/lib/jss/api_object/peripheral.rb +7 -5
- data/lib/jss/api_object/policy.rb +0 -5
- data/lib/jss/api_object/restricted_software.rb +0 -5
- data/lib/jss/api_object/scopable/scope.rb +411 -367
- data/lib/jss/api_object/self_servable.rb +4 -15
- data/lib/jss/api_object/site.rb +76 -45
- data/lib/jss/api_object/user.rb +3 -7
- data/lib/jss/api_object.rb +4 -74
- data/lib/jss/utility.rb +0 -21
- data/lib/jss/version.rb +1 -1
- data/lib/jss.rb +0 -4
- metadata +6 -10
- data/lib/jss/api_object/mdm.rb +0 -1268
- data/lib/jss/api_object/patch.rb +0 -38
- data/lib/jss/api_object/patch_policy.rb +0 -38
- data/lib/jss/api_object/sitable.rb +0 -197
data/lib/jss/api_object/patch.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
### Copyright 2017 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
|
-
###
|
27
|
-
module JSS
|
28
|
-
|
29
|
-
# This is a stub - Patch data in the API is still borked.
|
30
|
-
# Waiting for fixes from Jamf.
|
31
|
-
#
|
32
|
-
# @see JSS::APIObject
|
33
|
-
#
|
34
|
-
class Patch < JSS::APIObject
|
35
|
-
|
36
|
-
end # class Patch
|
37
|
-
|
38
|
-
end # module JSS
|
@@ -1,38 +0,0 @@
|
|
1
|
-
### Copyright 2017 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
|
-
###
|
27
|
-
module JSS
|
28
|
-
|
29
|
-
# This is a stub - Patch Policy data in the API is still borked.
|
30
|
-
# Waiting for fixes from Jamf.
|
31
|
-
#
|
32
|
-
# @see JSS::APIObject
|
33
|
-
#
|
34
|
-
class PatchPolicy < JSS::APIObject
|
35
|
-
|
36
|
-
end # class PatchPolicy
|
37
|
-
|
38
|
-
end # module JSS
|
@@ -1,197 +0,0 @@
|
|
1
|
-
### Copyright 2017 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
|
-
###
|
27
|
-
module JSS
|
28
|
-
|
29
|
-
# Module Variables
|
30
|
-
#####################################
|
31
|
-
|
32
|
-
# Module Methods
|
33
|
-
#####################################
|
34
|
-
|
35
|
-
# Classes
|
36
|
-
#####################################
|
37
|
-
|
38
|
-
# A mix-in module that centralizes the code for handling objects which can be
|
39
|
-
# assigned a 'site' in the JSS.
|
40
|
-
#
|
41
|
-
# Objects in the JSS present site data in the top-level :general Hash
|
42
|
-
# in the :site key which is a Hash with a :name and :id key.
|
43
|
-
#
|
44
|
-
# Classes mixing in this module MUST:
|
45
|
-
#
|
46
|
-
# - define the constant SITE_SUBSET as either :top, :general, or whatever
|
47
|
-
# sub-hash of API data conaints the site info. (most are :general, but
|
48
|
-
# some, like advanced searches, are at the top level)
|
49
|
-
#
|
50
|
-
# - call {#add_site_to_xml(xmldoc)} from their #rest_xml method if they are
|
51
|
-
# {Updatable} or {Creatable}
|
52
|
-
#
|
53
|
-
module Sitable
|
54
|
-
|
55
|
-
# Module Constants
|
56
|
-
#####################################
|
57
|
-
|
58
|
-
SITABLE = true
|
59
|
-
|
60
|
-
# When no site has been assigned, this is the 'name' and id used
|
61
|
-
NO_SITE_NAME = 'None'.freeze
|
62
|
-
NO_SITE_ID = -1
|
63
|
-
|
64
|
-
# Setting the site to any of these values will unset the site
|
65
|
-
NON_SITES = [
|
66
|
-
nil,
|
67
|
-
'',
|
68
|
-
0,
|
69
|
-
NO_SITE_NAME,
|
70
|
-
NO_SITE_ID
|
71
|
-
].freeze
|
72
|
-
|
73
|
-
# Mixed-in Public Instance Methods
|
74
|
-
#####################################
|
75
|
-
|
76
|
-
# The name of the site for this object.
|
77
|
-
# For backward compatibility, this is aliased to just
|
78
|
-
# 'site'
|
79
|
-
#
|
80
|
-
# @return [String] The name of the site for this object.
|
81
|
-
#
|
82
|
-
def site_name
|
83
|
-
@site_name
|
84
|
-
end # cat name
|
85
|
-
alias site site_name
|
86
|
-
|
87
|
-
# The id of the site for this object.
|
88
|
-
#
|
89
|
-
# @return [Integer] The id of the site for this object.
|
90
|
-
#
|
91
|
-
def site_id
|
92
|
-
@site_id
|
93
|
-
end # cat id
|
94
|
-
|
95
|
-
# The JSS::Site instance for this object's site
|
96
|
-
#
|
97
|
-
# @return [JSS::Site] The JSS::Site instance for this object's site
|
98
|
-
#
|
99
|
-
def site_object
|
100
|
-
return nil unless site_assigned?
|
101
|
-
JSS::Site.new id: @site_id
|
102
|
-
end # cat obj
|
103
|
-
|
104
|
-
# Does this object have a site assigned?
|
105
|
-
#
|
106
|
-
# @return [Boolean] Does this object have a site assigned?
|
107
|
-
#
|
108
|
-
def site_assigned?
|
109
|
-
!@site_name.nil?
|
110
|
-
end # cat assigned?
|
111
|
-
|
112
|
-
# Change the site of this object.
|
113
|
-
# Any of the NON_SITES values will
|
114
|
-
# unset the site
|
115
|
-
#
|
116
|
-
# @param new_site[Integer, String] The new site
|
117
|
-
#
|
118
|
-
# @return [void]
|
119
|
-
#
|
120
|
-
def site=(new_site)
|
121
|
-
return nil unless updatable? || creatable?
|
122
|
-
|
123
|
-
# unset the site? Use nil or an empty string
|
124
|
-
if NON_SITES.include? new_site
|
125
|
-
unset_site
|
126
|
-
return
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
|
-
new_id = JSS::Site.valid_id new_site, api: @api
|
131
|
-
new_name = JSS::Site.map_all_ids_to(:name, api: @api)[new_id]
|
132
|
-
# no change, go home.
|
133
|
-
return nil if new_name == @site_name
|
134
|
-
|
135
|
-
raise JSS::NoSuchItemError, "Site '#{new_site}' is not known to the JSS" unless new_id
|
136
|
-
|
137
|
-
@site_name = new_name
|
138
|
-
@site_id = new_id
|
139
|
-
@need_to_update = true
|
140
|
-
end # site =
|
141
|
-
|
142
|
-
# Set the site to nothing
|
143
|
-
#
|
144
|
-
# @return [void]
|
145
|
-
#
|
146
|
-
def unset_site
|
147
|
-
# no change, go home
|
148
|
-
return nil if @site_name.nil?
|
149
|
-
@site_name = nil
|
150
|
-
@site_id = nil
|
151
|
-
@need_to_update = true
|
152
|
-
end # unset site
|
153
|
-
|
154
|
-
# Mixed-in Private Instance Methods
|
155
|
-
#####################################
|
156
|
-
private
|
157
|
-
|
158
|
-
# Parse the site data from any incoming API data
|
159
|
-
#
|
160
|
-
# @return [void]
|
161
|
-
#
|
162
|
-
def parse_site
|
163
|
-
site_data =
|
164
|
-
if self.class::SITE_SUBSET == :top
|
165
|
-
@init_data[:site]
|
166
|
-
else
|
167
|
-
@init_data[self.class::SITE_SUBSET][:site]
|
168
|
-
end
|
169
|
-
|
170
|
-
raise JSS::MissingDataError, 'No Site data found in API data.' unless site_data
|
171
|
-
|
172
|
-
@site_name = site_data[:name]
|
173
|
-
@site_id = site_data[:id]
|
174
|
-
end # parse site
|
175
|
-
|
176
|
-
# Add the site to the XML for POSTing or PUTting to the API.
|
177
|
-
#
|
178
|
-
# @param xmldoc[REXML::Document] The in-construction XML document
|
179
|
-
#
|
180
|
-
# @return [void]
|
181
|
-
#
|
182
|
-
def add_site_to_xml(xmldoc)
|
183
|
-
root = xmldoc.root
|
184
|
-
site_elem =
|
185
|
-
if self.class::SITE_SUBSET == :top
|
186
|
-
root.add_element 'site'
|
187
|
-
else
|
188
|
-
parent_elem = root.elements[self.class::SITE_SUBSET.to_s]
|
189
|
-
parent_elem ||= root.add_element(self.class::SITE_SUBSET.to_s)
|
190
|
-
parent_elem.add_element 'site'
|
191
|
-
end
|
192
|
-
site_elem.add_element('name').text = @site_name.to_s
|
193
|
-
end # add_site_to_xml
|
194
|
-
|
195
|
-
end # module categorizable
|
196
|
-
|
197
|
-
end # module
|