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.

Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +26 -0
  3. data/lib/jamf.rb +8 -13
  4. data/lib/jamf/api/{abstract_classes → base_classes}/collection_resource.rb +6 -5
  5. data/lib/jamf/api/{abstract_classes → base_classes}/json_object.rb +4 -20
  6. data/lib/jamf/api/{abstract_classes → base_classes}/prestage.rb +1 -1
  7. data/lib/jamf/api/{abstract_classes → base_classes}/resource.rb +6 -2
  8. data/lib/jamf/api/{abstract_classes → base_classes}/singleton_resource.rb +3 -2
  9. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
  10. data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
  11. data/lib/jamf/api/json_objects/md_prestage_names.rb +2 -2
  12. data/lib/jamf/api/json_objects/prestage_assignment.rb +2 -2
  13. data/lib/jamf/api/mixins/{abstract.rb → base_class.rb} +34 -16
  14. data/lib/jamf/api/resources/collection_resources/building.rb +0 -4
  15. data/lib/jamf/api/resources/collection_resources/category.rb +0 -1
  16. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +1 -1
  17. data/lib/jamf/api/resources/collection_resources/department.rb +0 -2
  18. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +1 -1
  19. data/lib/jamf/version.rb +1 -1
  20. data/lib/jss/api_connection.rb +1 -36
  21. data/lib/jss/api_object/computer.rb +13 -0
  22. data/lib/jss/api_object/configuration_profile.rb +28 -3
  23. data/lib/jss/api_object/policy.rb +105 -25
  24. data/lib/jss/api_object/scopable/scope.rb +31 -30
  25. data/lib/jss/utility.rb +142 -37
  26. data/lib/jss/version.rb +1 -1
  27. metadata +8 -41
  28. data/lib/jamf/api/abstract_classes/advanced_search.rb +0 -86
  29. data/lib/jamf/api/abstract_classes/generic_reference.rb +0 -153
  30. data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +0 -147
  31. data/lib/jamf/api/json_objects/account_prefs.rb +0 -79
  32. data/lib/jamf/api/json_objects/android_details.rb +0 -139
  33. data/lib/jamf/api/json_objects/appletv_details.rb +0 -110
  34. data/lib/jamf/api/json_objects/attachment.rb +0 -68
  35. data/lib/jamf/api/json_objects/cellular_network.rb +0 -151
  36. data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +0 -80
  37. data/lib/jamf/api/json_objects/criterion.rb +0 -152
  38. data/lib/jamf/api/json_objects/extension_attribute_value.rb +0 -128
  39. data/lib/jamf/api/json_objects/installed_application.rb +0 -59
  40. data/lib/jamf/api/json_objects/installed_certificate.rb +0 -53
  41. data/lib/jamf/api/json_objects/installed_configuration_profile.rb +0 -67
  42. data/lib/jamf/api/json_objects/installed_ebook.rb +0 -58
  43. data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +0 -59
  44. data/lib/jamf/api/json_objects/ios_details.rb +0 -244
  45. data/lib/jamf/api/json_objects/location.rb +0 -95
  46. data/lib/jamf/api/json_objects/mobile_device_details.rb +0 -219
  47. data/lib/jamf/api/json_objects/mobile_device_security.rb +0 -101
  48. data/lib/jamf/api/json_objects/purchasing_data.rb +0 -125
  49. data/lib/jamf/api/mixins/locatable.rb +0 -124
  50. data/lib/jamf/api/mixins/referable.rb +0 -92
  51. data/lib/jamf/api/resources/collection_resources/account.rb +0 -163
  52. data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +0 -52
  53. data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +0 -52
  54. data/lib/jamf/api/resources/collection_resources/computer.rb +0 -49
  55. data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +0 -45
  56. data/lib/jamf/api/resources/collection_resources/mobile_device.rb +0 -315
  57. data/lib/jamf/api/resources/collection_resources/site.rb +0 -77
  58. data/lib/jamf/api/resources/singleton_resources/authorization.rb +0 -88
  59. data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +0 -139
  60. data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +0 -95
