windoo 1.0.1

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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.md +9 -0
  3. data/LICENSE.txt +177 -0
  4. data/README.md +222 -0
  5. data/lib/windoo/base_classes/array_manager.rb +335 -0
  6. data/lib/windoo/base_classes/criteria_manager.rb +327 -0
  7. data/lib/windoo/base_classes/criterion.rb +226 -0
  8. data/lib/windoo/base_classes/json_object.rb +472 -0
  9. data/lib/windoo/configuration.rb +221 -0
  10. data/lib/windoo/connection/actions.rb +152 -0
  11. data/lib/windoo/connection/attributes.rb +156 -0
  12. data/lib/windoo/connection/connect.rb +402 -0
  13. data/lib/windoo/connection/constants.rb +55 -0
  14. data/lib/windoo/connection/token.rb +489 -0
  15. data/lib/windoo/connection.rb +92 -0
  16. data/lib/windoo/converters.rb +31 -0
  17. data/lib/windoo/exceptions.rb +34 -0
  18. data/lib/windoo/mixins/api_collection.rb +408 -0
  19. data/lib/windoo/mixins/constants.rb +43 -0
  20. data/lib/windoo/mixins/default_connection.rb +75 -0
  21. data/lib/windoo/mixins/immutable.rb +34 -0
  22. data/lib/windoo/mixins/loading.rb +38 -0
  23. data/lib/windoo/mixins/patch/component.rb +102 -0
  24. data/lib/windoo/mixins/software_title/extension_attribute.rb +106 -0
  25. data/lib/windoo/mixins/utility.rb +23 -0
  26. data/lib/windoo/objects/capability.rb +82 -0
  27. data/lib/windoo/objects/capability_manager.rb +52 -0
  28. data/lib/windoo/objects/component.rb +99 -0
  29. data/lib/windoo/objects/component_criteria_manager.rb +26 -0
  30. data/lib/windoo/objects/component_criterion.rb +66 -0
  31. data/lib/windoo/objects/extension_attribute.rb +149 -0
  32. data/lib/windoo/objects/kill_app.rb +92 -0
  33. data/lib/windoo/objects/kill_app_manager.rb +89 -0
  34. data/lib/windoo/objects/patch.rb +235 -0
  35. data/lib/windoo/objects/patch_manager.rb +240 -0
  36. data/lib/windoo/objects/requirement.rb +85 -0
  37. data/lib/windoo/objects/requirement_manager.rb +52 -0
  38. data/lib/windoo/objects/software_title.rb +407 -0
  39. data/lib/windoo/validate.rb +548 -0
  40. data/lib/windoo/version.rb +15 -0
  41. data/lib/windoo/zeitwerk_config.rb +158 -0
  42. data/lib/windoo.rb +56 -0
  43. metadata +141 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 412deb5f7a47fb7691614ba59c591e26af98a8c1ad9c56435e0e51c11641d00f
