ruby-jss 0.10.2 → 0.11.0a5
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 +49 -2
- data/README.md +14 -7
- data/lib/jss/api_connection.rb +48 -24
- data/lib/jss/api_object/advanced_search.rb +5 -1
- data/lib/jss/api_object/computer.rb +204 -402
- data/lib/jss/api_object/computer_invitation.rb +5 -3
- data/lib/jss/api_object/ebook.rb +5 -0
- data/lib/jss/api_object/extendable.rb +13 -0
- data/lib/jss/api_object/group/computer_group.rb +4 -0
- data/lib/jss/api_object/group/mobile_device_group.rb +4 -1
- data/lib/jss/api_object/group.rb +6 -1
- data/lib/jss/api_object/mac_application.rb +5 -0
- data/lib/jss/api_object/management_history/audit_event.rb +45 -0
- data/lib/jss/api_object/management_history/casper_imaging_log.rb +37 -0
- data/lib/jss/api_object/management_history/casper_remote_log.rb +37 -0
- data/lib/jss/api_object/management_history/computer_usage_log.rb +43 -0
- data/lib/jss/api_object/management_history/ebook.rb +70 -0
- data/lib/jss/api_object/management_history/mac_app_store_app.rb +69 -0
- data/lib/jss/api_object/management_history/mdm_command.rb +96 -0
- data/lib/jss/api_object/management_history/mobile_device_app.rb +99 -0
- data/lib/jss/api_object/management_history/policy_log.rb +60 -0
- data/lib/jss/api_object/management_history/screen_sharing_log.rb +41 -0
- data/lib/jss/api_object/management_history/user_location_change.rb +66 -0
- data/lib/jss/api_object/management_history.rb +865 -0
- data/lib/jss/api_object/mdm.rb +1298 -0
- data/lib/jss/api_object/mobile_device.rb +241 -644
- data/lib/jss/api_object/mobile_device_application.rb +6 -0
- data/lib/jss/api_object/mobile_device_configuration_profile.rb +36 -0
- data/lib/jss/api_object/osx_configuration_profile.rb +115 -151
- data/lib/jss/api_object/patch.rb +38 -0
- data/lib/jss/api_object/patch_policy.rb +38 -0
- data/lib/jss/api_object/peripheral.rb +5 -7
- data/lib/jss/api_object/policy.rb +5 -0
- data/lib/jss/api_object/restricted_software.rb +5 -0
- data/lib/jss/api_object/scopable/scope.rb +367 -411
- data/lib/jss/api_object/self_servable.rb +15 -4
- data/lib/jss/api_object/sitable.rb +197 -0
- data/lib/jss/api_object/site.rb +45 -76
- data/lib/jss/api_object/user.rb +7 -3
- data/lib/jss/api_object.rb +75 -4
- data/lib/jss/utility.rb +21 -0
- data/lib/jss/version.rb +1 -1
- data/lib/jss.rb +6 -0
- metadata +42 -6
@@ -61,7 +61,7 @@ module JSS
|
|
61
61
|
#
|
62
62
|
#
|
63
63
|
# Classes including this module *MUST*:
|
64
|
-
# - call {#add_self_service_xml()} in their #rest_xml method
|
64
|
+
# - call {#add_self_service_xml(xmldoc)} in their #rest_xml method
|
65
65
|
#
|
66
66
|
# IMPORTANT: Since SelfServable also includes #{JSS::Updatable}, for uploading icons,
|
67
67
|
# see that module for its requirements.
|
@@ -85,6 +85,8 @@ module JSS
|
|
85
85
|
MAKE_AVAILABLE = 'Make Available in Self Service'.freeze
|
86
86
|
AUTO_INSTALL = 'Install Automatically'.freeze
|
87
87
|
AUTO_INSTALL_OR_PROMPT = 'Install Automatically/Prompt Users to Install'.freeze
|
88
|
+
PATCHPOL_SELF_SERVICE = 'selfservice'.freeze # 'Make Available in Self Service' in the UI
|
89
|
+
PATCHPOL_AUTO = 'prompt'.freeze # 'Install Automatically' in the UI
|
88
90
|
|
89
91
|
DEFAULT_INSTALL_BUTTON_TEXT = 'Install'.freeze
|
90
92
|
|
@@ -98,6 +100,15 @@ module JSS
|
|
98
100
|
can_display_in_categories: true,
|
99
101
|
can_feature_in_categories: true
|
100
102
|
},
|
103
|
+
JSS::PatchPolicy => {
|
104
|
+
in_self_service_data_path: [:general, :distribution_method],
|
105
|
+
in_self_service: PATCHPOL_SELF_SERVICE,
|
106
|
+
not_in_self_service: PATCHPOL_AUTO,
|
107
|
+
targets: [:macos],
|
108
|
+
payload: :patchpolicy,
|
109
|
+
can_display_in_categories: false,
|
110
|
+
can_feature_in_categories: false
|
111
|
+
},
|
101
112
|
JSS::MacApplication => { # TODO: add the correct values when Jamf fixes this bug
|
102
113
|
in_self_service_data_path: nil, # [:general, :distribution_method],
|
103
114
|
in_self_service: nil, # MAKE_AVAILABLE,
|
@@ -471,10 +482,10 @@ module JSS
|
|
471
482
|
end
|
472
483
|
|
473
484
|
def validate_icon(id)
|
474
|
-
|
475
|
-
|
476
|
-
end
|
485
|
+
return nil unless JSS::DB_CNX.connected?
|
486
|
+
raise JSS::NoSuchItemError, "No icon with id #{new_icon}" unless JSS::Icon.all_ids.include? id
|
477
487
|
end
|
488
|
+
|
478
489
|
# Re-read the icon data for this object from the API
|
479
490
|
# Generally done after uploading a new icon via {#icon=}
|
480
491
|
#
|
@@ -0,0 +1,197 @@
|
|
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
|
data/lib/jss/api_object/site.rb
CHANGED
@@ -1,99 +1,68 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
27
|
module JSS
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
#####################################
|
32
|
-
|
33
|
-
#####################################
|
34
|
-
### Module Methods
|
35
|
-
#####################################
|
29
|
+
# Classes
|
30
|
+
###################################
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
### A Site in the JSS.
|
44
|
-
###
|
45
|
-
### These are simple, in that they only have an ID and a name.
|
46
|
-
###
|
47
|
-
### @see JSS::APIObject
|
48
|
-
###
|
32
|
+
# A Site in the JSS.
|
33
|
+
#
|
34
|
+
# These are simple, in that they only have an ID and a name.
|
35
|
+
#
|
36
|
+
# @see JSS::APIObject
|
37
|
+
#
|
49
38
|
class Site < JSS::APIObject
|
50
39
|
|
51
|
-
|
52
|
-
|
53
|
-
#####################################
|
40
|
+
# Mix-Ins
|
41
|
+
###################################
|
54
42
|
include JSS::Creatable
|
55
43
|
include JSS::Updatable
|
56
44
|
|
57
|
-
|
58
|
-
|
59
|
-
#####################################
|
60
|
-
|
61
|
-
#####################################
|
62
|
-
### Class Constants
|
63
|
-
#####################################
|
45
|
+
# Class Constants
|
46
|
+
###################################
|
64
47
|
|
65
|
-
|
66
|
-
RSRC_BASE =
|
48
|
+
# The base for REST resources of this class
|
49
|
+
RSRC_BASE = 'sites'.freeze
|
67
50
|
|
68
|
-
|
51
|
+
# the hash key used for the JSON list output of all objects in the JSS
|
69
52
|
RSRC_LIST_KEY = :sites
|
70
53
|
|
71
|
-
|
72
|
-
|
54
|
+
# The hash key used for the JSON object output.
|
55
|
+
# It's also used in various error messages
|
73
56
|
RSRC_OBJECT_KEY = :site
|
74
57
|
|
75
|
-
|
76
|
-
VALID_DATA_KEYS = []
|
58
|
+
# these keys, as well as :id and :name, are present in valid API JSON data for this class
|
59
|
+
VALID_DATA_KEYS = [].freeze
|
77
60
|
|
78
61
|
# the object type for this object in
|
79
62
|
# the object history table.
|
80
63
|
# See {APIObject#add_object_history_entry}
|
81
64
|
OBJECT_HISTORY_OBJECT_TYPE = 44
|
82
65
|
|
83
|
-
#####################################
|
84
|
-
### Attributes
|
85
|
-
#####################################
|
86
|
-
|
87
|
-
#####################################
|
88
|
-
### Constructor
|
89
|
-
#####################################
|
90
|
-
|
91
|
-
|
92
|
-
#####################################
|
93
|
-
### Public Instance Methods
|
94
|
-
#####################################
|
95
|
-
|
96
|
-
|
97
66
|
end # class site
|
98
67
|
|
99
68
|
end # module
|
data/lib/jss/api_object/user.rb
CHANGED
@@ -106,9 +106,13 @@ module JSS
|
|
106
106
|
|
107
107
|
### @return [Array<Hash>]
|
108
108
|
###
|
109
|
-
###
|
109
|
+
### Unlike every other Sitable object, Users
|
110
|
+
### can be in multiple sites, so we don't use
|
111
|
+
### the Sitable mixin module. Instead we'll
|
112
|
+
### we'll store them in this Array, as they come
|
113
|
+
### from the API.
|
110
114
|
###
|
111
|
-
### Each Hash has
|
115
|
+
### Each Hash has the :id and :name for one site
|
112
116
|
###
|
113
117
|
attr_reader :sites
|
114
118
|
|
@@ -267,7 +271,7 @@ module JSS
|
|
267
271
|
|
268
272
|
user << JSS::Site.xml_list(@sites)
|
269
273
|
|
270
|
-
user << ext_attr_xml if
|
274
|
+
user << ext_attr_xml if unsaved_eas?
|
271
275
|
|
272
276
|
return doc.to_s
|
273
277
|
end
|
data/lib/jss/api_object.rb
CHANGED
@@ -483,6 +483,47 @@ module JSS
|
|
483
483
|
new args
|
484
484
|
end
|
485
485
|
|
486
|
+
|
487
|
+
# Delete one or more API objects by jss_id without instantiating them.
|
488
|
+
# Non-existent id's are skipped and an array of skipped ids is returned.
|
489
|
+
#
|
490
|
+
# If an Array is provided, it is passed through #uniq! before being processed.
|
491
|
+
#
|
492
|
+
# @param victims[Integer,Array<Integer>] An object id or an array of them
|
493
|
+
# to be deleted
|
494
|
+
#
|
495
|
+
# @param api[JSS::APIConnection] the API connection to use.
|
496
|
+
# Defaults to the corrently active API. See {JSS::APIConnection}
|
497
|
+
#
|
498
|
+
# @return [Array<Integer>] The id's that didn't exist when we tried to
|
499
|
+
# delete them.
|
500
|
+
#
|
501
|
+
def self.delete(victims, api: JSS.api)
|
502
|
+
raise JSS::UnsupportedError, '.delete can only be called on subclasses of JSS::APIObject' if self == JSS::APIObject
|
503
|
+
raise JSS::InvalidDataError, 'Parameter must be an Integer ID or an Array of them' unless victims.is_a?(Integer) || victims.is_a?(Array)
|
504
|
+
|
505
|
+
case victims
|
506
|
+
when Integer
|
507
|
+
victims = [victims]
|
508
|
+
when Fixnum
|
509
|
+
victims = [victims]
|
510
|
+
when Array
|
511
|
+
victims.uniq!
|
512
|
+
end
|
513
|
+
|
514
|
+
skipped = []
|
515
|
+
current_ids = all_ids :refresh, api: api
|
516
|
+
victims.each do |vid|
|
517
|
+
if current_ids.include? vid
|
518
|
+
api.delete_rsrc "#{self::RSRC_BASE}/id/#{vid}"
|
519
|
+
else
|
520
|
+
skipped << vid
|
521
|
+
end # if current_ids include v
|
522
|
+
end # each victim
|
523
|
+
|
524
|
+
skipped
|
525
|
+
end # self.delete
|
526
|
+
|
486
527
|
### Class Constants
|
487
528
|
#####################################
|
488
529
|
|
@@ -654,11 +695,16 @@ module JSS
|
|
654
695
|
defined? self.class::SELF_SERVABLE
|
655
696
|
end
|
656
697
|
|
657
|
-
# @return [Boolean] See {JSS::
|
698
|
+
# @return [Boolean] See {JSS::Criteriable}
|
658
699
|
def criterable?
|
659
700
|
defined? self.class::CRITERIABLE
|
660
701
|
end
|
661
702
|
|
703
|
+
# @return [Boolean] See {JSS::Sitable}
|
704
|
+
def sitable?
|
705
|
+
defined? self.class::SITABLE
|
706
|
+
end
|
707
|
+
|
662
708
|
# @return [Boolean] See {JSS::extendable}
|
663
709
|
def extendable?
|
664
710
|
defined? self.class::EXTENDABLE
|
@@ -691,8 +737,8 @@ module JSS
|
|
691
737
|
|
692
738
|
# Delete this item from the JSS.
|
693
739
|
#
|
694
|
-
#
|
695
|
-
#
|
740
|
+
# @seealso {APIObject.delete} for deleting
|
741
|
+
# one or more objects by id without needing to instantiate
|
696
742
|
#
|
697
743
|
# Subclasses may want to redefine this method,
|
698
744
|
# first calling super, then setting other attributes to
|
@@ -815,6 +861,17 @@ module JSS
|
|
815
861
|
history
|
816
862
|
end
|
817
863
|
|
864
|
+
# Print the rest_xml value of the object to stdout,
|
865
|
+
# with indentation. Useful for debugging.
|
866
|
+
#
|
867
|
+
# @return [void]
|
868
|
+
#
|
869
|
+
def ppx
|
870
|
+
return nil unless creatable? || updatable?
|
871
|
+
REXML::Document.new(rest_xml).write $stdout, 2
|
872
|
+
puts
|
873
|
+
end
|
874
|
+
|
818
875
|
# Private Instance Methods
|
819
876
|
#####################################
|
820
877
|
private
|
@@ -920,10 +977,11 @@ module JSS
|
|
920
977
|
# many things have a :site
|
921
978
|
# TODO: Implement a Sitable mixin module
|
922
979
|
#
|
923
|
-
@site = JSS::APIObject.get_name(@main_subset[:site]) if @main_subset[:site]
|
980
|
+
# @site = JSS::APIObject.get_name(@main_subset[:site]) if @main_subset[:site]
|
924
981
|
|
925
982
|
##### Handle Mix-ins
|
926
983
|
initialize_category
|
984
|
+
initialize_site
|
927
985
|
initialize_location
|
928
986
|
initialize_purchasing
|
929
987
|
initialize_scope
|
@@ -959,6 +1017,14 @@ module JSS
|
|
959
1017
|
parse_category if categorizable?
|
960
1018
|
end
|
961
1019
|
|
1020
|
+
# parse site data during initialization
|
1021
|
+
#
|
1022
|
+
# @return [void]
|
1023
|
+
#
|
1024
|
+
def initialize_site
|
1025
|
+
parse_site if sitable?
|
1026
|
+
end
|
1027
|
+
|
962
1028
|
# parse location data during initialization
|
963
1029
|
#
|
964
1030
|
# @return [void]
|
@@ -1063,6 +1129,9 @@ require 'jss/api_object/extendable'
|
|
1063
1129
|
require 'jss/api_object/self_servable'
|
1064
1130
|
require 'jss/api_object/categorizable'
|
1065
1131
|
require 'jss/api_object/vppable'
|
1132
|
+
require 'jss/api_object/sitable'
|
1133
|
+
require 'jss/api_object/mdm'
|
1134
|
+
require 'jss/api_object/management_history'
|
1066
1135
|
|
1067
1136
|
### Mix-in Sub Modules with Classes
|
1068
1137
|
require 'jss/api_object/criteriable'
|
@@ -1091,6 +1160,8 @@ require 'jss/api_object/netboot_server'
|
|
1091
1160
|
require 'jss/api_object/network_segment'
|
1092
1161
|
require 'jss/api_object/osx_configuration_profile'
|
1093
1162
|
require 'jss/api_object/package'
|
1163
|
+
require 'jss/api_object/patch'
|
1164
|
+
require 'jss/api_object/patch_policy'
|
1094
1165
|
require 'jss/api_object/peripheral_type'
|
1095
1166
|
require 'jss/api_object/peripheral'
|
1096
1167
|
require 'jss/api_object/policy'
|
data/lib/jss/utility.rb
CHANGED
@@ -558,4 +558,25 @@ module JSS
|
|
558
558
|
pw
|
559
559
|
end
|
560
560
|
|
561
|
+
# un/set devmode mode.
|
562
|
+
# Useful when coding - methods can call JSS.devmode? and then
|
563
|
+
# e.g. spit out something instead of performing some action.
|
564
|
+
#
|
565
|
+
# @param [Symbol] Set devmode :on or :off
|
566
|
+
#
|
567
|
+
# @return [Boolean] The new state of devmode
|
568
|
+
#
|
569
|
+
def self.devmode(setting)
|
570
|
+
@devmode = setting == :on ? true : false
|
571
|
+
end
|
572
|
+
|
573
|
+
|
574
|
+
# is devmode currently on?
|
575
|
+
#
|
576
|
+
# @return [Boolean]
|
577
|
+
#
|
578
|
+
def self.devmode?
|
579
|
+
@devmode
|
580
|
+
end
|
581
|
+
|
561
582
|
end # module
|
data/lib/jss/version.rb
CHANGED
data/lib/jss.rb
CHANGED
@@ -59,6 +59,7 @@ module JSS
|
|
59
59
|
require 'rest-client'
|
60
60
|
require 'json'
|
61
61
|
require 'plist'
|
62
|
+
require 'immutable-struct'
|
62
63
|
|
63
64
|
### Constants
|
64
65
|
#####################################
|
@@ -160,6 +161,8 @@ module JSS
|
|
160
161
|
class NetworkSegment < JSS::APIObject; end
|
161
162
|
class OSXConfigurationProfile < JSS::APIObject; end
|
162
163
|
class Package < JSS::APIObject; end
|
164
|
+
class Patch < JSS::APIObject; end
|
165
|
+
class PatchPolicy < JSS::APIObject; end
|
163
166
|
class PeripheralType < JSS::APIObject; end
|
164
167
|
class Peripheral < JSS::APIObject; end
|
165
168
|
class Policy < JSS::APIObject; end
|
@@ -183,6 +186,9 @@ module JSS
|
|
183
186
|
module SelfServable; end
|
184
187
|
module Categorizable; end
|
185
188
|
module VPPable; end
|
189
|
+
module Sitable; end
|
190
|
+
module MDM; end
|
191
|
+
module ManagementHistory; end
|
186
192
|
|
187
193
|
end # module JSS
|
188
194
|
|