@@ -1,92 +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
- module Jamf
27
-
28
- # CollectionResource Class instances with this module mixed-in can be
29
- # referred to in other classes.
30
- #
31
- # Doing so dynamically defines a new 'Reference' class, which is a
32
- # subclass of {Jamf::GenericReference}
33
- #
34
- # Examples:
35
- #
36
- # 1) A Policy can have a category assigned to it, and the policy's API data
37
- # will contain a reference to a category.
38
- #
39
- # Jamf::Policy instances have a :category attribute, which contains an
40
- # instance of Jamf::Category::Reference
41
- #
42
- # Mixing Referable into Jamf::Category automatically creates the class
43
- # Jamf::Category::Reference
44
- #
45
- # 2) The API data for a Jamf::ComputerGroup contains a an Array of references
46
- # to member Jamf::Computers. That Array arrives in JSON like this:
47
- #
48
- # computers: [
49
- # { id: 234, name: 'foobar' },
50
- # { id: 698, name: 'barfoo' }
51
- # ]
52
- #
53
- # Mixing Referable into Jamf::Computer defines the class
54
- # Jamf::Computer::Reference and allows Jamf::ComputerGroups to maintain an
55
- # array of Jamf::Computer::Reference objects representing that list.
56
- # When needed to send to the API, it will send this:
57
- #
58
- # computers: [
59
- # { id: 234 },
60
- # { id: 698 }
61
- # ]
62
- #
63
- # Parsing the API data into Reference instances, and converting them back for
64
- # the API is handled by the Reference class.
65
- #
66
- # TODO: Handle if any references contain keys other than :id and :name.
67
- #
68
- module Referable
69
-
70
- # this will hopefully autoload generic_reference
71
- GENREF = Jamf::GenericReference
72
-
73
- # This is run when Referable is included in some class 'referent'
74
- # It creates class referent::Reference as a subclass of
75
- # GenericReference, and sets the REFERENT_CLASS constant of
76
- # referent::Reference to referent.
77
- #
78
- def self.included(referent)
79
- raise JSS::InvalidDataError, "'#{referent}' is not a subclass of Jamf::CollectionResource, can't include 'Referable'" unless referent.ancestors.include? Jamf::CollectionResource
80
- referent.const_set :Reference, Class.new(GENREF)
81
- referent::Reference.const_set :REFERENT_CLASS, referent
82
- end
83
-
84
- # @return [self.class::GenericReference] A reference to this object.
85
- #
86
- def reference
87
- @reference ||= self.class::Reference.new self
88
- end
89
-
90
- end # module Referable
91
-
92
- end # module
@@ -1,163 +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
- # An administrator account in the JSS
33
- #
34
- # ISSUES FOR JAMF:
35
- # - Seems like there needs to be some cleanup/coordination
36
- # with the endpoints GET/auth, POST/auth/current, and GET/user
37
- # Things are currently wonky enough that I can't really move forward
38
- # with this class.
39
- #
40
- class Account < Jamf::JSONObject
41
-
42
- # Constants
43
- #####################################
44
-
45
- ACCESS_LEVEL_FULL = 'FullAccess'.freeze
46
- ACCESS_LEVEL_SITE = 'SiteAccess'.freeze,
47
- ACCESS_LEVEL_GROUP = 'GroupBasedAccess'.freeze
48
-
49
- ACCESS_LEVELS = [
50
- ACCESS_LEVEL_FULL,
51
- ACCESS_LEVEL_SITE,
52
- ACCESS_LEVEL_GROUP
53
- ].freeze
54
-
55
- PRIVILEGE_SET_ADMIN = 'ADMINISTRATOR'.freeze
56
- PRIVILEGE_SET_AUDITOR = 'AUDITOR'.freeze
57
- PRIVILEGE_SET_ENROLL = 'ENROLLMENT'.freeze
58
- PRIVILEGE_SET_CUSTOM = 'CUSTOM'.freeze
59
-
60
- PRIVILEGE_SETS = [
61
- PRIVILEGE_SET_ADMIN,
62
- PRIVILEGE_SET_AUDITOR,
63
- PRIVILEGE_SET_ENROLL,
64
- PRIVILEGE_SET_CUSTOM
65
- ].freeze
66
-
67
- # Object Model / Attributes
68
- # See APIObject class documentation for details
69
- # of how the OBJECT_MODEL hash works.
70
- #####################################
71
- OBJECT_MODEL = {
72
- # @!attribute [r] id
73
- # @return [Integer]
74
- id: {
75
- class: :integer,
76
- readonly: true
77
- },
78
-
79
- # @!attribute [r] username
80
- # @return [String]
81
- username: {
82
- class: :string,
83
- readonly: true
84
- },
85
-
86
- # @!attribute [r] realName
87
- # @return [String]
88
- realName: {
89
- class: :string,
90
- readonly: true
91
- },
92
-
93
- # @!attribute [r] email
94
- # @return [String]
95
- email: {
96
- class: :string,
97
- readonly: true
98
- },
99
-
100
- # @!attribute [r] preferences
101
- # @return [String]
102
- preferences: {
103
- class: Jamf::AccountPreferences,
104
- readonly: true
105
- },
106
-
107
- # @!attribute [r] isMultiSiteAdmin
108
- # @return [Boolean]
109
- isMultiSiteAdmin: {
110
- class: :boolean,
111
- readonly: true
112
- },
113
-
114
- # @!attribute [r] accessLevel
115
- # @return [String]
116
- accessLevel: {
117
- class: :string,
118
- readonly: true,
119
- enum: Jamf::Account::ACCESS_LEVELS
120
- },
121
-
122
- # @!attribute [r] accessLevel
123
- # @return [String]
124
- privilegeSet: {
125
- class: :string,
126
- readonly: true,
127
- enum: Jamf::Account::PRIVILEGE_SETS
128
- },
129
-
130
- }.freeze
131
- parse_object_model
132
-
133
- # CurrentAccount {
134
- # id (integer, optional),
135
- # username (string, optional),
136
- # realName (string, optional),
137
- # email (string, optional),
138
- # preferences (AccountPreferences, optional),
139
- # isMultiSiteAdmin (boolean, optional),
140
- # accessLevel (string, optional) = ['FullAccess', 'SiteAccess', 'GroupBasedAccess'],
141
- # privilegeSet (string, optional) = ['ADMINISTRATOR', 'AUDITOR', 'ENROLLMENT', 'CUSTOM'],
142
- # privileges (Array[string], optional),
143
- # groupIds (Array[integer], optional),
144
- # currentSiteId (integer, optional)
145
- # }
146
-
147
- # Account/AuthAccount {
148
- # id (integer, optional),
149
- # username (string, optional),
150
- # realName (string, optional),
151
- # email (string, optional),
152
- # preferences (AccountPreferences, optional),
153
- # isMultiSiteAdmin (boolean, optional),
154
- # accessLevel (string, optional) = ['FullAccess', 'SiteAccess', 'GroupBasedAccess'],
155
- # privilegeSet (string, optional) = ['ADMINISTRATOR', 'AUDITOR', 'ENROLLMENT', 'CUSTOM'],
156
- # privilegesBySite (object, optional),
157
- # groupIds (Array[integer], optional),
158
- # currentSiteId (integer, optional)
159
- # }
160
-
161
- end # class
162
-
163
- end # module
@@ -1,52 +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
- # A Computer Prestage
33
- class AdvancedMobileDeviceSearch < Jamf::AdvancedSearch
34
-
35
- # Constants
36
- #####################################
37
-
38
- RSRC_VERSION = 'v1'.freeze
39
-
40
- RSRC_PATH = 'advanced-mobile-device-searches'.freeze
41
-
42
- # Object Model / Attributes
43
- # See APIObject class documentation for details
44
- # of how the OBJECT_MODEL hash works.
45
- #####################################
46
- OBJECT_MODEL = superclass::OBJECT_MODEL
47
-
48
- parse_object_model
49
-
50
- end # class
51
-
52
- end # module
@@ -1,52 +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
- # A Computer Prestage
33
- class AdvancedUserSearch < Jamf::AdvancedSearch
34
-
35
- # Constants
36
- #####################################
37
-
38
- RSRC_VERSION = 'v1'.freeze
39
-
40
- RSRC_PATH = 'advanced-user-content-searches'.freeze
41
-
42
- # Object Model / Attributes
43
- # See APIObject class documentation for details
44
- # of how the OBJECT_MODEL hash works.
45
- #####################################
46
- OBJECT_MODEL = superclass::OBJECT_MODEL
47
-
48
- parse_object_model
49
-
50
- end # class
51
-
52
- end # module
@@ -1,49 +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
- # A building defined in the JSS
33
- class Computer < Jamf::CollectionResource
34
-
35
- # Mix-Ins
36
- #####################################
37
- include Jamf::Referable
38
-
39
- # Constants
40
- #####################################
41
-
42
- RSRC_PATH = 'inventory/obj/computer'.freeze
43
-
44
- OBJECT_MODEL = {}.freeze
45
- parse_object_model
46
-
47
- end # class
48
-
49
- end # module
@@ -1,45 +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
- # An extension attribute in Jamf Pro
30
- class ExtensionAttribute < Jamf::CollectionResource
31
-
32
- VALUE_TYPES = {
33
- string: 'STRING',
34
- integer: 'INTEGER',
35
- date: 'DATE'
36
- }.freeze
37
-
38
- OBJECT_MODEL = {
39
-
40
- }.freeze
41
- parse_object_model
42
-
43
- end # class ext attr
44
-
45
- end # module