ruby-jss 1.2.4a4 → 1.3.3

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.

Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +185 -1
  3. data/README.md +3 -1
  4. data/bin/cgrouper +1 -1
  5. data/bin/jamfHelperBackgrounder +1 -1
  6. data/bin/netseg-update +1 -1
  7. data/data/ruby-jss.conf.example +1 -1
  8. data/lib/jamf.rb +1 -1
  9. data/lib/jamf/api/abstract_classes/advanced_search.rb +1 -1
  10. data/lib/jamf/api/abstract_classes/collection_resource.rb +31 -26
  11. data/lib/jamf/api/abstract_classes/generic_reference.rb +1 -1
  12. data/lib/jamf/api/abstract_classes/json_object.rb +15 -5
  13. data/lib/jamf/api/abstract_classes/prestage.rb +2 -2
  14. data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +1 -1
  15. data/lib/jamf/api/abstract_classes/resource.rb +1 -1
  16. data/lib/jamf/api/abstract_classes/singleton_resource.rb +1 -1
  17. data/lib/jamf/api/attribute_classes/ip_address.rb +1 -1
  18. data/lib/jamf/api/attribute_classes/timestamp.rb +1 -1
  19. data/lib/jamf/api/connection.rb +106 -60
  20. data/lib/jamf/api/connection/api_error.rb +1 -1
  21. data/lib/jamf/api/connection/api_error_styleguide.rb +1 -1
  22. data/lib/jamf/api/connection/token.rb +80 -13
  23. data/lib/jamf/api/json_objects/account_prefs.rb +1 -1
  24. data/lib/jamf/api/json_objects/android_details.rb +1 -1
  25. data/lib/jamf/api/json_objects/appletv_details.rb +1 -1
  26. data/lib/jamf/api/json_objects/attachment.rb +1 -1
  27. data/lib/jamf/api/json_objects/cellular_network.rb +1 -1
  28. data/lib/jamf/api/json_objects/change_log_entry.rb +1 -1
  29. data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +1 -1
  30. data/lib/jamf/api/json_objects/country.rb +1 -1
  31. data/lib/jamf/api/json_objects/criterion.rb +1 -1
  32. data/lib/jamf/api/json_objects/device_enrollment_device.rb +1 -1
  33. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
  34. data/lib/jamf/api/json_objects/extension_attribute_value.rb +1 -1
  35. data/lib/jamf/api/json_objects/installed_application.rb +1 -1
  36. data/lib/jamf/api/json_objects/installed_certificate.rb +1 -1
  37. data/lib/jamf/api/json_objects/installed_configuration_profile.rb +1 -1
  38. data/lib/jamf/api/json_objects/installed_ebook.rb +1 -1
  39. data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +1 -1
  40. data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +1 -1
  41. data/lib/jamf/api/json_objects/ios_details.rb +1 -1
  42. data/lib/jamf/api/json_objects/location.rb +1 -1
  43. data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
  44. data/lib/jamf/api/json_objects/md_prestage_names.rb +1 -1
  45. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +1 -1
  46. data/lib/jamf/api/json_objects/mobile_device_details.rb +1 -1
  47. data/lib/jamf/api/json_objects/mobile_device_security.rb +1 -1
  48. data/lib/jamf/api/json_objects/prestage_assignment.rb +1 -1
  49. data/lib/jamf/api/json_objects/prestage_location.rb +1 -1
  50. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +1 -1
  51. data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
  52. data/lib/jamf/api/json_objects/prestage_sync_status.rb +1 -1
  53. data/lib/jamf/api/json_objects/purchasing_data.rb +1 -1
  54. data/lib/jamf/api/mixins/abstract.rb +1 -1
  55. data/lib/jamf/api/mixins/bulk_deletable.rb +1 -1
  56. data/lib/jamf/api/mixins/change_log.rb +1 -1
  57. data/lib/jamf/api/mixins/extendable.rb +1 -1
  58. data/lib/jamf/api/mixins/immutable.rb +1 -1
  59. data/lib/jamf/api/mixins/locatable.rb +1 -1
  60. data/lib/jamf/api/mixins/lockable.rb +1 -1
  61. data/lib/jamf/api/mixins/referable.rb +1 -1
  62. data/lib/jamf/api/mixins/searchable.rb +1 -1
  63. data/lib/jamf/api/mixins/uncreatable.rb +1 -1
  64. data/lib/jamf/api/mixins/undeletable.rb +1 -1
  65. data/lib/jamf/api/resources/collection_resources/account.rb +1 -1
  66. data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +1 -1
  67. data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +1 -1
  68. data/lib/jamf/api/resources/collection_resources/building.rb +1 -1
  69. data/lib/jamf/api/resources/collection_resources/category.rb +1 -1
  70. data/lib/jamf/api/resources/collection_resources/computer.rb +1 -1
  71. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +1 -1
  72. data/lib/jamf/api/resources/collection_resources/department.rb +1 -1
  73. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +1 -1
  74. data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +1 -1
  75. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +9 -2
  76. data/lib/jamf/api/resources/collection_resources/mobile_device.rb +1 -1
  77. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +1 -1
  78. data/lib/jamf/api/resources/collection_resources/script.rb +1 -1
  79. data/lib/jamf/api/resources/collection_resources/site.rb +1 -1
  80. data/lib/jamf/api/resources/collection_resources/time_zone.rb +1 -1
  81. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +1 -1
  82. data/lib/jamf/api/resources/singleton_resources/authorization.rb +1 -1
  83. data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +1 -1
  84. data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +1 -1
  85. data/lib/jamf/client.rb +1 -1
  86. data/lib/jamf/client/jamf_binary.rb +1 -1
  87. data/lib/jamf/client/jamf_helper.rb +1 -1
  88. data/lib/jamf/client/management_action.rb +1 -1
  89. data/lib/jamf/compatibility.rb +1 -1
  90. data/lib/jamf/composer.rb +1 -1
  91. data/lib/jamf/configuration.rb +8 -10
  92. data/lib/jamf/exceptions.rb +6 -1
  93. data/lib/jamf/ruby_extensions.rb +2 -1
  94. data/lib/jamf/ruby_extensions/array.rb +2 -2
  95. data/lib/jamf/ruby_extensions/array/predicates.rb +1 -1
  96. data/lib/jamf/ruby_extensions/array/utils.rb +4 -4
  97. data/lib/jamf/ruby_extensions/dig.rb +52 -0
  98. data/lib/jamf/ruby_extensions/filetest.rb +1 -1
  99. data/lib/jamf/ruby_extensions/filetest/predicates.rb +1 -1
  100. data/lib/jamf/ruby_extensions/hash.rb +1 -1
  101. data/lib/jamf/ruby_extensions/hash/backports.rb +2 -2
  102. data/lib/jamf/ruby_extensions/ipaddr.rb +1 -1
  103. data/lib/jamf/ruby_extensions/ipaddr/utils.rb +1 -1
  104. data/lib/jamf/ruby_extensions/object.rb +1 -1
  105. data/lib/jamf/ruby_extensions/object/predicates.rb +1 -1
  106. data/lib/jamf/ruby_extensions/pathname.rb +1 -1
  107. data/lib/jamf/ruby_extensions/pathname/predicates.rb +1 -1
  108. data/lib/jamf/ruby_extensions/pathname/utils.rb +1 -1
  109. data/lib/jamf/ruby_extensions/string.rb +1 -1
  110. data/lib/jamf/ruby_extensions/string/backports.rb +1 -1
  111. data/lib/jamf/ruby_extensions/string/conversions.rb +1 -1
  112. data/lib/jamf/ruby_extensions/string/predicates.rb +14 -4
  113. data/lib/jamf/utility.rb +1 -1
  114. data/lib/jamf/validate.rb +1 -1
  115. data/lib/jamf/version.rb +2 -2
  116. data/lib/jpapi.rb +1 -1
  117. data/lib/jss-api.rb +1 -1
  118. data/lib/jss.rb +5 -2
  119. data/lib/jss/api_connection.rb +3 -30
  120. data/lib/jss/api_object.rb +16 -3
  121. data/lib/jss/api_object/account.rb +1 -1
  122. data/lib/jss/api_object/advanced_search.rb +1 -1
  123. data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +1 -1
  124. data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +1 -1
  125. data/lib/jss/api_object/advanced_search/advanced_user_search.rb +1 -1
  126. data/lib/jss/api_object/building.rb +1 -1
  127. data/lib/jss/api_object/categorizable.rb +1 -1
  128. data/lib/jss/api_object/category.rb +1 -1
  129. data/lib/jss/api_object/computer.rb +12 -6
  130. data/lib/jss/api_object/computer/application_installs.rb +1 -1
  131. data/lib/jss/api_object/computer_invitation.rb +1 -1
  132. data/lib/jss/api_object/configuration_profile.rb +4 -2
  133. data/lib/jss/api_object/configuration_profile/mobile_device_configuration_profile.rb +1 -1
  134. data/lib/jss/api_object/configuration_profile/osx_configuration_profile.rb +1 -1
  135. data/lib/jss/api_object/creatable.rb +1 -1
  136. data/lib/jss/api_object/criteriable.rb +10 -5
  137. data/lib/jss/api_object/criteriable/criteria.rb +26 -10
  138. data/lib/jss/api_object/criteriable/criterion.rb +1 -1
  139. data/lib/jss/api_object/department.rb +1 -1
  140. data/lib/jss/api_object/directory_binding.rb +273 -0
  141. data/lib/jss/api_object/directory_binding_type.rb +90 -0
  142. data/lib/jss/api_object/directory_binding_type/active_directory.rb +502 -0
  143. data/lib/jss/api_object/directory_binding_type/admitmac.rb +525 -0
  144. data/lib/jss/api_object/directory_binding_type/centrify.rb +212 -0
  145. data/lib/jss/api_object/directory_binding_type/open_directory.rb +178 -0
  146. data/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb +73 -0
  147. data/lib/jss/api_object/disk_encryption_configurations.rb +114 -0
  148. data/lib/jss/api_object/distribution_point.rb +96 -36
  149. data/lib/jss/api_object/dock_item.rb +137 -0
  150. data/lib/jss/api_object/ebook.rb +1 -1
  151. data/lib/jss/api_object/extendable.rb +67 -28
  152. data/lib/jss/api_object/extension_attribute.rb +1 -1
  153. data/lib/jss/api_object/extension_attribute/computer_extension_attribute.rb +1 -1
  154. data/lib/jss/api_object/extension_attribute/mobile_device_extension_attribute.rb +1 -1
  155. data/lib/jss/api_object/extension_attribute/user_extension_attribute.rb +1 -1
  156. data/lib/jss/api_object/group.rb +1 -1
  157. data/lib/jss/api_object/group/computer_group.rb +1 -1
  158. data/lib/jss/api_object/group/mobile_device_group.rb +1 -1
  159. data/lib/jss/api_object/group/user_group.rb +1 -1
  160. data/lib/jss/api_object/ibeacon.rb +1 -1
  161. data/lib/jss/api_object/ldap_server.rb +1 -1
  162. data/lib/jss/api_object/locatable.rb +1 -1
  163. data/lib/jss/api_object/mac_application.rb +1 -1
  164. data/lib/jss/api_object/management_history.rb +23 -22
  165. data/lib/jss/api_object/management_history/audit_event.rb +1 -1
  166. data/lib/jss/api_object/management_history/casper_imaging_log.rb +1 -1
  167. data/lib/jss/api_object/management_history/casper_remote_log.rb +1 -1
  168. data/lib/jss/api_object/management_history/computer_usage_log.rb +1 -1
  169. data/lib/jss/api_object/management_history/ebook.rb +1 -1
  170. data/lib/jss/api_object/management_history/hashlike.rb +1 -1
  171. data/lib/jss/api_object/management_history/mac_app_store_app.rb +1 -1
  172. data/lib/jss/api_object/management_history/mdm_command.rb +1 -1
  173. data/lib/jss/api_object/management_history/mobile_device_app.rb +1 -1
  174. data/lib/jss/api_object/management_history/policy_log.rb +1 -1
  175. data/lib/jss/api_object/management_history/screen_sharing_log.rb +1 -1
  176. data/lib/jss/api_object/management_history/user_location_change.rb +1 -1
  177. data/lib/jss/api_object/matchable.rb +1 -1
  178. data/lib/jss/api_object/mdm.rb +1 -1
  179. data/lib/jss/api_object/mobile_device.rb +29 -6
  180. data/lib/jss/api_object/mobile_device_application.rb +13 -1
  181. data/lib/jss/api_object/netboot_server.rb +1 -1
  182. data/lib/jss/api_object/network_segment.rb +153 -59
  183. data/lib/jss/api_object/package.rb +106 -41
  184. data/lib/jss/api_object/patch_policy.rb +1 -1
  185. data/lib/jss/api_object/patch_source.rb +1 -1
  186. data/lib/jss/api_object/patch_source/patch_external_source.rb +1 -1
  187. data/lib/jss/api_object/patch_source/patch_internal_source.rb +1 -1
  188. data/lib/jss/api_object/patch_title.rb +1 -1
  189. data/lib/jss/api_object/patch_title/version.rb +1 -1
  190. data/lib/jss/api_object/peripheral.rb +1 -1
  191. data/lib/jss/api_object/peripheral_type.rb +1 -1
  192. data/lib/jss/api_object/policy.rb +380 -5
  193. data/lib/jss/api_object/printer.rb +440 -0
  194. data/lib/jss/api_object/purchasable.rb +1 -1
  195. data/lib/jss/api_object/removable_macaddr.rb +1 -1
  196. data/lib/jss/api_object/restricted_software.rb +1 -1
  197. data/lib/jss/api_object/scopable.rb +1 -1
  198. data/lib/jss/api_object/scopable/scope.rb +257 -37
  199. data/lib/jss/api_object/script.rb +1 -1
  200. data/lib/jss/api_object/self_servable.rb +7 -7
  201. data/lib/jss/api_object/self_servable/icon.rb +1 -1
  202. data/lib/jss/api_object/sitable.rb +6 -2
  203. data/lib/jss/api_object/site.rb +1 -1
  204. data/lib/jss/api_object/software_update_server.rb +1 -1
  205. data/lib/jss/api_object/updatable.rb +1 -1
  206. data/lib/jss/api_object/uploadable.rb +1 -1
  207. data/lib/jss/api_object/user.rb +5 -3
  208. data/lib/jss/api_object/vppable.rb +1 -1
  209. data/lib/jss/api_object/webhook.rb +1 -1
  210. data/lib/jss/client.rb +1 -1
  211. data/lib/jss/client/jamf_binary.rb +1 -1
  212. data/lib/jss/client/jamf_helper.rb +1 -1
  213. data/lib/jss/client/management_action.rb +1 -1
  214. data/lib/jss/compatibility.rb +1 -1
  215. data/lib/jss/composer.rb +2 -2
  216. data/lib/jss/configuration.rb +1 -1
  217. data/lib/jss/db_connection.rb +1 -1
  218. data/lib/jss/exceptions.rb +1 -1
  219. data/lib/jss/ruby_extensions.rb +1 -1
  220. data/lib/jss/ruby_extensions/array.rb +1 -1
  221. data/lib/jss/ruby_extensions/filetest.rb +1 -1
  222. data/lib/jss/ruby_extensions/hash.rb +1 -1
  223. data/lib/jss/ruby_extensions/ipaddr.rb +1 -1
  224. data/lib/jss/ruby_extensions/pathname.rb +1 -1
  225. data/lib/jss/ruby_extensions/string.rb +1 -1
  226. data/lib/jss/ruby_extensions/string/backports.rb +1 -1
  227. data/lib/jss/ruby_extensions/string/conversions.rb +1 -1
  228. data/lib/jss/ruby_extensions/string/predicates.rb +14 -4
  229. data/lib/jss/ruby_extensions/time.rb +1 -1
  230. data/lib/jss/server.rb +1 -1
  231. data/lib/jss/utility.rb +9 -23
  232. data/lib/jss/validate.rb +1 -1
  233. data/lib/jss/version.rb +2 -2
  234. data/lib/jss/xml_workaround.rb +1 -1
  235. data/lib/ruby-jss.rb +1 -1
  236. data/test/bin/runtests +1 -1
  237. data/test/lib/testhelper.rb +1 -1
  238. data/test/lib/testhelper/auth.rb +1 -1
  239. data/test/lib/testhelper/patch_mgmt.rb +1 -1
  240. data/test/specs/api_connection_spec.rb +1 -1
  241. data/test/specs/patch01_source_spec.rb +1 -1
  242. data/test/specs/patch02_internal_source_spec.rb +1 -1
  243. data/test/specs/patch03_external_source_spec.rb +1 -1
  244. data/test/specs/patch04_titles_spec.rb +1 -1
  245. data/test/specs/patch05_policies_spec.rb +1 -1
  246. data/test/specs/patch06_cleanup_spec.rb +1 -1
  247. data/test/specs/policy_spec.rb +1 -1
  248. metadata +15 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 745114754cc7073bbf494e8eb54f48962c9cafff99da985108c90b5bc7ccc62c