4
+ data.tar.gz: 046c5845e667906f3826a386975063c7d95ee460e9afb8fb1ce3d135429fe251
5
+ SHA512:
6
+ metadata.gz: b2d45e41777ddad578b9ee371f633f0bd76bbc023188005a7a333b782b0a0ef78c0ea17dc8b85dfbe4ef8c3fbff0e9dffa95d697647814c5261e012c7d57b4d7
7
+ data.tar.gz: ff3c727c4bfda205c7abda044ee06344098274ff6a29bf6aeea9eb3c17e48092e299ecc4a2fa76d649b1d09282dc22f67c8646f35c21639ef3a7e4a9edb181b3
data/CHANGES.md ADDED
@@ -0,0 +1,9 @@
1
+ # Windoo Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
+
6
+
7
+ ## \[1.0.1] - 2025-09-28
8
+
9
+ Initial public release.
data/LICENSE.txt ADDED
@@ -0,0 +1,177 @@
1
+
2
+ TOMORROW OPEN SOURCE TECHNOLOGY LICENSE 1.0
3
+
4
+ The Tomorrow Open Source Technology License 1.0 differs from the original Apache License 2.0 in the following manner. The scope of the trademark grant in section 6 is different.
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor
141
+ and its affiliates, except as required to comply with Section 4(c) of
142
+ the License and to reproduce the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
data/README.md ADDED
@@ -0,0 +1,222 @@
1
+ # Windoo - a colleague of Kinobi
2
+
3
+ Windoo provides a Ruby interface to the REST API of the [Jamf Title Editor](https://docs.jamf.com/title-editor/documentation/About_Title_Editor.html), formerly known as 'Kinobi'.
4
+
5
+ It works very much like [ruby-jss](http://pixaranimationstudios.github.io/ruby-jss/index.html), with a huge, important difference:
6
+
7
+ **Changes made to Ruby objects happen immediately on the server** There is no need to '.save' anything, but be very careful as you make changes!
8
+
9
+ As with ruby-jss, the entire API is not implemented here, only the objects necessary to maintain Software Titles. For other purposes (Acct management, overall settings, etc) please use the Title Editor Web UI.
10
+
11
+ See also:
12
+ - [Documentation about using the Title Editor via its GUI WebApp](https://docs.jamf.com/title-editor/documentation/index.html)
13
+ - [Documentation about the underlying REST API used by Windoo](https://developer.jamf.com/title-editor/reference)
14
+
15
+ Usage:
16
+
17
+ ```ruby
18
+ require 'windoo'
19
+
20
+ #### CONNECT
21
+ #####################################
22
+
23
+ url = 'https://mylogin@a1b2c3d4.appcatalog.jamfcloud.com'
24
+
25
+ # Connect the default connection.
26
+ Windoo.connect url, pw: :prompt
27
+
28
+ #### SOFTWARE TITLES
29
+ #####################################
30
+ # All access to API objects happens through the SoftewareTitle that contains them.
31
+ # So to work with Requirements, Patches, KillApps, ExtensionAttributes, etc... you must
32
+ # fetch or create the SoftwareTitle that they are a part of.
33
+
34
+ # Get an Array of Hashes with summary data about all existing SoftwareTitles
35
+ all_titles = Windoo::SoftwareTitle.all
36
+
37
+ # Create a SoftwareTitle. This happens immediately on the server
38
+ test_title = Windoo::SoftwareTitle.create(
39
+ id: 'com.mycompany.windoo.test-0-rama',
40
+ name: 'Windoo Test Oh Rama',
41
+ publisher: 'My Company',
42
+ currentVersion: '0.0.1b1'
43
+ )
44
+
45
+ # or fetch an existing one by softwareTitleId or 'id'
46
+ title = Windoo::SoftwareTitle.fetch softwareTitleId: test_title.softwareTitleId
47
+ title = Windoo::SoftwareTitle.fetch id: test_title.id
48
+
49
+ # update title attributes, these are immediately changed on the server
50
+ title.id = 'com.mycompany.windootest'
51
+ title.name = 'Windoo Test'
52
+ title.publisher = 'My Company, Inc.'
53
+ title.currentVersion = '0.0.1a1'
54
+
55
+ # To delete the title, use 'title.delete'
56
+
57
+ #### EXTENSION ATTRIBUTES
58
+ #####################################
59
+
60
+ # add an extension attribute to the title, there can only be one per title
61
+ title.add_extensionAttribute(
62
+ key: 'can-run-windoo-test1',
63
+ displayName: 'Can Run Windoo Test1',
64
+ script: "#!/bin/bash\necho <result>UBETCHA!</result>"
65
+ )
66
+
67
+ # update EA attributes
68
+ title.extensionAttribute.key = 'can-run-windoo-test'
69
+ title.extensionAttribute.displayName = 'Can Run Windoo Test'
70
+ title.extensionAttribute.script = "#!/bin/bash\necho <result>yes</result>"
71
+
72
+ # delete the EA with: title.delete_extensionAttribute
73
+
74
+ #### REQUIREMENTS - criteria identifying macs that have any version of this Title installed
75
+ #####################################
76
+
77
+ # add two requirements
78
+ title.requirements.add_criterion(
79
+ name: 'Application Title',
80
+ operator: 'is',
81
+ value: 'WindooTest.app'
82
+ )
83
+
84
+ title.requirements.add_criterion(
85
+ name: 'Application Bundle ID',
86
+ operator: 'is',
87
+ value: 'com.mycompany.windootest1',
88
+ and_or: :or
89
+ )
90
+
91
+ # Criteria like these are used in requirements, patch capabilities, and patch component criteria
92
+ # Criteria are immutable, if you need to change one, you can replace it with a new one
93
+ # like this:
94
+
95
+ req_id = title.requirements.find_by_attr(:name, 'Application Bundle ID').requirementId
96
+
97
+ title.requirements.replace_criterion(
98
+ req_id,
99
+ name: 'Application Bundle ID',
100
+ operator: 'is',
101
+ value: 'com.mycompany.windootest',
102
+ and_or: :or
103
+ )
104
+
105
+ # To delete a requirement: title.requirements.delete_criterion requirementId
106
+
107
+ #### PATCHES
108
+ #####################################
109
+
110
+ # add a patch
111
+ new_patch_id = title.patches.add_patch(
112
+ version: '0.0.1a1',
113
+ minimumOperatingSystem: '10.14.0',
114
+ releaseDate: Time.now,
115
+ reboot: false,
116
+ standalone: true
117
+ )
118
+
119
+ # update attributes of a patch
120
+ title.patches.update_patch new_patch_id, version: '0.0.1a2', releaseDate: Time.now
121
+
122
+ # add another. New patches are added to the front of the list by default, with the
123
+ # assumption that they are newer versions than the patches that already exist.
124
+ title.patches.add_patch(
125
+ version: '0.0.1a3',
126
+ minimumOperatingSystem: '10.14.4',
127
+ releaseDate: Time.now
128
+ )
129
+
130
+ #### KILLAPPS
131
+ #####################################
132
+
133
+ # add a killApp to a patch
134
+ patch = title.patches.first
135
+
136
+ kaid = patch.killApps.add_killApp(
137
+ appName: 'WindooTest.app',
138
+ bundleId: 'com.mycompany.windootest1'
139
+ )
140
+
141
+ # Update a killApp attribute
142
+ patch.killApps.update_killApp kaid, bundleId: 'com.mycompany.windootest'
143
+
144
+ # delete a killApp
145
+ patch.killApps.delete_killApp kaid
146
+
147
+ ##### CAPABILITIES - criteria identifying macs that can install/run this patch
148
+ #####################################
149
+
150
+ # Add some criteria...
151
+
152
+ patch.capabilities.add_criterion(
153
+ name: 'Total RAM MB',
154
+ operator: 'more than',
155
+ value: 16_374
156
+ )
157
+
158
+ patch.capabilities.add_criterion(
159
+ name: 'Computer Group',
160
+ operator: 'member of',
161
+ value: 'someGroupName'
162
+ )
163
+
164
+ patch.capabilities.add_criterion(
165
+ name: 'Operating System Version',
166
+ operator: 'greater than or equal',
167
+ value: patch.minimumOperatingSystem
168
+ )
169
+
170
+ # To make a criterion that uses the value returned by the extension
171
+ # attribute for this title, you must use its 'key' as the 'name', and
172
+ # the 'type' must be 'extensionAttribute'
173
+ # (by default the 'type' is 'recon')
174
+ patch.capabilities.add_criterion(
175
+ name: title.extensionAttribute.key,
176
+ operator: 'is',
177
+ value: 'yes',
178
+ type: 'extensionAttribute'
179
+ )
180
+
181
+ ##### COMPONENT - including criteria identifying macs that have this patch installed
182
+ #####################################
183
+
184
+ # add one
185
+ patch.add_component(
186
+ name: 'Windoo SoftwareTitle Test',
187
+ version: '0.0.1a5a'
188
+ )
189
+
190
+ # edit it to fix those values
191
+ patch.component.name = title.name
192
+ patch.component.version = patch.version
193
+
194
+ # add criteria
195
+ patch.component.criteria.add_criterion(
196
+ name: 'Application Title',
197
+ operator: 'is',
198
+ value: 'WindooTest.app'
199
+ )
200
+
201
+ patch.component.criteria.add_criterion(
202
+ name: 'Application Bundle ID',
203
+ operator: 'is',
204
+ value: title.id
205
+ )
206
+
207
+ patch.component.criteria.add_criterion(
208
+ name: 'Application Version',
209
+ operator: 'is',
210
+ value: patch.version
211
+ )
212
+
213
+ # Once the patch as at least one Capability, and its Component has at least on criterion,
214
+ # you can enable it
215
+ patch.enable
216
+
217
+ # Once your software title has at least one Requirement, and one enabled Patch, you can
218
+ # enable it too!
219
+ title.enable
220
+ ```
221
+
222
+ More documentation is on the way