ruby-jss 1.4.1 → 1.6.0

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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +95 -0
  3. data/THANKS.md +3 -2
  4. data/lib/jamf.rb +18 -17
  5. data/lib/jamf/api/base_classes/collection_resource.rb +613 -0
  6. data/lib/jamf/api/{abstract_classes → base_classes}/json_object.rb +109 -101
  7. data/lib/jamf/api/{abstract_classes → base_classes}/prestage.rb +55 -30
  8. data/lib/jamf/api/{abstract_classes → base_classes}/resource.rb +10 -6
  9. data/lib/jamf/api/{abstract_classes → base_classes}/singleton_resource.rb +4 -3
  10. data/lib/jamf/api/connection.rb +13 -9
  11. data/lib/jamf/api/connection/api_error.rb +8 -8
  12. data/lib/jamf/api/connection/token.rb +16 -15
  13. data/lib/jamf/api/json_objects/device_enrollment_device.rb +14 -7
  14. data/lib/jamf/api/json_objects/{location.rb → device_enrollment_device_sync_state.rb} +27 -41
  15. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
  16. data/lib/jamf/api/json_objects/{attachment.rb → locale.rb} +14 -23
  17. data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
  18. data/lib/jamf/api/json_objects/md_prestage_names.rb +2 -2
  19. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +50 -1
  20. data/lib/jamf/api/json_objects/prestage_assignment.rb +2 -2
  21. data/lib/jamf/api/json_objects/prestage_location.rb +3 -3
  22. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +7 -7
  23. data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
  24. data/lib/jamf/api/{resources/collection_resources → json_objects}/time_zone.rb +9 -23
  25. data/lib/jamf/api/mixins/{abstract.rb → base_class.rb} +34 -16
  26. data/lib/jamf/api/mixins/bulk_deletable.rb +27 -6
  27. data/lib/jamf/api/mixins/change_log.rb +201 -51
  28. data/lib/jamf/api/{resources/collection_resources/computer.rb → mixins/filterable.rb} +19 -17
  29. data/lib/jamf/api/mixins/pageable.rb +208 -0
  30. data/lib/jamf/api/{json_objects/installed_application.rb → mixins/sortable.rb} +33 -33
  31. data/lib/jamf/api/resources/collection_resources/building.rb +16 -9
  32. data/lib/jamf/api/resources/collection_resources/category.rb +5 -4
  33. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +12 -5
  34. data/lib/jamf/api/resources/collection_resources/department.rb +0 -2
  35. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +10 -10
  36. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +11 -3
  37. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +25 -23
  38. data/lib/jamf/api/resources/collection_resources/script.rb +61 -25
  39. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +15 -5
  40. data/lib/jamf/api/resources/singleton_resources/locales.rb +155 -0
  41. data/lib/jamf/api/resources/singleton_resources/time_zones.rb +213 -0
  42. data/lib/jamf/client.rb +3 -3
  43. data/lib/jamf/client/management_action.rb +2 -3
  44. data/lib/jamf/composer.rb +2 -2
  45. data/lib/jamf/utility.rb +35 -7
  46. data/lib/jamf/validate.rb +63 -24
  47. data/lib/jamf/version.rb +1 -1
  48. data/lib/jss.rb +2 -2
  49. data/lib/jss/api_connection.rb +114 -406
  50. data/lib/jss/api_object.rb +3 -19
  51. data/lib/jss/api_object/categorizable.rb +1 -1
  52. data/lib/jss/api_object/computer.rb +13 -0
  53. data/lib/jss/api_object/configuration_profile.rb +61 -5
  54. data/lib/jss/api_object/directory_binding_type.rb +66 -60
  55. data/lib/jss/api_object/directory_binding_type/active_directory.rb +71 -34
  56. data/lib/jss/api_object/directory_binding_type/admitmac.rb +536 -467
  57. data/lib/jss/api_object/directory_binding_type/centrify.rb +21 -7
  58. data/lib/jss/api_object/directory_binding_type/open_directory.rb +4 -4
  59. data/lib/jss/api_object/distribution_point.rb +2 -2
  60. data/lib/jss/api_object/dock_item.rb +102 -96
  61. data/lib/jss/api_object/extendable.rb +1 -1
  62. data/lib/jss/api_object/group.rb +33 -2
  63. data/lib/jss/api_object/network_segment.rb +45 -13
  64. data/lib/jss/api_object/patch_source.rb +10 -9
  65. data/lib/jss/api_object/policy.rb +155 -25
  66. data/lib/jss/api_object/printer.rb +10 -4
  67. data/lib/jss/api_object/scopable.rb +10 -15
  68. data/lib/jss/api_object/scopable/scope.rb +31 -30
  69. data/lib/jss/api_object/script.rb +242 -352
  70. data/lib/jss/api_object/user.rb +1 -1
  71. data/lib/jss/client/management_action.rb +1 -2
  72. data/lib/jss/composer.rb +2 -2
  73. data/lib/jss/exceptions.rb +3 -0
  74. data/lib/jss/server.rb +15 -0
  75. data/lib/jss/utility.rb +213 -45
  76. data/lib/jss/version.rb +1 -1
  77. metadata +46 -64
  78. data/lib/jamf/api/abstract_classes/advanced_search.rb +0 -86
  79. data/lib/jamf/api/abstract_classes/collection_resource.rb +0 -433
  80. data/lib/jamf/api/abstract_classes/generic_reference.rb +0 -145
  81. data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +0 -126
  82. data/lib/jamf/api/json_objects/account_prefs.rb +0 -79
  83. data/lib/jamf/api/json_objects/android_details.rb +0 -139
  84. data/lib/jamf/api/json_objects/appletv_details.rb +0 -110
  85. data/lib/jamf/api/json_objects/cellular_network.rb +0 -151
  86. data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +0 -67
  87. data/lib/jamf/api/json_objects/criterion.rb +0 -152
  88. data/lib/jamf/api/json_objects/extension_attribute_value.rb +0 -128
  89. data/lib/jamf/api/json_objects/installed_certificate.rb +0 -53
  90. data/lib/jamf/api/json_objects/installed_configuration_profile.rb +0 -67
  91. data/lib/jamf/api/json_objects/installed_ebook.rb +0 -58
  92. data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +0 -59
  93. data/lib/jamf/api/json_objects/ios_details.rb +0 -244
  94. data/lib/jamf/api/json_objects/mobile_device_details.rb +0 -219
  95. data/lib/jamf/api/json_objects/mobile_device_security.rb +0 -101
  96. data/lib/jamf/api/json_objects/purchasing_data.rb +0 -125
  97. data/lib/jamf/api/mixins/locatable.rb +0 -124
  98. data/lib/jamf/api/mixins/referable.rb +0 -92
  99. data/lib/jamf/api/resources/collection_resources/account.rb +0 -163
  100. data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +0 -52
  101. data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +0 -52
  102. data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +0 -45
  103. data/lib/jamf/api/resources/collection_resources/mobile_device.rb +0 -315
  104. data/lib/jamf/api/resources/collection_resources/site.rb +0 -77
  105. data/lib/jamf/api/resources/singleton_resources/authorization.rb +0 -88
  106. data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +0 -139
  107. data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +0 -95