4
- data.tar.gz: 6455a7c53abc89c47a03b1bd9538bc0bd3375eab1776ca9c5a15425595ed2ed3
3
+ metadata.gz: ee61895968b4dc50815f33bdd50cd54c1a1fcad700243f4be3cded694c11f745
4
+ data.tar.gz: a7a3ce9847874fa7c26c859f6fa26e5a8802b60f42c300f347e2c40b5c38d949
5
5
  SHA512:
6
- metadata.gz: 10cd851d966cc1e966dec194b27a4f282bba25b80177886dc03d44429206c8bc8bb223f141c9da27547f096a439937c6db3ae0d7e6498d2d6570b5bca164f716
7
- data.tar.gz: a194cd0e76b6264afc1deef0b2567169a83c7fba9aaad796f050171783df202d1fd3ccf04f5eb11606ea387badce68920822c698aab819bfb46a2fd2549a919f
6
+ metadata.gz: f95b9d7f49983c9899a18b7e1edb6130250e402a5284e65a9ae64829176d2c3f5fe3d35584cf6dcee85b7486e1a037c8a5ae3ef58b72d169f4ac05cebb5d8858
7
+ data.tar.gz: 1b5131ec5bec8b940c4daf1403f9595a4749b0b5d36cfc7bf07a2aca0adbee2446ff44dfe078e8e1651f5fa25ed6725d763ec0f5798d06ec16d70b57ea466b86
data/CHANGES.md CHANGED
@@ -4,6 +4,189 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## \[1.3.3] - 2020-08-07
8
+
9
+ ### Fixed
10
+ - Regression where JSS::Package#required_processor= wouldn't take 'x86'
11
+
12
+ ## \[1.3.2] - 2020-07-31
13
+ Many thanks to @cybertunnel for adding a huge amount of code to get JSS::Policy fully implimented, as well as other fixes and updates!
14
+
15
+ ### Added
16
+ - new class JSS::DockItem
17
+ - new classes JSS::DirectoryBinding and JSS::DirectoryBindingType
18
+ - new class JSS::Printer
19
+ - new class JSS::DiskEncryptionConfiguration
20
+ - JSS::Policy:
21
+ - getters and setters for `#user_message_start` and `#user_message_end`
22
+ - `#set_management_account` and `#verify_management_password`
23
+ - `#add_dock_item` and `#remove_dock_item`
24
+ - `#directory_bindings`, `#add_directory_binding` and `#remove_directory_binding`
25
+ - `#add_printer` and `#remove_printer`
26
+ - `#reissue_key`, `#apply_encryption_configuration`, and `#remove_encryption_configuration`
27
+
28
+
29
+ ### Changed
30
+ - JSS::Package:
31
+ - no longer issues a warning when changing the file_name of a package
32
+ - Updated the CPU type string from 'x86' to 'Intel/x86'
33
+ - Methods which used to always use the master distribution point now accept a parameter `dist_point: dp` where dp is the name or id of a fileshare distribution point. If not specified, it still defaults to the Master Distribution Point. This is needed because if the Cloud Distribution Point is the master, there is no access to it via the Classic API, and any use of DistributionPoint.master_distribution_point will raise an error.
34
+
35
+ ## \[1.3.1] - 2020-06-21
36
+
37
+ ### Changed
38
+
39
+ - JSS::MobileDeviceApplication when using PrettyPrint (pp) in irb, no longer shows the base64 data for the ipa file.
40
+
41
+ - JSS::DistributionPoint.my_distribution_point and .master_distribution_point now have options for dealing with the Cloud Distribution Point (which is not available in the classic API) being the master.
42
+
43
+ ### Fixed
44
+
45
+ - JSS::NetworkSegment.distribution_point= now takes nil or an empty string to unset the dist point.
46
+
47
+ ## \[1.3.0] - 2020-06-05
48
+
49
+ ### Added
50
+
51
+ - JSS::NetworkSegment.network_ranges_as_integers method, Similar to NetworkSegment.network_ranges, but the ranges are of Integers, not IPAddr instances. This makes for *MUCH* faster range calculations, needed to implement improvements to NetworkSegment.network_segment_for_ip
52
+
53
+ - JSS::Package.all_filenames_by, returns a Hash of all distribution point filenames for all packages, keyed by either the package id, or the package name. NOTE: as with JSS::Package.all_filenames, this method must instantiate all JSS::Package objects, so it will be slow.
54
+
55
+ ### Changed
56
+
57
+ - JSS.expand_min_os now expands to macOS 10.30.x, which should hold us for a while
58
+
59
+ - JSS::NetworkSegment.network_segment_for_ip and .my_network_segment are no longer deprecated, but now return an integer NetSeg id (or nil). The plural forms of those methods still return an Array of ids for all the matching network segments.
60
+
61
+ - The logic for JSS::NetworkSegment.network_segment_for_ip (and .my_network_segment) now matches how the Jamf server does it: when you IP address is in more than one Network Segment, Jamf uses the smallest/narrowest one (the one containing fewest IP addresses). If more than one of your Network Segments are that same width, the one with the lowest starting IP address is used.
62
+
63
+ - In some networking situations (e.g. Split-tunnel VPN with multiple active network ports) the JSS::APIObject.delete method will raise a 404 NotFound error, seemingly because the object was already deleted but a second http DELETE is sent (I think). We now just rescue and ignore that error, since the fact that it's not found means it was indeed deleted.
64
+
65
+ ### Fixed
66
+
67
+ - A copy/paste bug in Jamf::Prestage.serials_for_prestage
68
+
69
+ ## \[1.2.15] - 2020-04-30
70
+
71
+ ### Fixed
72
+
73
+ - USER_CONF_FILE is always a pathname, never nil
74
+
75
+ - issues with Array#j_ci_* methods related to removing safe navigation
76
+
77
+ ## \[1.2.13] - 2020-04-29
78
+
79
+ ### Fixed
80
+
81
+ - Ruby 2.6 needs parens in more places than 2.3, apparently
82
+
83
+ ## \[1.2.12] - 2020-04-29
84
+
85
+ ### Added
86
+
87
+ - Backport of `#dig` for Arrays, Hashes and OpenStructs, for compatibiliy with older rubiesd (for a while longer anyway). Gratefully borrowed from https://github.com/Invoca/ruby_dig
88
+
89
+ ### Changed
90
+
91
+ - Removed all safe navigation operators (`&.`) for compatibility with older rubies (for a while longer anyway)
92
+
93
+
94
+ ## \[1.2.11] - 2020-04-26
95
+
96
+ ### Fixed
97
+
98
+ - Bug in Package#install that prevented installs from 'alt_download_url'.
99
+
100
+ ## \[1.2.10] - 2020-04-25
101
+
102
+ ### Added
103
+
104
+ - Computer#reported_ip_address. This value is collected in newer versions of Jamf Pro. While the #ip_address is the client's IP address from the Jamf Server's perspective, the #reported_ip_address is the IP from the client's perspective, which may be different on a NATted network like a home network.
105
+
106
+ ### Fixed
107
+
108
+ - MobileDevice#upload now works like Computer#upload
109
+
110
+ ### Changed
111
+
112
+ - Validation of Ext. Attribute values is improved, namely for EAs with integer values, integer-strings like "12" are accepted and converted to real integers as needed.
113
+
114
+ ## \[1.2.9] - 2020-04-13
115
+
116
+ ### Fixed
117
+
118
+ - Fixed a bug where passing a frozen string into some setters, e.g. `JSS::Computer.asset_tag=`, would cause an error when it tried to `#strip!` the string.
119
+
120
+ ## \[1.2.8] - 2020-04-12
121
+
122
+ ### Added
123
+
124
+ - MobileDevice#update now takes the `no_mdm_rename:` boolean parameter. Prevents an MDM rename command being sent when changing the name of a supervised device with enforced names. Useful when the MDM command fails, as when there's already a pending rename command.
125
+
126
+ - `String#jss_float?` and `String#j_float?` predicate methods.
127
+
128
+ ### Changed
129
+
130
+ - Jamf Pro API endpoints that have paging options have an undocumented max page size of 2000. The `CollectionResource#all*` methods now account for this.
131
+
132
+ - `String#jss_integer?` and `String#j_integer?` now recognize negative integers
133
+
134
+ - Ext. Attributes defined to have interger values will now accept integer strings, e.g. `'12345'` as well as integers e.g. `12345`
135
+
136
+ - Ext. Attributes defined to have date values will once again accept blanks (i.e. empty strings)
137
+
138
+ ## \[1.2.7] - 2020-04-01
139
+
140
+ ### Changed
141
+
142
+ - Jamf Pro API endpoints that have paging options have an undocumented max page size of 2000. The `CollectionResource#all*` methods now account for this.
143
+
144
+
145
+ ## \[1.2.6] - 2020-04-01
146
+
147
+ ### Fixed
148
+
149
+ - Classic API (JSS module)
150
+ - Sitable objects now recognize the string "None" as meaning no site is assigned. Thanks @cybertunnel for this fix!
151
+
152
+ - Scopable::Scope now deals with some bugs in the API regarding Jamf & LDAP users & user groups in targets, limitations, & exclusions. Please see the documentation/comments for the class in the file or the online documentation. Thanks @cybertunnel again!
153
+
154
+ - Criteriable::Criteria can now be empty - containing no criterion objects. When criteriable objects are created (such as Advanced Searches) the default JSS::Criteriable::Criteria object has no criteria. To remove all criteria, use `criteria.clear`, `criteria = nil`, or `criteria = JSS::Criteriable::Criteria.new` and then save. Once again, thanks to @cybertunnel for finding this.
155
+
156
+ - Jamf Pro API (Jamf module)
157
+ - More fixes for various JamfPro API (Jamf module) methods that accept a passed-in Jamf::Connection instance.
158
+
159
+
160
+ ## \[1.2.5] - 2020-03-30
161
+
162
+ ### Fixed
163
+
164
+ - Classic API (JSS module)
165
+ - The Classic API now requires JSS::User objects to be passed back to the API with the `ldap_server` specified by id, name-only won't work.
166
+
167
+ - Jamf Pro API (Jamf module)
168
+ - Fixes for various JamfPro API (Jamf module) methods that accept a passed-in Jamf::Connection instance.
169
+
170
+ ## \[1.2.4] - 2020-03-16
171
+
172
+ ### Added
173
+
174
+ - **'Beta' Jamf Pro API support in ruby-jss!**
175
+
176
+ The Jamf Pro API, formerly known as the 'Universal' API, aims to be a far more robust, modern, and standardized way to programmatically access a Jamf Pro server. While its been in development for a while, it is finally starting to settle in to some standards, to the point that its worth releasing some early ruby-jss code to access it.
177
+
178
+ Because the JP-API is so fundamentally different from the Classic API, it's being implemented as a totally separate ruby module 'Jamf', and many of the underlying standards of ruby-jss's JSS module are being re-thought and modernized, much like the JP-API itself. Classic API access using the JSS module is unchanged, and will continue to get fixes and other updates as needed. However many things in the Jamf module will behave differently from the JSS module, at least in detail if not concept.
179
+
180
+ For requirements and details of using the Jamf module to access the Jamf Pro API, see [lib/jamf/README-JP-API.md](lib/jamf/README-JP-API.md).
181
+
182
+ **IMPORTANT:** As with the JP-API, The Jamf module is an early work-in-progress, and things might change drastically at any point. Please mention 'ruby-jss' in MacAdmins Slack channels #jamf-api or #ruby, or email ruby-jss@pixar.com, or open an issue on github if you have questions or want to contribute.
183
+
184
+ ### Changed
185
+
186
+ - The `last_mdm_contact` class and instance method from the MDM mixin module (as used in Computer and MobileDevice classes) now returns the time of the most recent _completed_ or _failed_ mdm command. This is more accurate than just the completed commands, since a failed command still implies contact between the client and Jamf Pro.
187
+
188
+ - JSS::MobileDevice instances now have three predicate methods: `tv?` (aliased as `apple_tv?`), `ipad?` and `iphone?`
189
+
7
190
  ## \[1.2.3] - 2019-10-31
8
191
  ### Added
9
192
  - the ManagementHistory mixin module used by the Computer and MobileDevice classes, now has a `last_mdm_contact` class and instance method, which returns a Time object for the timestamp of the most recent completed MDM command. This is useful for MobileDevices, which don't have anything like the `last_checkin` value for comptuers, indicating real communication between the device and Jamf Pro.
@@ -11,7 +194,8 @@ Note that the `last_inventory_update` value does NOT indicate such communication
11
194
 
12
195
  - All APIObject Subclasses (Policy, Computer, MobileDevice, ComputerGroup, etc..) now have `get_raw`, `post_raw` & `put_raw` class methods, which are simpler wrappers for APIConnection#get_rsrc, #post_rsrc, and #put_rsrc.
13
196
  - `get_raw` takes an object's id, and returns the 'raw' JSON (parsed into a ruby Hash with symbolized keys) or a REXML::Document (from which you'll probably want to use the `root` element). If you pass `as_string: true` you'll get the un-parsed JSON or XML string directly from the API
14
- This can be useful when you need to retrieve the full object, to get some data not available in the summary-list, but instantiating the full ruby class is too slow.
197
+ This can be useful when you need to retrieve the full object, to get some data not available in the summary-list, but instantiating the full ruby class is too slow
198
+
15
199
  - `post_raw` & `put_raw` can send raw XML to the API without instantiating objects. In some cases, where you're making simple changes to simple XML, this can be faster than fetching a full instance and the re-saving it.