@@ -1,145 +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
- # This class is a reference to an individual API object from some other
29
- # API object.
30
- #
31
- # This class is subclassed automatically when the {Jamf::Referable} module
32
- # is included into a class.
33
- #
34
- # See {Jamf::Referable} for how to use the subclasses of GenericReference.
35
- #
36
- # Subclasses must define:
37
- #
38
- # REFERENT_CLASS - the full class to which this is a reference
39
- # e.g. for BuildingReference it would be Jamf::Building
40
- #
41
- # Defining REFERENT_CLASS is handled automatically by including the
42
- # Referable module
43
- #
44
- # @abstract
45
- #
46
- class GenericReference < Jamf::JSONObject
47
-
48
- extend Jamf::Abstract
49
-
50
- # Constants
51
- #####################################
52
-
53
- OBJECT_MODEL = {
54
-
55
- id: {
56
- class: :integer,
57
- identifier: :primary,
58
- readonly: true
59
- },
60
-
61
- name: {
62
- class: :string,
63
- readonly: true
64
- }
65
-
66
- }.freeze
67
- parse_object_model
68
-
69
- # Constructor
70
- #####################################
71
-
72
- # Make a new reference to an API CollectionResource Object
73
- #
74
- # The data parameter can be one of:
75
- #
76
- # 1) A Hash with an :id and :name
77
- # This is mostly used automatically when parsing fetched API data.
78
- # When some attribute of an OBJECT_MODEL has `class: Someclass::Reference`
79
- # the JSON hash from the API will be passed as the data param.
80
- #
81
- # e.g.
82
- # - Policy::OBJECT_MODEL[:category][:class] is Jamf::Category::Reference
83
- # - the policy JSON from the api might contain `category: { id: 234, name: 'foobar' }`
84
- # - that hash will be passed into Jamf::Category::Reference.new, and the
85
- # resulting instance used as the value of the policy's :category attribute.
86
- #
87
- # 2) An instance of the REFERENT_CLASS.
88
- # This can be used to make a reference to some specific instance of
89
- # the referent class.
90
- #
91
- # e.g. if you have an instance of Category in the variable `my_cat`
92
- # then `ref_to_my_cat = Category::Reference.new my_cat` will work as
93
- # expected.
94
- #
95
- # 3) A valid identifier for an existing REFERENT_CLASS in the JSS.
96
- # The given value will be used with the REFERENT_CLASS's .valid_id method
97
- # to see if there's a matching instance, which the reference refers to.
98
- #
99
- # e.g. `ref_to_my_cat = Category::Reference.new 12` creates a reference
100
- # to Category id 12, and `ref_to_my_cat = Category::Reference.new 'foo'`
101
- # creates a reference to the category named 'foo' - assuming they exist.
102
- #
103
- # The last two of these are commonly used with setters for attributes that
104
- # have class: <some reference class>
105
- #
106
- # e.g. setting the category of a policy when
107
- # Policy::OBJECT_MODEL[:category] is Category::Reference
108
- #
109
- # `mypolicy.category = a_cat` # a_cat is a Category instance
110
- # `mypolicy.category = 12` # use categoty id 12
111
- # `mypolicy.category = 'foo'` # use categoty named 'foo'
112
- #
113
- #
114
- #
115
- # @param data[Hash,CollectionResource,String,Integer]
116
- #
117
- def initialize(data, cnx: Jamf.cnx)
118
- ref_class = self.class::REFERENT_CLASS
119
- case data
120
- when Hash
121
- super
122
- when ref_class
123
- raise Jamf::InvalidDataError, "Provided #{ref_class} hasn't been created" unless data.exist?
124
- @id = data.id
125
- @name = data.name if data.respond_to? :name
126
- @cnx = data.cnx
127
- when nil
128
- @id = nil
129
- @name = nil
130
- @cnx = cnx
131
- else
132
- @id = ref_class.valid_id data, cnx: cnx
133
- raise "No matching #{ref_class}" unless @id
134
- @name = ref_class.map_all(:id, to: :name, cnx: cnx)[@id]
135
- end
136
- end
137
-
138
- def to_jamf
139
- return nil if @id.nil?
140
- { id: @id }
141
- end
142
-
143
- end # class
144
-
145
- end # module
@@ -1,126 +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 class that represents the 'Skip' settings for
30
- # various Setup options in a DEP prestage
31
- # The object model here includes the attributes common
32
- # to both Computer and MobileDevice prestages
33
- class PrestageSkipSetupItems < Jamf::JSONObject
34
-
35
- extend Jamf::Abstract
36
-
37
- OBJECT_MODEL = {
38
-
39
- # @!attribute Appearance
40
- # @return [Boolean]
41
- Appearance: {
42
- class: :boolean,
43
- aliases: %i[appearance]
44
- },
45
-
46
- # @!attribute AppleID
47
- # @return [Boolean]
48
- AppleID: {
49
- class: :boolean,
50
- aliases: %i[appleID appleid apple_id]
51
- },
52
-
53
- # @!attribute Biometric
54
- # @return [Boolean]
55
- Biometric: {
56
- class: :boolean,
57
- aliases: %i[biometric]
58
- },
59
-
60
- # @!attribute Diagnostics
61
- # @return [Boolean]
62
- Diagnostics: {
63
- class: :boolean,
64
- aliases: %i[diagnostics]
65
- },
66
-
67
- # @!attribute DisplayTone
68
- # @return [Boolean]
69
- DisplayTone: {
70
- class: :boolean,
71
- aliases: %i[displaytone display_tone]
72
- },
73
-
74
- # @!attribute Location
75
- # @return [Boolean]
76
- Location: {
77
- class: :boolean,
78
- aliases: %i[location]
79
- },
80
-
81
- # @!attribute Payment
82
- # @return [Boolean]
83
- Payment: {
84
- class: :boolean,
85
- aliases: %i[payment]
86
- },
87
-
88
- # @!attribute Privacy
89
- # @return [Boolean]
90
- Privacy: {
91
- class: :boolean,
92
- aliases: %i[privacy]
93
- },
94
-
95
- # @!attribute Restore
96
- # @return [Boolean]
97
- Restore: {
98
- class: :boolean,
99
- aliases: %i[restore]
100
- },
101
-
102
- # @!attribute ScreenTime
103
- # @return [Boolean]
104
- ScreenTime: {
105
- class: :boolean,
106
- aliases: %i[screenTime screentime]
107
- },
108
-
109
- # @!attribute Siri
110
- # @return [Boolean]
111
- Siri: {
112
- class: :boolean,
113
- aliases: %i[siri]
114
- },
115
-
116
- # @!attribute TOS
117
- # @return [Boolean]
118
- TOS: {
119
- class: :boolean,
120
- aliases: %i[tos terms_of_service]
121
- }
122
- }.freeze
123
-
124
- end # class location
125
-
126
- end # module
@@ -1,79 +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
- # Preferences for an administrator account in the JSS
33
- class AccountPreferences < Jamf::JSONObject
34
-
35
- # Object Model / Attributes
36
- # See APIObject class documentation for details
37
- # of how the OBJECT_MODEL hash works.
38
- #####################################
39
- OBJECT_MODEL = {
40
-
41
- # @!attribute [r] language
42
- # @return [String]
43
- language: {
44
- class: :string,
45
- readonly: true
46
- },
47
-
48
- # @!attribute [r] dateFormat
49
- # @return [String]
50
- dateFormat: {
51
- class: :string,
52
- readonly: true
53
- },
54
-
55
- # @!attribute [r] region
56
- # @return [String]
57
- region: {
58
- class: :string,
59
- readonly: true
60
- },
61
- # @!attribute [r] timezone
62
- # @return [String]
63
- timezone: {
64
- class: :string,
65
- readonly: true
66
- },
67
-
68
- # @!attribute [r] isDisableRelativeDates
69
- # @return [String]
70
- isDisableRelativeDates: {
71
- class: :boolean,
72
- readonly: true
73
- }
74
- }.freeze
75
- parse_object_model
76
-
77
- end # class
78
-
79
- end # module
@@ -1,139 +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
- class AndroidDetails < Jamf::JSONObject
30
-
31
- # Class Constants
32
- #####################################
33
-
34
- OBJECT_MODEL = {
35
-
36
- # @!attribute [r] osName
37
- # @return [String]
38
- osName: {
39
- class: :string,
40
- readonly: true
41
- },
42
-
43
- # @!attribute [r] manufacturer
44
- # @return [String]
45
- manufacturer: {
46
- class: :string,
47
- readonly: true
48
- },
49
-
50
- # @!attribute [r] model
51
- # @return [String]
52
- model: {
53
- class: :string,
54
- readonly: true
55
- },
56
-
57
- # @!attribute [r] internalCapacityMb
58
- # @return [Integer]
59
- internalCapacityMb: {
60
- class: :integer,
61
- readonly: true
62
- },
63
-
64
- # @!attribute [r] internalAvailableMb
65
- # @return [Integer]
66
- internalAvailableMb: {
67
- class: :integer,
68
- readonly: true
69
- },
70
-
71
- # @!attribute [r] internalPercentUsed
72
- # @return [Integer]
73
- internalPercentUsed: {
74
- class: :integer,
75
- readonly: true
76
- },
77
-
78
- # @!attribute [r] externalCapacityMb
79
- # @return [Integer]
80
- externalCapacityMb: {
81
- class: :integer,
82
- readonly: true
83
- },
84
-
85
- # @!attribute [r] externalAvailableMb
86
- # @return [Integer]
87
- externalAvailableMb: {
88
- class: :integer,
89
- readonly: true
90
- },
91
-
92
- # @!attribute [r] externalPercentUsed
93
- # @return [Integer]
94
- externalPercentUsed: {
95
- class: :integer,
96
- readonly: true
97
- },
98
-
99
- # @!attribute [r] batteryLevel
100
- # @return [Integer]
101
- batteryLevel: {
102
- class: :integer,
103
- readonly: true
104
- },
105
-
106
- # @!attribute [r] lastBackupTimestamp
107
- # @return [Jamf::Timestamp]
108
- lastBackupTimestamp: {
109
- class: Jamf::Timestamp,
110
- readonly: true,
111
- aliases: %i[lastBackup]
112
- },
113
-
114
- # @!attribute [r] apiVersion
115
- # @return [Integer]
116
- apiVersion: {
117
- class: :integer,
118
- readonly: true
119
- },
120
-
121
- # @!attribute [r] computer
122
- # @return [Jamf::Computer::Reference]
123
- computer: {
124
- class: Jamf::Computer::Reference,
125
- readonly: true
126
- },
127
-
128
- # @!attribute [r] security
129
- # @return [Jamf::MobileDevic:Security]
130
- security: {
131
- class: Jamf::MobileDeviceSecurity,
132
- readonly: true
133
- }
134
- }.freeze
135
- parse_object_model
136
-
137
- end # class Details
138
-
139
- end # module