16
200
  WARNING You must create or acquire the XML to be sent, and no validation will be performed on it. It must be a String of XML, or something that returns such a string with #to_s, such as a REXML::Document, or a REXML::Element.
17
201
 
data/README.md CHANGED
@@ -45,6 +45,8 @@ Hopefully others will find it useful, and add more to it as well.
45
45
 
46
46
  [Full technical documentation can be found here.](http://www.rubydoc.info/gems/ruby-jss/)
47
47
 
48
+ NOTE: ruby-jss 1.2.4 will introduce beta-level support for the Jamf Pro API in a ruby module called 'Jamf', See README-JP-API.md in /lib/jamf, or in the 'Files' section of the YARD docs file for details.
49
+
48
50
  ## SYNOPSIS
49
51
 
50
52
  Here are some simple examples of using ruby-jss
@@ -417,6 +419,6 @@ There's a [wiki on the github page](https://github.com/PixarAnimationStudios/rub
417
419
 
418
420
  ## LICENSE
419
421
 
420
- Copyright 2019 Pixar
422
+ Copyright 2020 Pixar
421
423
 
422
424
  Licensed under the Apache License, Version 2.0 (the "Apache License") with modifications. See LICENSE.txt for details
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- ### Copyright 2019 Pixar
3
+ ### Copyright 2020 Pixar
4
4
 
5
5
  ###
6
6
  ### Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- ### Copyright 2019 Pixar
3
+ ### Copyright 2020 Pixar
4
4
 
5
5
  ###
6
6
  ### Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- ### Copyright 2019 Pixar
3
+ ### Copyright 2020 Pixar
4
4
 
5
5
  ###
6
6
  ### Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,4 +1,4 @@
1
- ### Copyright 2019 Pixar
1
+ ### Copyright 2020 Pixar
2
2
 
3
3
  ###
4
4
  ### Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Pixar
1
+ # Copyright 2020 Pixar
2
2
 
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Pixar
1
+ # Copyright 2020 Pixar
2
2
 
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Pixar
1
+ # Copyright 2020 Pixar
2
2
 
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -106,13 +106,21 @@ module Jamf
106
106
  return cnx.collection_cache[self].map { |m| new m }
107
107
  end
108
108
 
109
- raw = cnx.get rsrc_path
110
- cnx.collection_cache[self] =
111
- if raw.is_a?(Hash) && raw[:results]
112
- raw[:results]
113
- else
114
- raw
115
- end
109
+ # TODO: make sure all collection resources use this format
110
+ # for paging. Also -ask Jamf about a url that returns
111
+ # ALL objects in one query, regardless of number.
112
+ page = 0
113
+ raw = cnx.get "#{rsrc_path}?page=#{page}&size=1000000&sort=id%3Aasc"
114
+ results = raw[:results]
115
+
116
+ until results.size >= raw[:totalCount]
117
+ page += 1
118
+ raw = cnx.get "#{rsrc_path}?page=#{page}&size=1000000&sort=id%3Aasc"
119
+ results += raw[:results]
120
+ end
121
+
122
+
123
+ cnx.collection_cache[self] = results
116
124
 
117
125
  return cnx.collection_cache[self] unless instantiate
118
126
 
@@ -220,7 +228,7 @@ module Jamf
220
228
  val_is_str = value.is_a? String
221
229
 
222
230
  idents.each do |ident|
223
- match = all(cnx: cnx).select do |m|
231
+ match = all(refresh, cnx: cnx).select do |m|
224
232
  val_is_str ? m[ident].to_s.casecmp?(value) : m[ident] == value
225
233
  end.first
226
234
  return match[:id] if match
@@ -241,13 +249,20 @@ module Jamf
241
249
  end
242
250
 
243
251
  # Make a new thing to be added to the API
244
- def self.create(params, cnx: Jamf.cnx)
245
- raise Jamf::UnsupportedError, "#{self}'s are not currently creatable via the API" unless self.creatable?
246
-
252
+ def self.create(**params)
247
253
  validate_not_abstract
254
+ raise Jamf::UnsupportedError, "#{self}'s are not currently creatable via the API" unless creatable?
255
+
256
+ cnx = params.delete :cnx
257
+ cnx ||= Jamf.cnx
258
+
248
259
  params.delete :id # no such animal when .creating
249
260
 
250
- validate_create_params(params, cnx)
261
+ params.keys.each do |param|
262
+ raise ArgumentError, "Unknown parameter: #{param}" unless self::OBJECT_MODEL.key? param
263
+
264
+ params[param] = validate_attr param, params[param], cnx: cnx
265
+ end
251
266
 
252
267
  params[:creating_from_create] = true
253
268
  new params, cnx: cnx
@@ -277,16 +292,17 @@ module Jamf
277
292
  #
278
293
  def self.fetch(ident_value = nil, cnx: Jamf.cnx, **ident_hash)
279
294
  validate_not_abstract
295
+
280
296
  id =
281
297
  if ident_value == :random
282
298
  all_ids.sample
283
299
  elsif ident_value
284
- valid_id ident_value
300
+ valid_id ident_value, cnx: cnx
285
301
  elsif ident_hash.empty?
286
302
  nil
287
303
  else
288
304
  ident, lookup_value = ident_hash.first
289
- valid_id ident => lookup_value
305
+ valid_id ident => lookup_value, cnx: cnx
290
306
  end
291
307
 
292
308
  raise Jamf::NoSuchItemError, "No matching #{self}" unless id
@@ -362,17 +378,6 @@ module Jamf
362
378
  end # create_list_methods
363
379
  private_class_method :create_list_methods
364
380
 
365
- # validate that our .create data is OK
366
- #
367
- def self.validate_create_params(params, cnx)
368
- params.keys.each do |param|
369
- raise ArgumentError, "Unknown parameter: #{param}" unless self::OBJECT_MODEL.key? param
370
-
371
- params[param] = validate_attr param, params[param], cnx: cnx
372
- end
373
- end
374
- private_class_method :validate_create_params
375
-
376
381
  # Given an indentier attr. key, and a value,
377
382
  # return the id where that ident has that value, or nil
378
383
  #
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Pixar
1
+ # Copyright 2020 Pixar
2
2
 
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Pixar
1
+ # Copyright 2020 Pixar
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
4
4
  # with the following modification; you may not use this file except in
@@ -482,7 +482,7 @@ module Jamf
482
482
  # have an alias without the 'is' so :isManaged will have
483
483
  # getters isManaged? and managed?
484
484
  #
485
- PREDICATE_RE = /^is([A-Z]\w*)$/.freeze
485
+ PREDICATE_RE = /^is([A-Z]\w+)$/.freeze
486
486
 
487
487
  # Public Class Methods
488
488
  #####################################
@@ -524,7 +524,7 @@ module Jamf
524
524
  #
525
525
  def self.attr_key_for_alias(als)
526
526
  validate_not_abstract
527
- self::OBJECT_MODEL.each { |k, deets| return k if k == als || deets[:aliases]&.include?(als) }
527
+ self::OBJECT_MODEL.each { |k, deets| return k if k == als || deets[:aliases].to_a.include?(als) }
528
528
  nil
529
529
  end
530
530
 
@@ -575,10 +575,11 @@ module Jamf
575
575
  else
576
576
  define_method(attr_name) { instance_variable_get("@#{attr_name}") }
577
577
 
578
- # all booleans get a predicate alias
579
- alias_method("#{attr_name}?", attr_name) if attr_def[:class] == :boolean
580
578
  end
581
579
 
580
+ # all booleans get predicate aliases
581
+ define_predicates(attr_name) if attr_def[:class] == :boolean
582
+
582
583
  return unless attr_def[:aliases]
583
584
 
584
585
  # aliases
@@ -586,6 +587,15 @@ module Jamf
586
587
  end # create getters
587
588
  private_class_method :create_getters
588
589
 
590
+ # create the default aliases for booleans
591
+ ##############################
592
+ def self.define_predicates(attr_name)
593
+ alias_method("#{attr_name}?", attr_name)
594
+ return unless attr_name.to_s =~ PREDICATE_RE
595
+
596
+ alias_method("#{Regexp.last_match(1).downcase}?", attr_name)
597
+ end
598
+
589
599
  # create setter(s) for an attribute, and any aliases needed
590
600
  ##############################
591
601
  def self.create_setters(attr_name, attr_def)
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Pixar
1
+ # Copyright 2020 Pixar
2
2
 
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -235,7 +235,7 @@ module Jamf
235
235
  #
236
236
  def self.serials_for_prestage(prestage_ident, refresh = false, cnx: Jamf.cnx)
237
237
  id = valid_id prestage_ident, cnx: cnx
238
- raise Jamf::NoSuchItemError, "No #{self} matching '#{ident}'" unless id
238
+ raise Jamf::NoSuchItemError, "No #{self} matching '#{prestage_ident}'" unless id
239
239
 
240
240
  serials_by_prestage_id(refresh, cnx: cnx).select { |_sn, psid| id == psid }.keys
241
241
  end