ruby-jss 1.6.4 → 2.0.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (711) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGES.md +40 -4
  4. data/README-2.0.0.md +337 -0
  5. data/README.md +48 -34
  6. data/bin/cgrouper +3 -3
  7. data/bin/jamfHelperBackgrounder +2 -2
  8. data/bin/netseg-update +3 -3
  9. data/data/ruby-jss.conf.example +1 -1
  10. data/lib/{jss/api_object → jamf/api/classic/api_objects}/account.rb +29 -22
  11. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_computer_search.rb +6 -6
  12. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_mobile_device_search.rb +6 -6
  13. data/lib/{jss/api_object/advanced_search → jamf/api/classic/api_objects}/advanced_user_search.rb +6 -6
  14. data/lib/{jss/api_object → jamf/api/classic/api_objects}/building.rb +6 -6
  15. data/lib/{jss/api_object → jamf/api/classic/api_objects}/categorizable.rb +10 -10
  16. data/lib/{jss/api_object → jamf/api/classic/api_objects}/category.rb +17 -15
  17. data/lib/{jss/api_object → jamf/api/classic/api_objects}/computer.rb +222 -120
  18. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/computer_extension_attribute.rb +19 -19
  19. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/computer_group.rb +9 -8
  20. data/lib/{jss/api_object → jamf/api/classic/api_objects}/computer_invitation.rb +8 -8
  21. data/lib/{jss/api_object → jamf/api/classic/api_objects}/creatable.rb +22 -24
  22. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable/criteria.rb +24 -24
  23. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable/criterion.rb +15 -15
  24. data/lib/{jss/api_object → jamf/api/classic/api_objects}/criteriable.rb +25 -28
  25. data/lib/{jss/api_object → jamf/api/classic/api_objects}/department.rb +7 -7
  26. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding.rb +40 -40
  27. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/active_directory.rb +47 -47
  28. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/admitmac.rb +56 -56
  29. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/centrify.rb +15 -15
  30. data/lib/{jss/api_object → jamf/api/classic/api_objects/directory_binding_type}/directory_binding_type.rb +2 -25
  31. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/open_directory.rb +19 -19
  32. data/lib/{jss/api_object → jamf/api/classic/api_objects}/directory_binding_type/powerbroker_identity_services.rb +1 -1
  33. data/lib/jamf/api/classic/api_objects/directory_binding_type.rb +47 -0
  34. data/lib/{jss/api_object/disk_encryption_configurations.rb → jamf/api/classic/api_objects/disk_encryption_configuration.rb} +14 -14
  35. data/lib/{jss/api_object → jamf/api/classic/api_objects}/distribution_point.rb +41 -35
  36. data/lib/{jss/api_object → jamf/api/classic/api_objects}/dock_item.rb +12 -12
  37. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ebook.rb +3 -3
  38. data/lib/{jss/api_object → jamf/api/classic/api_objects}/extendable.rb +23 -23
  39. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ibeacon.rb +15 -15
  40. data/lib/{jss/api_object/self_servable → jamf/api/classic/api_objects}/icon.rb +8 -8
  41. data/lib/{jss/api_object → jamf/api/classic/api_objects}/ldap_server.rb +45 -34
  42. data/lib/{jss/api_object → jamf/api/classic/api_objects}/locatable.rb +6 -6
  43. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mac_application.rb +18 -18
  44. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/audit_event.rb +4 -4
  45. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/casper_imaging_log.rb +4 -5
  46. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/casper_remote_log.rb +4 -4
  47. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/computer_usage_log.rb +4 -4
  48. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/ebook.rb +7 -7
  49. data/lib/{jss/api_object/management_history/hashlike.rb → jamf/api/classic/api_objects/management_history/hash_like.rb} +3 -3
  50. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mac_app_store_app.rb +4 -4
  51. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mdm_command.rb +9 -9
  52. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/mobile_device_app.rb +4 -4
  53. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/policy_log.rb +5 -5
  54. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/screen_sharing_log.rb +4 -4
  55. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history/user_location_change.rb +4 -4
  56. data/lib/{jss/api_object → jamf/api/classic/api_objects}/management_history.rb +226 -189
  57. data/lib/{jss/api_object → jamf/api/classic/api_objects}/matchable.rb +9 -6
  58. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mdm.rb +288 -167
  59. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device.rb +63 -51
  60. data/lib/{jss/api_object → jamf/api/classic/api_objects}/mobile_device_application.rb +77 -35
  61. data/lib/{jss/api_object/configuration_profile → jamf/api/classic/api_objects}/mobile_device_configuration_profile.rb +7 -10
  62. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/mobile_device_extension_attribute.rb +19 -19
  63. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/mobile_device_group.rb +8 -8
  64. data/lib/{jss/api_object → jamf/api/classic/api_objects}/netboot_server.rb +6 -6
  65. data/lib/{jss/api_object → jamf/api/classic/api_objects}/network_segment.rb +75 -61
  66. data/lib/{jss/api_object/configuration_profile → jamf/api/classic/api_objects}/osx_configuration_profile.rb +7 -7
  67. data/lib/{jss/api_object → jamf/api/classic/api_objects}/package.rb +83 -74
  68. data/lib/{jss/api_object/patch_source → jamf/api/classic/api_objects}/patch_external_source.rb +9 -9
  69. data/lib/{jss/api_object/patch_source → jamf/api/classic/api_objects}/patch_internal_source.rb +5 -5
  70. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_policy.rb +70 -68
  71. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_title/version.rb +15 -15
  72. data/lib/{jss/api_object → jamf/api/classic/api_objects}/patch_title.rb +76 -64
  73. data/lib/{jss/api_object → jamf/api/classic/api_objects}/peripheral.rb +24 -24
  74. data/lib/{jss/api_object → jamf/api/classic/api_objects}/peripheral_type.rb +20 -20
  75. data/lib/{jss/api_object → jamf/api/classic/api_objects}/policy.rb +121 -129
  76. data/lib/{jss/api_object → jamf/api/classic/api_objects}/printer.rb +52 -52
  77. data/lib/{jss/api_object → jamf/api/classic/api_objects}/purchasable.rb +6 -6
  78. data/lib/{jss/api_object → jamf/api/classic/api_objects}/removable_macaddr.rb +7 -7
  79. data/lib/{jss/api_object → jamf/api/classic/api_objects}/restricted_software.rb +21 -21
  80. data/lib/{jss/api_object → jamf/api/classic/api_objects}/scopable/scope.rb +69 -64
  81. data/lib/{jss/api_object → jamf/api/classic/api_objects}/scopable.rb +11 -13
  82. data/lib/{jss/api_object → jamf/api/classic/api_objects}/script.rb +22 -22
  83. data/lib/{jss/api_object → jamf/api/classic/api_objects}/self_servable.rb +49 -47
  84. data/lib/{jss/api_object → jamf/api/classic/api_objects}/sitable.rb +8 -8
  85. data/lib/{jss/api_object → jamf/api/classic/api_objects}/site.rb +6 -6
  86. data/lib/{jss/api_object → jamf/api/classic/api_objects}/software_update_server.rb +5 -5
  87. data/lib/{jss/api_object → jamf/api/classic/api_objects}/updatable.rb +13 -13
  88. data/lib/{jss/api_object → jamf/api/classic/api_objects}/uploadable.rb +71 -29
  89. data/lib/{jss/api_object → jamf/api/classic/api_objects}/user.rb +18 -18
  90. data/lib/{jss/api_object/extension_attribute → jamf/api/classic/api_objects}/user_extension_attribute.rb +12 -12
  91. data/lib/{jss/api_object/group → jamf/api/classic/api_objects}/user_group.rb +7 -7
  92. data/lib/{jss/api_object → jamf/api/classic/api_objects}/vpp_account.rb +15 -15
  93. data/lib/{jss/api_object → jamf/api/classic/api_objects}/vppable.rb +5 -5
  94. data/lib/{jss/api_object/webhook.rb → jamf/api/classic/api_objects/web_hook.rb} +15 -15
  95. data/lib/{jss/api_object → jamf/api/classic/base_classes}/advanced_search.rb +36 -40
  96. data/lib/{jss → jamf/api/classic/base_classes}/api_object.rb +320 -280
  97. data/lib/{jss/api_object → jamf/api/classic/base_classes}/configuration_profile.rb +13 -16
  98. data/lib/{jss/api_object → jamf/api/classic/base_classes}/extension_attribute.rb +55 -59
  99. data/lib/{jss/api_object → jamf/api/classic/base_classes}/group.rb +97 -78
  100. data/lib/{jss/api_object → jamf/api/classic/base_classes}/patch_source.rb +107 -87
  101. data/lib/{jss → jamf/api/classic}/xml_workaround.rb +12 -12
  102. data/lib/jamf/api/connection/attributes.rb +224 -0
  103. data/lib/jamf/api/connection/cache.rb +148 -0
  104. data/lib/jamf/api/connection/classic_api.rb +288 -0
  105. data/lib/jamf/api/connection/connect.rb +538 -0
  106. data/lib/jamf/api/connection/constants.rb +112 -0
  107. data/lib/jamf/api/connection/default_connection.rb +103 -0
  108. data/lib/jamf/api/connection/jamf_pro_api.rb +174 -0
  109. data/lib/jamf/api/connection/jamf_pro_api_error.rb +109 -0
  110. data/lib/jamf/api/connection/token.rb +295 -99
  111. data/lib/jamf/api/connection.rb +189 -818
  112. data/lib/jamf/api/jamf_pro/api_objects/computer_prestage.rb +82 -0
  113. data/lib/jamf/api/jamf_pro/api_objects/device_enrollment.rb +358 -0
  114. data/lib/jamf/api/jamf_pro/api_objects/inventory_preload_record.rb +172 -0
  115. data/lib/jamf/api/jamf_pro/api_objects/jp_building.rb +116 -0
  116. data/lib/jamf/api/jamf_pro/api_objects/mobile_device_prestage.rb +87 -0
  117. data/lib/jamf/api/jamf_pro/base_classes/oapi_object.rb +614 -0
  118. data/lib/jamf/api/{mixins → jamf_pro/mixins}/bulk_deletable.rb +2 -1
  119. data/lib/jamf/api/jamf_pro/mixins/change_log.rb +246 -0
  120. data/lib/jamf/api/jamf_pro/mixins/collection_resource.rb +762 -0
  121. data/lib/jamf/api/{mixins → jamf_pro/mixins}/filterable.rb +21 -14
  122. data/lib/jamf/api/{mixins → jamf_pro/mixins}/immutable.rb +6 -8
  123. data/lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb +167 -0
  124. data/lib/jamf/api/{mixins → jamf_pro/mixins}/lockable.rb +29 -3
  125. data/lib/jamf/api/jamf_pro/mixins/macos_managed_updates.rb +168 -0
  126. data/lib/jamf/api/jamf_pro/mixins/prestage.rb +356 -0
  127. data/lib/jamf/api/{mixins → jamf_pro/mixins}/sortable.rb +7 -17
  128. data/lib/jamf/api/{mixins → jamf_pro/mixins}/uncreatable.rb +2 -2
  129. data/lib/jamf/api/{mixins → jamf_pro/mixins}/undeletable.rb +2 -2
  130. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_preview_search_results.rb +89 -0
  131. data/lib/jamf/api/jamf_pro/oapi_schemas/access_groups_v2_search_results.rb +89 -0
  132. data/lib/jamf/api/jamf_pro/oapi_schemas/account.rb +159 -0
  133. data/lib/jamf/api/jamf_pro/oapi_schemas/account_driven_user_enrollment_session_token_settings.rb +90 -0
  134. data/lib/jamf/api/jamf_pro/oapi_schemas/account_group.rb +123 -0
  135. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences.rb +107 -0
  136. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v1.rb +105 -0
  137. data/lib/jamf/api/jamf_pro/oapi_schemas/account_preferences_v4.rb +117 -0
  138. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history.rb +160 -0
  139. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_history_search_results.rb +89 -0
  140. data/lib/jamf/api/jamf_pro/oapi_schemas/active_patch_summary.rb +131 -0
  141. data/lib/jamf/api/jamf_pro/oapi_schemas/admin_account.rb +82 -0
  142. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search.rb +116 -0
  143. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_criteria_choices.rb +83 -0
  144. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_search_search_results.rb +89 -0
  145. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search.rb +116 -0
  146. data/lib/jamf/api/jamf_pro/oapi_schemas/advanced_user_content_search_search_results.rb +89 -0
  147. data/lib/jamf/api/jamf_pro/oapi_schemas/android_details.rb +162 -0
  148. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error.rb +89 -0
  149. data/lib/jamf/api/jamf_pro/oapi_schemas/api_error_cause.rb +106 -0
  150. data/lib/jamf/api/jamf_pro/oapi_schemas/app_analytics_setting.rb +87 -0
  151. data/lib/jamf/api/jamf_pro/oapi_schemas/app_dynamics_config.rb +133 -0
  152. data/lib/jamf/api/jamf_pro/oapi_schemas/app_path.rb +90 -0
  153. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field.rb +114 -0
  154. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_form_input_field_search_results.rb +89 -0
  155. data/lib/jamf/api/jamf_pro/oapi_schemas/app_request_settings.rb +104 -0
  156. data/lib/jamf/api/jamf_pro/oapi_schemas/apple_tv_details.rb +132 -0
  157. data/lib/jamf/api/jamf_pro/oapi_schemas/application_attributes.rb +87 -0
  158. data/lib/jamf/api/jamf_pro/oapi_schemas/application_configuration.rb +87 -0
  159. data/lib/jamf/api/jamf_pro/oapi_schemas/assign_remove_profile_response_sync_state.rb +112 -0
  160. data/lib/jamf/api/jamf_pro/oapi_schemas/attributes.rb +100 -0
  161. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account.rb +158 -0
  162. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_account_v1.rb +158 -0
  163. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token.rb +90 -0
  164. data/lib/jamf/api/jamf_pro/oapi_schemas/auth_token_v1.rb +90 -0
  165. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization.rb +116 -0
  166. data/lib/jamf/api/jamf_pro/oapi_schemas/authorization_v1.rb +116 -0
  167. data/lib/jamf/api/jamf_pro/oapi_schemas/available_updates.rb +83 -0
  168. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_process_status.rb +115 -0
  169. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_ad_migration_report_request.rb +102 -0
  170. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration.rb +94 -0
  171. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_request.rb +92 -0
  172. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_configuration_update.rb +92 -0
  173. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_mappings.rb +157 -0
  174. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration.rb +146 -0
  175. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_request.rb +145 -0
  176. data/lib/jamf/api/jamf_pro/oapi_schemas/azure_server_configuration_update.rb +131 -0
  177. data/lib/jamf/api/jamf_pro/oapi_schemas/branding_image_url.rb +86 -0
  178. data/lib/jamf/api/jamf_pro/oapi_schemas/building.rb +137 -0
  179. data/lib/jamf/api/jamf_pro/oapi_schemas/building_search_results.rb +89 -0
  180. data/lib/jamf/api/jamf_pro/oapi_schemas/cache_settings.rb +149 -0
  181. data/lib/jamf/api/jamf_pro/oapi_schemas/categories_search_results.rb +89 -0
  182. data/lib/jamf/api/jamf_pro/oapi_schemas/category.rb +103 -0
  183. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_details.rb +88 -0
  184. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_identity_v2.rb +107 -0
  185. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_key.rb +89 -0
  186. data/lib/jamf/api/jamf_pro/oapi_schemas/certificate_record.rb +146 -0
  187. data/lib/jamf/api/jamf_pro/oapi_schemas/classic_ldap_mappings.rb +168 -0
  188. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v2.rb +164 -0
  189. data/lib/jamf/api/jamf_pro/oapi_schemas/client_check_in_v3.rb +134 -0
  190. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common.rb +108 -0
  191. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_request.rb +97 -0
  192. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_id_p_common_response.rb +108 -0
  193. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_pool_statistics.rb +170 -0
  194. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_connection_status.rb +83 -0
  195. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore.rb +102 -0
  196. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_keystore_file.rb +103 -0
  197. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_request.rb +101 -0
  198. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_mappings_response.rb +101 -0
  199. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_request.rb +151 -0
  200. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_response.rb +148 -0
  201. data/lib/jamf/api/jamf_pro/oapi_schemas/cloud_ldap_server_update.rb +148 -0
  202. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_application.rb +124 -0
  203. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_attachment.rb +102 -0
  204. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_certificate.rb +151 -0
  205. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_configuration_profile.rb +118 -0
  206. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching.rb +372 -0
  207. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_alert.rb +120 -0
  208. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_cache_detail.rb +97 -0
  209. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error.rb +98 -0
  210. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_data_migration_error_user_info.rb +89 -0
  211. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent.rb +131 -0
  212. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_alert.rb +105 -0
  213. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_capabilities.rb +124 -0
  214. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_details.rb +118 -0
  215. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_content_caching_parent_local_network.rb +97 -0
  216. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk.rb +143 -0
  217. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_disk_encryption.rb +120 -0
  218. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_extension_attribute.rb +175 -0
  219. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_font.rb +93 -0
  220. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general.rb +230 -0
  221. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_general_update.rb +112 -0
  222. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_group.rb +96 -0
  223. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware.rb +264 -0
  224. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_hardware_update.rb +106 -0
  225. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_ibeacon.rb +81 -0
  226. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory.rb +275 -0
  227. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_preferences.rb +165 -0
  228. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_collection_settings.rb +108 -0
  229. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_recovery_lock_password_response.rb +83 -0
  230. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_search_results.rb +89 -0
  231. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_inventory_update_request.rb +124 -0
  232. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_licensed_software.rb +88 -0
  233. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_local_user_account.rb +189 -0
  234. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_location.rb +93 -0
  235. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_mdm_capability.rb +88 -0
  236. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system.rb +132 -0
  237. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_operating_system_update.rb +82 -0
  238. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_overview.rb +179 -0
  239. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_package_receipts.rb +97 -0
  240. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition.rb +145 -0
  241. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_encryption.rb +93 -0
  242. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_partition_file_vault2_state.rb +97 -0
  243. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_plugin.rb +93 -0
  244. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage.rb +106 -0
  245. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results.rb +89 -0
  246. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_search_results_v2.rb +89 -0
  247. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_prestage_v2.rb +129 -0
  248. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_printer.rb +99 -0
  249. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_purchase.rb +158 -0
  250. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_remote_management.rb +94 -0
  251. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_section.rb +109 -0
  252. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_security.rb +179 -0
  253. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_service.rb +81 -0
  254. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_software_update.rb +93 -0
  255. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_storage.rb +90 -0
  256. data/lib/jamf/api/jamf_pro/oapi_schemas/computer_user_and_location.rb +131 -0
  257. data/lib/jamf/api/jamf_pro/oapi_schemas/computers_search_results.rb +89 -0
  258. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_profile.rb +102 -0
  259. data/lib/jamf/api/jamf_pro/oapi_schemas/configuration_search_results.rb +90 -0
  260. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_candidate_request.rb +123 -0
  261. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_response.rb +122 -0
  262. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_status_response.rb +85 -0
  263. data/lib/jamf/api/jamf_pro/oapi_schemas/connection_configuration_update_request.rb +109 -0
  264. data/lib/jamf/api/jamf_pro/oapi_schemas/country.rb +87 -0
  265. data/lib/jamf/api/jamf_pro/oapi_schemas/country_codes.rb +83 -0
  266. data/lib/jamf/api/jamf_pro/oapi_schemas/create_path.rb +97 -0
  267. data/lib/jamf/api/jamf_pro/oapi_schemas/csa_token.rb +93 -0
  268. data/lib/jamf/api/jamf_pro/oapi_schemas/current_account.rb +159 -0
  269. data/lib/jamf/api/jamf_pro/oapi_schemas/current_authorization.rb +108 -0
  270. data/lib/jamf/api/jamf_pro/oapi_schemas/data_roaming_setting.rb +87 -0
  271. data/lib/jamf/api/jamf_pro/oapi_schemas/database_password.rb +88 -0
  272. data/lib/jamf/api/jamf_pro/oapi_schemas/day_of_week.rb +92 -0
  273. data/lib/jamf/api/jamf_pro/oapi_schemas/delete_user_command.rb +93 -0
  274. data/lib/jamf/api/jamf_pro/oapi_schemas/department.rb +97 -0
  275. data/lib/jamf/api/jamf_pro/oapi_schemas/departments_search_results.rb +89 -0
  276. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task.rb +129 -0
  277. data/lib/jamf/api/jamf_pro/oapi_schemas/deployment_task_search_results.rb +91 -0
  278. data/lib/jamf/api/jamf_pro/oapi_schemas/device_communication_settings.rb +128 -0
  279. data/lib/jamf/api/jamf_pro/oapi_schemas/device_compliance_information.rb +117 -0
  280. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device.rb +162 -0
  281. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_device_search_results.rb +89 -0
  282. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_body.rb +83 -0
  283. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_disown_response.rb +82 -0
  284. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance.rb +163 -0
  285. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_search_results.rb +89 -0
  286. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_instance_sync_status.rb +98 -0
  287. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage.rb +215 -0
  288. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_prestage_v2.rb +234 -0
  289. data/lib/jamf/api/jamf_pro/oapi_schemas/device_enrollment_token.rb +94 -0
  290. data/lib/jamf/api/jamf_pro/oapi_schemas/diagnostic_submission_setting.rb +87 -0
  291. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook.rb +152 -0
  292. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_exclusions.rb +137 -0
  293. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_limitations.rb +97 -0
  294. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_scope.rb +170 -0
  295. data/lib/jamf/api/jamf_pro/oapi_schemas/ebook_search_results.rb +89 -0
  296. data/lib/jamf/api/jamf_pro/oapi_schemas/enable_lost_mode_command.rb +93 -0
  297. data/lib/jamf/api/jamf_pro/oapi_schemas/engage.rb +84 -0
  298. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_preview.rb +141 -0
  299. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_access_group_v2.rb +132 -0
  300. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization.rb +106 -0
  301. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_branding_settings.rb +111 -0
  302. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependencies.rb +83 -0
  303. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_dependency.rb +93 -0
  304. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_ldap_group_access.rb +87 -0
  305. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel.rb +89 -0
  306. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_ldap_auth.rb +121 -0
  307. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_list.rb +83 -0
  308. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_sso_auth.rb +113 -0
  309. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_panel_text.rb +112 -0
  310. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results.rb +89 -0
  311. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_search_results_v2.rb +89 -0
  312. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_customization_v2.rb +116 -0
  313. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_method.rb +97 -0
  314. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_process_text_object.rb +346 -0
  315. data/lib/jamf/api/jamf_pro/oapi_schemas/enrollment_settings_v2.rb +273 -0
  316. data/lib/jamf/api/jamf_pro/oapi_schemas/export_field.rb +91 -0
  317. data/lib/jamf/api/jamf_pro/oapi_schemas/export_parameters.rb +121 -0
  318. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute.rb +115 -0
  319. data/lib/jamf/api/jamf_pro/oapi_schemas/extension_attribute_v2.rb +116 -0
  320. data/lib/jamf/api/jamf_pro/oapi_schemas/external_recipient.rb +91 -0
  321. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment.rb +89 -0
  322. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_delete.rb +83 -0
  323. data/lib/jamf/api/jamf_pro/oapi_schemas/file_attachment_v2.rb +89 -0
  324. data/lib/jamf/api/jamf_pro/oapi_schemas/filter.rb +104 -0
  325. data/lib/jamf/api/jamf_pro/oapi_schemas/font_path.rb +90 -0
  326. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage.rb +105 -0
  327. data/lib/jamf/api/jamf_pro/oapi_schemas/get_computer_prestage_v2.rb +104 -0
  328. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization.rb +87 -0
  329. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel.rb +89 -0
  330. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_ldap_auth.rb +93 -0
  331. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_sso_auth.rb +93 -0
  332. data/lib/jamf/api/jamf_pro/oapi_schemas/get_enrollment_customization_panel_text.rb +93 -0
  333. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage.rb +105 -0
  334. data/lib/jamf/api/jamf_pro/oapi_schemas/get_mobile_device_prestage_v2.rb +103 -0
  335. data/lib/jamf/api/jamf_pro/oapi_schemas/group_mappings.rb +138 -0
  336. data/lib/jamf/api/jamf_pro/oapi_schemas/group_membership.rb +94 -0
  337. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search.rb +106 -0
  338. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_request.rb +83 -0
  339. data/lib/jamf/api/jamf_pro/oapi_schemas/group_test_search_response.rb +89 -0
  340. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results.rb +137 -0
  341. data/lib/jamf/api/jamf_pro/oapi_schemas/history_search_results_v1.rb +91 -0
  342. data/lib/jamf/api/jamf_pro/oapi_schemas/href_response.rb +168 -0
  343. data/lib/jamf/api/jamf_pro/oapi_schemas/icon_response.rb +91 -0
  344. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name.rb +92 -0
  345. data/lib/jamf/api/jamf_pro/oapi_schemas/id_and_name_v2.rb +88 -0
  346. data/lib/jamf/api/jamf_pro/oapi_schemas/ids.rb +99 -0
  347. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize.rb +133 -0
  348. data/lib/jamf/api/jamf_pro/oapi_schemas/initialize_v1.rb +133 -0
  349. data/lib/jamf/api/jamf_pro/oapi_schemas/install_package.rb +103 -0
  350. data/lib/jamf/api/jamf_pro/oapi_schemas/integer_wrapper.rb +84 -0
  351. data/lib/jamf/api/jamf_pro/oapi_schemas/internal_recipient.rb +94 -0
  352. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_information.rb +113 -0
  353. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_error.rb +123 -0
  354. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error.rb +89 -0
  355. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_error_cause.rb +105 -0
  356. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_csv_validation_success.rb +86 -0
  357. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute.rb +89 -0
  358. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column.rb +87 -0
  359. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_extension_attribute_column_result.rb +89 -0
  360. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_invalid_csv_response.rb +88 -0
  361. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record.rb +248 -0
  362. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results.rb +91 -0
  363. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_search_results_v2.rb +89 -0
  364. data/lib/jamf/api/jamf_pro/oapi_schemas/inventory_preload_record_v2.rb +263 -0
  365. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_configuration.rb +129 -0
  366. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_branding_search_results.rb +89 -0
  367. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details.rb +255 -0
  368. data/lib/jamf/api/jamf_pro/oapi_schemas/ios_details_v2.rb +255 -0
  369. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_application_response.rb +95 -0
  370. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_nation_credentials.rb +90 -0
  371. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_package_response.rb +107 -0
  372. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_information.rb +124 -0
  373. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_information_v2.rb +124 -0
  374. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_server_url.rb +92 -0
  375. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_pro_version.rb +82 -0
  376. data/lib/jamf/api/jamf_pro/oapi_schemas/jamf_protect_plan.rb +125 -0
  377. data/lib/jamf/api/jamf_pro/oapi_schemas/language_code.rb +94 -0
  378. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_request.rb +99 -0
  379. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_response.rb +101 -0
  380. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_configuration_update.rb +99 -0
  381. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group.rb +107 -0
  382. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_group_search_results.rb +91 -0
  383. data/lib/jamf/api/jamf_pro/oapi_schemas/ldap_server.rb +94 -0
  384. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile.rb +126 -0
  385. data/lib/jamf/api/jamf_pro/oapi_schemas/linked_connect_profile_search_results.rb +89 -0
  386. data/lib/jamf/api/jamf_pro/oapi_schemas/locale.rb +88 -0
  387. data/lib/jamf/api/jamf_pro/oapi_schemas/location.rb +125 -0
  388. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information.rb +146 -0
  389. data/lib/jamf/api/jamf_pro/oapi_schemas/location_information_v2.rb +146 -0
  390. data/lib/jamf/api/jamf_pro/oapi_schemas/location_v2.rb +124 -0
  391. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_configuration.rb +118 -0
  392. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_branding_search_results.rb +89 -0
  393. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update.rb +138 -0
  394. data/lib/jamf/api/jamf_pro/oapi_schemas/mac_os_managed_software_update_response.rb +89 -0
  395. data/lib/jamf/api/jamf_pro/oapi_schemas/markdown.rb +84 -0
  396. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_client_type.rb +90 -0
  397. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command.rb +109 -0
  398. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_client.rb +88 -0
  399. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_request.rb +89 -0
  400. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_state.rb +89 -0
  401. data/lib/jamf/api/jamf_pro/oapi_schemas/mdm_command_type.rb +172 -0
  402. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_mappings.rb +84 -0
  403. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_request.rb +90 -0
  404. data/lib/jamf/api/jamf_pro/oapi_schemas/membership_test_search_response.rb +88 -0
  405. data/lib/jamf/api/jamf_pro/oapi_schemas/memcached_endpoints.rb +113 -0
  406. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device.rb +153 -0
  407. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_application.rb +100 -0
  408. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment.rb +89 -0
  409. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_attachment_v2.rb +89 -0
  410. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v1.rb +87 -0
  411. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_certificate_v2.rb +146 -0
  412. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details.rb +235 -0
  413. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_get_v2.rb +83 -0
  414. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_details_v2.rb +259 -0
  415. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_ebook.rb +94 -0
  416. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_extension_attribute_results.rb +83 -0
  417. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_group.rb +96 -0
  418. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage.rb +136 -0
  419. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name.rb +94 -0
  420. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_name_v2.rb +94 -0
  421. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names.rb +118 -0
  422. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_names_v2.rb +118 -0
  423. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results.rb +89 -0
  424. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_search_results_v2.rb +89 -0
  425. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_prestage_v2.rb +175 -0
  426. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_params.rb +144 -0
  427. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results.rb +89 -0
  428. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_search_results_v2.rb +89 -0
  429. data/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_v2.rb +158 -0
  430. data/lib/jamf/api/jamf_pro/oapi_schemas/network.rb +171 -0
  431. data/lib/jamf/api/jamf_pro/oapi_schemas/network_v2.rb +179 -0
  432. data/lib/jamf/api/jamf_pro/oapi_schemas/notification.rb +96 -0
  433. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_type.rb +141 -0
  434. data/lib/jamf/api/jamf_pro/oapi_schemas/notification_v1.rb +96 -0
  435. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history.rb +133 -0
  436. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_note.rb +133 -0
  437. data/lib/jamf/api/jamf_pro/oapi_schemas/object_history_v1.rb +106 -0
  438. data/lib/jamf/api/jamf_pro/oapi_schemas/order_by.rb +95 -0
  439. data/lib/jamf/api/jamf_pro/oapi_schemas/package_manifest.rb +148 -0
  440. data/lib/jamf/api/jamf_pro/oapi_schemas/parent_app.rb +131 -0
  441. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_ids_on_dashboard.rb +83 -0
  442. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt.rb +102 -0
  443. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_attempt_action.rb +94 -0
  444. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log.rb +124 -0
  445. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_log_search_results.rb +89 -0
  446. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_on_dashboard.rb +82 -0
  447. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_policy_summary.rb +146 -0
  448. data/lib/jamf/api/jamf_pro/oapi_schemas/patch_version.rb +96 -0
  449. data/lib/jamf/api/jamf_pro/oapi_schemas/personal_hotspot_setting.rb +87 -0
  450. data/lib/jamf/api/jamf_pro/oapi_schemas/plan_search_results.rb +89 -0
  451. data/lib/jamf/api/jamf_pro/oapi_schemas/plugin_path.rb +90 -0
  452. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties.rb +91 -0
  453. data/lib/jamf/api/jamf_pro/oapi_schemas/policy_properties_v1.rb +91 -0
  454. data/lib/jamf/api/jamf_pro/oapi_schemas/post_computer_prestage_v2.rb +85 -0
  455. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependencies.rb +85 -0
  456. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_dependency.rb +93 -0
  457. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment.rb +95 -0
  458. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_file_attachment_v2.rb +95 -0
  459. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information.rb +174 -0
  460. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_purchasing_information_v2.rb +174 -0
  461. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope.rb +84 -0
  462. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment.rb +93 -0
  463. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_assignment_v2.rb +94 -0
  464. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response.rb +109 -0
  465. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_response_v2.rb +109 -0
  466. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_update.rb +113 -0
  467. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_scope_v2.rb +84 -0
  468. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status.rb +98 -0
  469. data/lib/jamf/api/jamf_pro/oapi_schemas/prestage_sync_status_v2.rb +98 -0
  470. data/lib/jamf/api/jamf_pro/oapi_schemas/process_texts_search_results.rb +91 -0
  471. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_registration_request.rb +98 -0
  472. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_settings_response.rb +141 -0
  473. data/lib/jamf/api/jamf_pro/oapi_schemas/protect_updatable_settings_request.rb +83 -0
  474. data/lib/jamf/api/jamf_pro/oapi_schemas/provisioning_profile.rb +95 -0
  475. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing.rb +153 -0
  476. data/lib/jamf/api/jamf_pro/oapi_schemas/purchasing_v2.rb +153 -0
  477. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage.rb +82 -0
  478. data/lib/jamf/api/jamf_pro/oapi_schemas/put_computer_prestage_v2.rb +91 -0
  479. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage.rb +82 -0
  480. data/lib/jamf/api/jamf_pro/oapi_schemas/put_mobile_device_prestage_v2.rb +82 -0
  481. data/lib/jamf/api/jamf_pro/oapi_schemas/recalculation_results.rb +92 -0
  482. data/lib/jamf/api/jamf_pro/oapi_schemas/recipient.rb +94 -0
  483. data/lib/jamf/api/jamf_pro/oapi_schemas/recipients.rb +82 -0
  484. data/lib/jamf/api/jamf_pro/oapi_schemas/redeploy_jamf_management_framework_response.rb +88 -0
  485. data/lib/jamf/api/jamf_pro/oapi_schemas/reenrollment.rb +117 -0
  486. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_response.rb +107 -0
  487. data/lib/jamf/api/jamf_pro/oapi_schemas/remote_administration_search_results.rb +90 -0
  488. data/lib/jamf/api/jamf_pro/oapi_schemas/renew_mdm_profile_response.rb +82 -0
  489. data/lib/jamf/api/jamf_pro/oapi_schemas/restart_device_command.rb +95 -0
  490. data/lib/jamf/api/jamf_pro/oapi_schemas/retry_patch_policy_params.rb +97 -0
  491. data/lib/jamf/api/jamf_pro/oapi_schemas/safelisted_app.rb +89 -0
  492. data/lib/jamf/api/jamf_pro/oapi_schemas/script.rb +192 -0
  493. data/lib/jamf/api/jamf_pro/oapi_schemas/scripts_search_results.rb +89 -0
  494. data/lib/jamf/api/jamf_pro/oapi_schemas/search_active_patch_history_params.rb +121 -0
  495. data/lib/jamf/api/jamf_pro/oapi_schemas/search_patch_policy_log_params.rb +121 -0
  496. data/lib/jamf/api/jamf_pro/oapi_schemas/security.rb +130 -0
  497. data/lib/jamf/api/jamf_pro/oapi_schemas/security_v2.rb +129 -0
  498. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_install_settings.rb +92 -0
  499. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_interaction_settings.rb +122 -0
  500. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_login_settings.rb +113 -0
  501. data/lib/jamf/api/jamf_pro/oapi_schemas/self_service_settings.rb +100 -0
  502. data/lib/jamf/api/jamf_pro/oapi_schemas/session.rb +82 -0
  503. data/lib/jamf/api/jamf_pro/oapi_schemas/session_candidate_request.rb +108 -0
  504. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details.rb +175 -0
  505. data/lib/jamf/api/jamf_pro/oapi_schemas/session_details_search_results.rb +90 -0
  506. data/lib/jamf/api/jamf_pro/oapi_schemas/session_status.rb +98 -0
  507. data/lib/jamf/api/jamf_pro/oapi_schemas/set_recovery_lock_command.rb +82 -0
  508. data/lib/jamf/api/jamf_pro/oapi_schemas/settings_command.rb +167 -0
  509. data/lib/jamf/api/jamf_pro/oapi_schemas/shared_device_configuration.rb +87 -0
  510. data/lib/jamf/api/jamf_pro/oapi_schemas/signature.rb +93 -0
  511. data/lib/jamf/api/jamf_pro/oapi_schemas/site.rb +91 -0
  512. data/lib/jamf/api/jamf_pro/oapi_schemas/smart_search_criterion.rb +118 -0
  513. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_configuration.rb +89 -0
  514. data/lib/jamf/api/jamf_pro/oapi_schemas/software_title_patch_policy_summaries.rb +89 -0
  515. data/lib/jamf/api/jamf_pro/oapi_schemas/software_update_settings.rb +88 -0
  516. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore.rb +128 -0
  517. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_cert_parse_response.rb +130 -0
  518. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_details.rb +107 -0
  519. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_parse.rb +103 -0
  520. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response.rb +120 -0
  521. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_response_with_details.rb +93 -0
  522. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_keystore_with_details.rb +93 -0
  523. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_metadata_url.rb +83 -0
  524. data/lib/jamf/api/jamf_pro/oapi_schemas/sso_settings.rb +240 -0
  525. data/lib/jamf/api/jamf_pro/oapi_schemas/startup_status.rb +185 -0
  526. data/lib/jamf/api/jamf_pro/oapi_schemas/static_user_group.rb +91 -0
  527. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity.rb +107 -0
  528. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_certificate_upload.rb +99 -0
  529. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_create.rb +90 -0
  530. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_search_results.rb +89 -0
  531. data/lib/jamf/api/jamf_pro/oapi_schemas/supervision_identity_update.rb +83 -0
  532. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_features.rb +105 -0
  533. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_request.rb +108 -0
  534. data/lib/jamf/api/jamf_pro/oapi_schemas/teacher_settings_response.rb +122 -0
  535. data/lib/jamf/api/jamf_pro/oapi_schemas/time_frame.rb +87 -0
  536. data/lib/jamf/api/jamf_pro/oapi_schemas/time_zone.rb +107 -0
  537. data/lib/jamf/api/jamf_pro/oapi_schemas/tv_os_details.rb +140 -0
  538. data/lib/jamf/api/jamf_pro/oapi_schemas/udids.rb +83 -0
  539. data/lib/jamf/api/jamf_pro/oapi_schemas/update_apple_tv.rb +87 -0
  540. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios.rb +81 -0
  541. data/lib/jamf/api/jamf_pro/oapi_schemas/update_ios_v2.rb +81 -0
  542. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device.rb +122 -0
  543. data/lib/jamf/api/jamf_pro/oapi_schemas/update_mobile_device_v2.rb +137 -0
  544. data/lib/jamf/api/jamf_pro/oapi_schemas/update_tv_os.rb +87 -0
  545. data/lib/jamf/api/jamf_pro/oapi_schemas/user_attributes.rb +117 -0
  546. data/lib/jamf/api/jamf_pro/oapi_schemas/user_mappings.rb +193 -0
  547. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search.rb +112 -0
  548. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_request.rb +83 -0
  549. data/lib/jamf/api/jamf_pro/oapi_schemas/user_test_search_response.rb +89 -0
  550. data/lib/jamf/api/jamf_pro/oapi_schemas/v1_site.rb +91 -0
  551. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_ca_record.rb +147 -0
  552. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record.rb +87 -0
  553. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_pki_payload_record_search_results.rb +89 -0
  554. data/lib/jamf/api/jamf_pro/oapi_schemas/venafi_service_status.rb +83 -0
  555. data/lib/jamf/api/jamf_pro/oapi_schemas/verbose_package_deployment_response.rb +90 -0
  556. data/lib/jamf/api/jamf_pro/oapi_schemas/voice_roaming_setting.rb +87 -0
  557. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_content.rb +153 -0
  558. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location.rb +86 -0
  559. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_list_view.rb +171 -0
  560. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_patch.rb +111 -0
  561. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_location_post.rb +114 -0
  562. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_locations.rb +89 -0
  563. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription.rb +86 -0
  564. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscription_base.rb +127 -0
  565. data/lib/jamf/api/jamf_pro/oapi_schemas/volume_purchasing_subscriptions.rb +89 -0
  566. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_admin_account.rb +119 -0
  567. data/lib/jamf/api/jamf_pro/oapi_schemas/vpp_token_subscription.rb +123 -0
  568. data/lib/jamf/api/jamf_pro/oapi_schemas/web_link.rb +87 -0
  569. data/lib/jamf/api/jamf_pro/oapi_schemas.rb +35 -0
  570. data/lib/jamf/api/jamf_pro/other_classes/change_log_entry.rb +37 -0
  571. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/ip_address.rb +2 -8
  572. data/lib/jamf/api/jamf_pro/other_classes/pager.rb +257 -0
  573. data/lib/jamf/api/{attribute_classes → jamf_pro/other_classes}/timestamp.rb +18 -14
  574. data/lib/jamf/{api/mixins/base_class.rb → base_class.rb} +8 -8
  575. data/lib/jamf/client/jamf_binary.rb +104 -99
  576. data/lib/jamf/client/jamf_helper.rb +274 -256
  577. data/lib/jamf/client/management_action.rb +84 -75
  578. data/lib/jamf/client.rb +15 -86
  579. data/lib/jamf/composer.rb +5 -5
  580. data/lib/jamf/configuration.rb +219 -196
  581. data/lib/jamf/{api/json_objects/prestage_sync_status.rb → constants.rb} +15 -32
  582. data/lib/{jss → jamf}/db_connection.rb +23 -31
  583. data/lib/{jpapi.rb → jamf/deprecations/deprecated_api_constant.rb} +5 -4
  584. data/lib/{jss/ruby_extensions/string.rb → jamf/deprecations/deprecated_config_constant.rb} +4 -12
  585. data/lib/jamf/exceptions.rb +14 -15
  586. data/lib/jamf/oapi_validate.rb +502 -0
  587. data/lib/jamf/ruby_extensions/array/predicates.rb +3 -1
  588. data/lib/jamf/ruby_extensions/array/utils.rb +2 -11
  589. data/lib/jamf/ruby_extensions/array.rb +1 -1
  590. data/lib/jamf/ruby_extensions/filetest/predicates.rb +2 -1
  591. data/lib/jamf/ruby_extensions/filetest.rb +1 -1
  592. data/lib/jamf/ruby_extensions/hash/{backports.rb → utils.rb} +53 -34
  593. data/lib/jamf/ruby_extensions/hash.rb +3 -3
  594. data/lib/jamf/ruby_extensions/ipaddr/utils.rb +7 -4
  595. data/lib/jamf/ruby_extensions/ipaddr.rb +2 -2
  596. data/lib/jamf/ruby_extensions/object/predicates.rb +3 -1
  597. data/lib/jamf/ruby_extensions/object.rb +1 -1
  598. data/lib/jamf/ruby_extensions/pathname/predicates.rb +3 -1
  599. data/lib/jamf/ruby_extensions/pathname/utils.rb +11 -5
  600. data/lib/jamf/ruby_extensions/pathname.rb +1 -1
  601. data/lib/jamf/ruby_extensions/string/conversions.rb +16 -1
  602. data/lib/jamf/ruby_extensions/string/predicates.rb +3 -1
  603. data/lib/jamf/ruby_extensions/string.rb +1 -3
  604. data/lib/{jss/ruby_extensions/time.rb → jamf/ruby_extensions/time/utils.rb} +40 -25
  605. data/lib/{jss/version.rb → jamf/ruby_extensions/time.rb} +7 -6
  606. data/lib/jamf/ruby_extensions.rb +9 -9
  607. data/lib/jamf/utility.rb +626 -410
  608. data/lib/jamf/validate.rb +86 -125
  609. data/lib/jamf/version.rb +3 -3
  610. data/lib/jamf.rb +76 -131
  611. data/lib/jss-api.rb +2 -2
  612. data/lib/jss.rb +3 -215
  613. data/lib/ruby-jss.rb +2 -2
  614. data/lib/zeitwerk_config.rb +163 -0
  615. data/test/README-TEST.md +65 -0
  616. data/test/bin/runtests +97 -130
  617. data/test/lib/jamf_test/APITest.rb +106 -0
  618. data/{lib/jss/ruby_extensions/filetest.rb → test/lib/jamf_test/advanced_search.rb} +16 -20
  619. data/test/lib/jamf_test/auth.rb +267 -0
  620. data/test/lib/jamf_test/collection_tests.rb +388 -0
  621. data/test/lib/jamf_test/prestage_tests.rb +135 -0
  622. data/test/lib/{testhelper.rb → jamf_test.rb} +15 -12
  623. data/{lib/jss/ruby_extensions.rb → test/tests/advanced_computer_search.rb} +11 -12
  624. data/test/tests/advanced_mobile_device_search.rb +36 -0
  625. data/test/tests/advanced_user_search.rb +36 -0
  626. data/test/tests/building.rb +41 -0
  627. data/test/tests/category.rb +41 -0
  628. data/test/tests/computer.rb +41 -0
  629. data/test/tests/computer_group.rb +132 -0
  630. data/test/tests/computer_prestage.rb +36 -0
  631. data/test/tests/department.rb +41 -0
  632. data/test/tests/device_enrollment.rb +101 -0
  633. data/test/tests/inventory_preload_record.rb +131 -0
  634. data/test/tests/jp_building.rb +41 -0
  635. data/test/tests/mobile_device.rb +41 -0
  636. data/test/tests/mobile_device_prestage.rb +37 -0
  637. data/test/tests/policy.rb +151 -0
  638. metadata +654 -213
  639. data/lib/jamf/api/base_classes/collection_resource.rb +0 -612
  640. data/lib/jamf/api/base_classes/json_object.rb +0 -1103
  641. data/lib/jamf/api/base_classes/prestage.rb +0 -503
  642. data/lib/jamf/api/base_classes/resource.rb +0 -259
  643. data/lib/jamf/api/base_classes/singleton_resource.rb +0 -88
  644. data/lib/jamf/api/connection/api_error.rb +0 -111
  645. data/lib/jamf/api/connection/api_error_styleguide.rb +0 -96
  646. data/lib/jamf/api/json_objects/change_log_entry.rb +0 -77
  647. data/lib/jamf/api/json_objects/country.rb +0 -51
  648. data/lib/jamf/api/json_objects/device_enrollment_device.rb +0 -165
  649. data/lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb +0 -81
  650. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +0 -71
  651. data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +0 -57
  652. data/lib/jamf/api/json_objects/locale.rb +0 -59
  653. data/lib/jamf/api/json_objects/md_prestage_name.rb +0 -57
  654. data/lib/jamf/api/json_objects/md_prestage_names.rb +0 -82
  655. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +0 -214
  656. data/lib/jamf/api/json_objects/prestage_assignment.rb +0 -76
  657. data/lib/jamf/api/json_objects/prestage_location.rb +0 -104
  658. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +0 -132
  659. data/lib/jamf/api/json_objects/prestage_scope.rb +0 -57
  660. data/lib/jamf/api/json_objects/time_zone.rb +0 -105
  661. data/lib/jamf/api/mixins/change_log.rb +0 -288
  662. data/lib/jamf/api/mixins/extendable.rb +0 -75
  663. data/lib/jamf/api/mixins/pageable.rb +0 -208
  664. data/lib/jamf/api/mixins/searchable.rb +0 -202
  665. data/lib/jamf/api/resources/collection_resources/building.rb +0 -121
  666. data/lib/jamf/api/resources/collection_resources/category.rb +0 -83
  667. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +0 -89
  668. data/lib/jamf/api/resources/collection_resources/department.rb +0 -78
  669. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +0 -384
  670. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +0 -289
  671. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +0 -143
  672. data/lib/jamf/api/resources/collection_resources/script.rb +0 -226
  673. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +0 -141
  674. data/lib/jamf/api/resources/singleton_resources/locales.rb +0 -155
  675. data/lib/jamf/api/resources/singleton_resources/time_zones.rb +0 -213
  676. data/lib/jamf/compatibility.rb +0 -88
  677. data/lib/jamf/ruby_extensions/dig.rb +0 -52
  678. data/lib/jamf/ruby_extensions/string/backports.rb +0 -66
  679. data/lib/jss/api_connection.rb +0 -1029
  680. data/lib/jss/api_object/app_store_country_codes.rb +0 -298
  681. data/lib/jss/api_object/computer/application_installs.rb +0 -118
  682. data/lib/jss/client/jamf_binary.rb +0 -132
  683. data/lib/jss/client/jamf_helper.rb +0 -298
  684. data/lib/jss/client/management_action.rb +0 -113
  685. data/lib/jss/client.rb +0 -301
  686. data/lib/jss/compatibility.rb +0 -88
  687. data/lib/jss/composer.rb +0 -190
  688. data/lib/jss/configuration.rb +0 -319
  689. data/lib/jss/exceptions.rb +0 -115
  690. data/lib/jss/ruby_extensions/array.rb +0 -52
  691. data/lib/jss/ruby_extensions/hash.rb +0 -140
  692. data/lib/jss/ruby_extensions/ipaddr.rb +0 -92
  693. data/lib/jss/ruby_extensions/object.rb +0 -19
  694. data/lib/jss/ruby_extensions/pathname.rb +0 -78
  695. data/lib/jss/ruby_extensions/string/backports.rb +0 -68
  696. data/lib/jss/ruby_extensions/string/conversions.rb +0 -69
  697. data/lib/jss/ruby_extensions/string/predicates.rb +0 -57
  698. data/lib/jss/server.rb +0 -146
  699. data/lib/jss/utility.rb +0 -672
  700. data/lib/jss/validate.rb +0 -248
  701. data/test/README.md +0 -147
  702. data/test/lib/testhelper/auth.rb +0 -275
  703. data/test/lib/testhelper/patch_mgmt.rb +0 -123
  704. data/test/specs/api_connection_spec.rb +0 -57
  705. data/test/specs/patch01_source_spec.rb +0 -54
  706. data/test/specs/patch02_internal_source_spec.rb +0 -88
  707. data/test/specs/patch03_external_source_spec.rb +0 -120
  708. data/test/specs/patch04_titles_spec.rb +0 -207
  709. data/test/specs/patch05_policies_spec.rb +0 -119
  710. data/test/specs/patch06_cleanup_spec.rb +0 -52
  711. data/test/specs/policy_spec.rb +0 -112
@@ -1,4 +1,4 @@
1
- ### Copyright 2020 Pixar
1
+ ### Copyright 2022 Pixar
2
2
 
3
3
  ###
4
4
  ### Licensed under the Apache License, Version 2.0 (the "Apache License")
@@ -24,7 +24,7 @@
24
24
  ###
25
25
 
26
26
  ###
27
- module JSS
27
+ module Jamf
28
28
 
29
29
  # Classes
30
30
  #####################################
@@ -33,7 +33,7 @@ module JSS
33
33
  # methods and constants that apply to all API resouces.
34
34
  #
35
35
  # See the README.md file for general info about using subclasses of
36
- # JSS::APIObject
36
+ # Jamf::APIObject
37
37
  #
38
38
  # == Subclassing
39
39
  #
@@ -56,15 +56,15 @@ module JSS
56
56
  # === Object Creation
57
57
  #
58
58
  # If a subclass should be able to be created in the JSS be sure to include
59
- # {JSS::Creatable}
59
+ # {Jamf::Creatable}
60
60
  #
61
61
  # The constructor should verify any extra required data in the args
62
62
  #
63
- # See {JSS::Creatable} for more details.
63
+ # See {Jamf::Creatable} for more details.
64
64
  #
65
65
  # === Object Modification
66
66
  #
67
- # If a subclass should be modifiable in the JSS, include {JSS::Updatable},
67
+ # If a subclass should be modifiable in the JSS, include {Jamf::Updatable},
68
68
  # q.v. for details.
69
69
  #
70
70
  # === Object Deletion
@@ -156,7 +156,7 @@ module JSS
156
156
  #
157
157
  # For example, here's a summary-hash for a single MobileDevice from the
158
158
  # list-resource '...JSSResource/mobiledevices', which you might get in the
159
- # Array returned by JSS::MobileDevice.all:
159
+ # Array returned by Jamf::MobileDevice.all:
160
160
  #
161
161
  # {
162
162
  # :id=>3964,
@@ -255,7 +255,7 @@ module JSS
255
255
  # no way to guarantee which object you get back.
256
256
  #
257
257
  # In those subclasses, set NON_UNIQUE_NAMES to any value, and a
258
- # JSS::AmbiguousError exception will be raised when trying to fetch by name
258
+ # Jamf::AmbiguousError exception will be raised when trying to fetch by name
259
259
  # and the name isn't unique.
260
260
  #
261
261
  # Because of the extra processing, the check for this state will only happen
@@ -265,21 +265,81 @@ module JSS
265
265
  #
266
266
  # When that's the case, fetching explicitly by name, or when fetching with a
267
267
  # plain search term that matches a non-unique name, will raise a
268
- # JSS::AmbiguousError exception,when the name isn't unique. If that happens,
268
+ # Jamf::AmbiguousError exception,when the name isn't unique. If that happens,
269
269
  # you'll have to use some other identifier to fetch the desired object.
270
270
  #
271
271
  # Note: Fetching, finding valid id, and name collisions are case-insensitive.
272
272
  #
273
273
  class APIObject
274
274
 
275
+ include Comparable
276
+
277
+ # COMPARABLE
278
+ # APIobjects are == if all of their lookup key values are the same
279
+ #
280
+ def <=>(other)
281
+ idents_combined <=> other.idents_combined
282
+ end
283
+
284
+ def idents_combined
285
+ my_keys = self.class.lookup_keys.values.uniq
286
+ my_keys.map { |k| send(k).to_s }.sort.join
287
+ end
288
+
289
+ # Meta Programming
290
+ ####################################################
291
+
292
+ # Loop through the defined lookup keys and make
293
+ # .all_<key>s methods for each one, with alises as needed.
294
+ #
295
+ # This is called automatically when subclasses are loaded by zeitwerk
296
+ #
297
+ def self.define_identifier_list_methods
298
+ Jamf.load_msg "defining list-methods for APIObject subclass #{self}"
299
+
300
+ lookup_keys.each do |als, key|
301
+ meth_name = key.to_s.end_with?('s') ? "all_#{key}es" : "all_#{key}s"
302
+ if als == key
303
+ # the all_ method - skip if defined in the class
304
+ next if singleton_methods.include? meth_name.to_sym
305
+
306
+ define_singleton_method meth_name do |refresh = false, cached_list: nil, api: nil, cnx: Jamf.cnx|
307
+ cnx = api if api
308
+ list = cached_list || all(refresh, cnx: cnx)
309
+ list.map { |i| i[key] }
310
+ end
311
+ Jamf.load_msg "Defined method #{self}##{meth_name}"
312
+
313
+ else
314
+ # an alias - skip if defined in the class
315
+ als_name = als.to_s.end_with?('s') ? "all_#{als}es" : "all_#{als}s"
316
+
317
+ next if singleton_methods.include? als_name.to_sym
318
+
319
+ define_singleton_method als_name do |refresh = false, api: nil, cnx: Jamf.cnx|
320
+ cnx = api if api
321
+ send meth_name, refresh, cnx: cnx
322
+ end
323
+ Jamf.load_msg "Defined alias '#{als_name}' of #{self}##{meth_name}"
324
+
325
+ end # if
326
+ end # lookup_keys.each
327
+
328
+ true
329
+ end # self.define_identifier_list_methods
330
+
275
331
  # Constants
276
332
  ####################################
277
333
 
334
+ # which API do APIObjects come from?
335
+ # The JPAPI equivalent is in Jamf::JPAPIResource
336
+ API_SOURCE = :classic
337
+
278
338
  # '.new' can only be called from these methods:
279
- OK_INSTANTIATORS = ['make', 'fetch', 'block in fetch'].freeze
339
+ OK_INSTANTIATORS = ['make', 'create', 'fetch', 'block in fetch'].freeze
280
340
 
281
341
  # See the discussion of 'Lookup Keys' in the comments/docs
282
- # for {JSS::APIObject}
342
+ # for {Jamf::APIObject}
283
343
  #
284
344
  DEFAULT_LOOKUP_KEYS = {
285
345
  id: { fetch_rsrc_key: :id },
@@ -397,11 +457,11 @@ module JSS
397
457
 
398
458
  # Return an Array of Hashes for all objects of this subclass in the JSS.
399
459
  #
400
- # This method is only valid in subclasses of JSS::APIObject, and is
460
+ # This method is only valid in subclasses of Jamf::APIObject, and is
401
461
  # the parsed JSON output of an API query for the resource defined in the
402
462
  # subclass's RSRC_BASE
403
463
  #
404
- # e.g. for JSS::Computer, with the RSRC_BASE of :computers,
464
+ # e.g. for Jamf::Computer, with the RSRC_BASE of :computers,
405
465
  # This method retuens the output of the 'JSSResource/computers' resource,
406
466
  # which is a list of all computers in the JSS.
407
467
  #
@@ -420,12 +480,12 @@ module JSS
420
480
  # in the class comments/docs above)
421
481
  #
422
482
  # Subclasses should provide appropriate .all_xxx class methods for accessing
423
- # any other other values as Arrays, e.g. JSS::Computer.all_managed
483
+ # any other other values as Arrays, e.g. Jamf::Computer.all_managed
424
484
  #
425
485
  # -- Caching
426
486
  #
427
487
  # The results of the first call to .all for each subclass is cached in the
428
- # .object_list_cache of the given {JSS::APIConnection} and that cache is
488
+ # .c_object_list_cache of the given {Jamf::Connection} and that cache is
429
489
  # used for all future calls, so as to not requery the server every time.
430
490
  #
431
491
  # To force requerying to get updated data, provided a truthy argument.
@@ -438,60 +498,96 @@ module JSS
438
498
  # -- Alternate API connections
439
499
  #
440
500
  # To query an APIConnection other than the currently active one,
441
- # provide one via the api: named parameter.
501
+ # provide one via the cnx: named parameter.
442
502
  #
443
503
  # @param refresh[Boolean] should the data be re-queried from the API?
444
504
  #
445
- # @param api[JSS::APIConnection] an API connection to use for the query.
446
- # Defaults to the corrently active API. See {JSS::APIConnection}
505
+ # @param cnx [Jamf::Connection] an API connection to use for the query.
506
+ # Defaults to the corrently active API. See {Jamf::Connection}
447
507
  #
448
508
  # @return [Array<Hash{:name=>String, :id=> Integer}>]
449
509
  #
450
- def self.all(refresh = false, api: JSS.api)
510
+ def self.all(refresh = false, api: nil, cnx: Jamf.cnx)
511
+ cnx = api if api
512
+
451
513
  validate_not_metaclass(self)
452
514
 
453
- cache = api.object_list_cache
515
+ cache = cnx.c_object_list_cache
454
516
  cache_key = self::RSRC_LIST_KEY
455
- api.flushcache(cache_key) if refresh
517
+ cnx.flushcache(cache_key) if refresh
456
518
  return cache[cache_key] if cache[cache_key]
457
519
 
458
- cache[cache_key] = api.get_rsrc(self::RSRC_BASE)[cache_key]
520
+ cache[cache_key] = cnx.c_get(self::RSRC_BASE)[cache_key]
459
521
  end
460
522
 
461
523
  # @return [Hash {String => Integer}] name => number of occurances
462
524
  #
463
- def self.duplicate_names(refresh = false, api: JSS.api)
525
+ def self.duplicate_names(refresh = false, api: nil, cnx: Jamf.cnx)
526
+ cnx = api if api
527
+
464
528
  return {} unless defined? self::NON_UNIQUE_NAMES
465
529
 
466
530
  dups = {}
467
- all(refresh, api: api).each do |obj|
531
+ all(refresh, cnx: cnx).each do |obj|
468
532
  if dups[obj[:name]]
469
533
  dups[obj[:name]] += 1
470
534
  else
471
535
  dups[obj[:name]] = 1
472
536
  end # if
473
- end # all(refresh, api: api).each
474
- dups.delete_if { |k,v| v == 1 }
537
+ end # all(refresh, cnx: cnx).each
538
+ dups.delete_if { |_k, v| v == 1 }
475
539
  dups
476
540
  end
477
541
 
542
+ # A Hash of all members of this collection where the keys are some
543
+ # identifier and values are any other attribute.
544
+ #
545
+ # @param ident [Symbol] An identifier of this Class, used as the key
546
+ # for the mapping Hash. Aliases are acceptable, e.g. :sn for :serialNumber
547
+ #
548
+ # @param to [Symbol] The attribute to which the ident will be mapped.
549
+ # Aliases are acceptable, e.g. :name for :displayName
550
+ #
551
+ # @param refresh [Boolean] Re-read the 'all' data from the API? otherwise
552
+ # use the cached data if available.
553
+ #
554
+ # @param cnx (see .all)
555
+ #
556
+ # @return [Hash {Symbol: Object}] A Hash of identifier mapped to attribute
557
+ #
558
+ ######################################
559
+ def self.map_all(ident, to:, cnx: Jamf.cnx, refresh: false, cached_list: nil)
560
+ ident = lookup_keys[ident]
561
+ raise Jamf::InvalidDataError, "No identifier :#{ident} for class #{self}" unless ident
562
+
563
+ list = cached_list || all(refresh, cnx: cnx)
564
+ mapped = list.map do |i|
565
+ [
566
+ i[ident],
567
+ i[to]
568
+ ]
569
+ end # do i
570
+
571
+ mapped.to_h
572
+ end
573
+
478
574
  # Return a hash of all objects of this subclass
479
575
  # in the JSS where the key is the id, and the value
480
- # is some other key in the data items returned by the JSS::APIObject.all.
576
+ # is some other key in the data items returned by the Jamf::APIObject.all.
481
577
  #
482
578
  # If the other key doesn't exist in the API summary data from .all
483
- # (eg :udid for JSS::Department) the values will be nil.
579
+ # (eg :udid for Jamf::Department) the values will be nil.
484
580
  #
485
581
  # Use this method to map ID numbers to other identifiers returned
486
582
  # by the API list resources. Invert its result to map the other
487
583
  # identfier to ids.
488
584
  #
489
585
  # @example
490
- # JSS::Computer.map_all_ids_to(:serial_number)
586
+ # Jamf::Computer.map_all_ids_to(:serial_number)
491
587
  #
492
588
  # # Returns, eg {2 => "C02YD3U8JHD3", 5 => "VMMz7xgg8lYZ"}
493
589
  #
494
- # JSS::Computer.map_all_ids_to(:serial_number).invert
590
+ # Jamf::Computer.map_all_ids_to(:serial_number).invert
495
591
  #
496
592
  # # Returns, eg {"C02YD3U8JHD3" => 2, "VMMz7xgg8lYZ" => 5}
497
593
  #
@@ -511,29 +607,33 @@ module JSS
511
607
  #
512
608
  # @param refresh[Boolean] should the data re-queried from the API?
513
609
  #
514
- # @param api[JSS::APIConnection] an API connection to use for the query.
515
- # Defaults to the corrently active API. See {JSS::APIConnection}
610
+ # @param cnx [Jamf::Connection] an API connection to use for the query.
611
+ # Defaults to the corrently active API. See {Jamf::Connection}
516
612
  #
517
613
  # @return [Hash{Integer => Oject}] the associated ids and data
518
614
  #
519
- def self.map_all_ids_to(other_key, refresh = false, api: JSS.api)
520
- # we will accept any key, it'll just return nil if not in the
521
- # .all hashes. However if we're given an alias of a lookup key
522
- # we need to convert it to its real name.
523
- other_key = lookup_keys[other_key] if lookup_keys[other_key]
524
-
525
- cache_key = "#{self::RSRC_LIST_KEY}_map_#{other_key}".to_sym
526
- cache = api.object_list_cache
527
- cache[cache_key] = nil if refresh
528
- return cache[cache_key] if cache[cache_key]
529
-
530
- map = {}
531
- all(refresh, api: api).each { |i| map[i[:id]] = i[other_key] }
532
- cache[cache_key] = map
615
+ def self.map_all_ids_to(other_key, refresh = false, cached_list: nil, api: nil, cnx: Jamf.cnx)
616
+ cnx = api if api
617
+
618
+ map_all :id, to: other_key, refresh: refresh, cnx: cnx, cached_list: cached_list
619
+
620
+ # # we will accept any key, it'll just return nil if not in the
621
+ # # .all hashes. However if we're given an alias of a lookup key
622
+ # # we need to convert it to its real name.
623
+ # other_key = lookup_keys[other_key] if lookup_keys[other_key]
624
+ #
625
+ # cache_key = "#{self::RSRC_LIST_KEY}_map_#{other_key}".to_sym
626
+ # cache = cnx.c_object_list_cache
627
+ # cache[cache_key] = nil if refresh
628
+ # return cache[cache_key] if cache[cache_key]
629
+ #
630
+ # map = {}
631
+ # all(refresh, cnx: cnx).each { |i| map[i[:id]] = i[other_key] }
632
+ # cache[cache_key] = map
533
633
  end
534
634
 
535
- # Return an Array of JSS::APIObject subclass instances
536
- # e.g when called on JSS::Package, return a hash of JSS::Package instancesa
635
+ # Return an Array of Jamf::APIObject subclass instances
636
+ # e.g when called on Jamf::Package, return a hash of Jamf::Package instancesa
537
637
  # for every package in the JSS.
538
638
  #
539
639
  # WARNING: This may be slow as it has to look up each object individually!
@@ -541,24 +641,26 @@ module JSS
541
641
  #
542
642
  # @param refresh[Boolean] should the data re-queried from the API?
543
643
  #
544
- # @param api[JSS::APIConnection] an API connection to use for the query.
545
- # Defaults to the corrently active API. See {JSS::APIConnection}
644
+ # @param cnx [Jamf::Connection] an API connection to use for the query.
645
+ # Defaults to the corrently active API. See {Jamf::Connection}
546
646
  #
547
647
  # @return [Array<APIObject>] the objects requested
548
648
  #
549
- def self.all_objects(refresh = false, api: JSS.api)
649
+ def self.all_objects(refresh = false, api: nil, cnx: Jamf.cnx)
650
+ cnx = api if api
651
+
550
652
  objects_cache_key ||= "#{self::RSRC_LIST_KEY}_objects".to_sym
551
- api_cache = api.object_list_cache
653
+ api_cache = cnx.c_object_list_cache
552
654
  api_cache[objects_cache_key] = nil if refresh
553
655
 
554
656
  return api_cache[objects_cache_key] if api_cache[objects_cache_key]
555
- all = all(refresh, api: api)
556
- api_cache[objects_cache_key] = all.map do |o|
557
- fetch id: o[:id], api: api, refresh: false
657
+
658
+ all_result = all(refresh, cnx: cnx)
659
+ api_cache[objects_cache_key] = all_result.map do |o|
660
+ fetch id: o[:id], cnx: cnx, refresh: false
558
661
  end
559
662
  end
560
663
 
561
-
562
664
  # Return the id of the object of this subclass with the given identifier.
563
665
  #
564
666
  # Return nil if no object has an identifier that matches.
@@ -576,24 +678,25 @@ module JSS
576
678
  #
577
679
  # @param refresh [Boolean] Should the data be re-read from the server
578
680
  #
579
- # @param api[JSS::APIConnection] an API connection to use for the query.
580
- # Defaults to the corrently active API. See {JSS::APIConnection}
681
+ # @param cnx [Jamf::Connection] an API connection to use for the query.
682
+ # Defaults to the corrently active API. See {Jamf::Connection}
581
683
  #
582
684
  # @return [Integer, nil] the id of the matching object, or nil if it doesn't exist
583
685
  #
584
- def self.valid_id(identifier, refresh = false, api: JSS.api)
686
+ def self.valid_id(identifier, refresh = false, api: nil, cnx: Jamf.cnx)
687
+ cnx = api if api
585
688
 
586
689
  # refresh if needed
587
- all(refresh, api: api) if refresh
690
+ all(refresh, cnx: cnx) if refresh
588
691
 
589
692
  # it its a valid id, return it
590
- return identifier if all_ids(api: api).include? identifier
693
+ return identifier if all_ids(cnx: cnx).include? identifier
591
694
 
592
695
  keys_to_check = lookup_keys(no_aliases: true)
593
696
  keys_to_check.delete :id # we've already checked :id
594
697
 
595
698
  keys_to_check.each do |key|
596
- mapped_ids = map_all_ids_to key, api: api
699
+ mapped_ids = map_all_ids_to key, cnx: cnx
597
700
  matches = mapped_ids.select { |_id, ident| ident.casecmp? identifier }
598
701
  # If exactly one match, return the id
599
702
  return matches.keys.first if matches.size == 1
@@ -609,11 +712,11 @@ module JSS
609
712
  #
610
713
  # @example
611
714
  # # get the id for the computer with serialnum 'xyxyxyxy'
612
- # JSS::Computer.id_for_identifier :serial_number, 'xyxyxyxy'
715
+ # Jamf::Computer.id_for_identifier :serial_number, 'xyxyxyxy'
613
716
  #
614
717
  # # => the Integer id, or nil if no such serial number
615
718
  #
616
- # Raises a JSS::Ambiguous error if there's more than one matching value
719
+ # Raises a Jamf::Ambiguous error if there's more than one matching value
617
720
  # for any key, which might be true of names for Computers and Devices
618
721
  #
619
722
  # This is similar to .valid_id, except only one key is searched
@@ -627,25 +730,27 @@ module JSS
627
730
  # @param refresh [Boolean] Should the cached summary data be re-read from
628
731
  # the server first?
629
732
  #
630
- # @param api[JSS::APIConnection] an API connection to use for the query.
631
- # Defaults to the corrently active API. See {JSS::APIConnection}
733
+ # @param cnx [Jamf::Connection] an API connection to use for the query.
734
+ # Defaults to the corrently active API. See {Jamf::Connection}
632
735
  #
633
736
  # @return [Integer, nil] the id of the matching object, or nil if it
634
737
  # doesn't exist
635
738
  #
636
- def self.id_for_identifier(key, val, refresh = false, api: JSS.api)
739
+ def self.id_for_identifier(key, val, refresh = false, api: nil, cnx: Jamf.cnx)
740
+ cnx = api if api
741
+
637
742
  # refresh if needed
638
- all(refresh, api: api) if refresh
743
+ all(refresh, cnx: cnx) if refresh
639
744
 
640
745
  # get the real key if an alias was used
641
746
  key = real_lookup_key key
642
747
 
643
748
  # do id's expicitly, they are integers
644
- return all_ids.include?(val) ? val : nil if key == :id
749
+ return all_ids(cnx: cnx).include?(val) ? val : nil if key == :id
645
750
 
646
- mapped_ids = map_all_ids_to key, api: api
751
+ mapped_ids = map_all_ids_to key, cnx: cnx
647
752
  matches = mapped_ids.select { |_id, map_val| val.casecmp? map_val }
648
- raise JSS::AmbiguousError, "Key #{key}: value '#{val}' is not unique for #{self}" if matches.size > 1
753
+ raise Jamf::AmbiguousError, "Key #{key}: value '#{val}' is not unique for #{self}" if matches.size > 1
649
754
 
650
755
  return nil if matches.size.zero?
651
756
 
@@ -660,13 +765,15 @@ module JSS
660
765
  #
661
766
  # @param refresh [Boolean] Should the data be re-read from the server
662
767
  #
663
- # @param api[JSS::APIConnection] an API connection to use for the query.
664
- # Defaults to the corrently active API. See {JSS::APIConnection}
768
+ # @param cnx [Jamf::Connection] an API connection to use for the query.
769
+ # Defaults to the corrently active API. See {Jamf::Connection}
665
770
  #
666
771
  # @return [Boolean] does an object with the given identifier exist?
667
772
  #
668
- def self.exist?(identifier, refresh = false, api: JSS.api)
669
- !valid_id(identifier, refresh, api: api).nil?
773
+ def self.exist?(identifier, refresh = false, api: nil, cnx: Jamf.cnx)
774
+ cnx = api if api
775
+
776
+ !valid_id(identifier, refresh, cnx: cnx).nil?
670
777
  end
671
778
 
672
779
  # Convert an Array of Hashes of API object data to a
@@ -679,9 +786,9 @@ module JSS
679
786
  # with one <class> element per Hash member.
680
787
  #
681
788
  # @example
682
- # # for class JSS::Computer
789
+ # # for class Jamf::Computer
683
790
  # some_comps = [{:id=>2, :name=>"kimchi"},{:id=>5, :name=>"mantis"}]
684
- # xml_names = JSS::Computer.xml_list some_comps
791
+ # xml_names = Jamf::Computer.xml_list some_comps
685
792
  # puts xml_names # output manually formatted for clarity, xml.to_s has no newlines between elements
686
793
  #
687
794
  # <computers>
@@ -693,7 +800,7 @@ module JSS
693
800
  # </computer>
694
801
  # </computers>
695
802
  #
696
- # xml_ids = JSS::Computer.xml_list some_comps, :id
803
+ # xml_ids = Jamf::Computer.xml_list some_comps, :id
697
804
  # puts xml_names # output manually formatted for clarity, xml.to_s has no newlines between elements
698
805
  #
699
806
  # <computers>
@@ -756,10 +863,10 @@ module JSS
756
863
  #
757
864
  # @example
758
865
  # # computer where 'xyxyxyxy' is in any of the lookup key fields
759
- # JSS::Computer.fetch 'xyxyxyxy'
866
+ # Jamf::Computer.fetch 'xyxyxyxy'
760
867
  #
761
868
  # # computer where 'xyxyxyxy' is the serial number
762
- # JSS::Computer.fetch serial_number: 'xyxyxyxy'
869
+ # Jamf::Computer.fetch serial_number: 'xyxyxyxy'
763
870
  #
764
871
  # Fetching is faster when specifying a lookup key, and that key has a
765
872
  # fetch_rsrc_key defined in its OTHER_LOOKUP_KEYS constant, as in the second
@@ -785,8 +892,8 @@ module JSS
785
892
  # If no searchterm is provided, one of the args must be a valid
786
893
  # lookup key and value to find in that key, e.g. `serial_number: '1234567'`
787
894
  #
788
- # @option args api[JSS::APIConnection] an API connection to use for the query.
789
- # Defaults to the corrently active API. See {JSS::APIConnection}
895
+ # @option args cnx[Jamf::Connection] an API connection to use for the query.
896
+ # Defaults to the corrently active API. See {Jamf::Connection}
790
897
  #
791
898
  # @option args refresh[Boolean] should the summary list of all objects be
792
899
  # reloaded from the API before being used to look for this object.
@@ -797,35 +904,34 @@ module JSS
797
904
  validate_not_metaclass(self)
798
905
 
799
906
  # which connection?
800
- api = args.delete :api
801
- api ||= JSS.api
907
+ cnx = args.delete :cnx
908
+ cnx ||= args.delete :api
909
+ cnx ||= Jamf.cnx
802
910
 
803
911
  # refresh the .all list if needed
804
912
  if args.delete(:refresh) || searchterm == :random
805
- all(:refresh, api: api)
913
+ all(:refresh, cnx: cnx)
806
914
  just_refreshed = true
807
915
  else
808
916
  just_refreshed = false
809
917
  end
810
918
 
811
919
  # a random object?
812
- if searchterm == :random
813
- rnd_thing = all.sample
814
- raise JSS::NoSuchItemError, "No #{self::RSRC_LIST_KEY} found" unless rnd_thing
920
+ if searchterm == :random || args[:random]
921
+ rnd_thing = all(cnx: cnx).sample
922
+ raise Jamf::NoSuchItemError, "No #{self::RSRC_LIST_KEY} found" unless rnd_thing
815
923
 
816
- return new id: rnd_thing[:id], api: api
924
+ return new id: rnd_thing[:id], cnx: cnx
817
925
  end
818
926
 
819
927
  # get the lookup key and value, if given
820
928
  fetch_key, fetch_val = args.to_a.first
821
929
  fetch_rsrc_key = fetch_rsrc_key(fetch_key)
822
930
 
823
- err_detail = "where #{fetch_key} = #{fetch_val}"
824
-
825
931
  # names should raise an error if more than one exists,
826
932
  # so we always have to do id_for_identifier, which will do so.
827
933
  if fetch_rsrc_key == :name
828
- id = id_for_identifier fetch_key, fetch_val, !just_refreshed, api: api
934
+ id = id_for_identifier fetch_key, fetch_val, !just_refreshed, cnx: cnx
829
935
  fetch_rsrc = id ? "#{self::RSRC_BASE}/name/#{CGI.escape fetch_val.to_s}" : nil
830
936
 
831
937
  # if the fetch rsrc key exists, it can be used directly in an endpoint path
@@ -836,20 +942,19 @@ module JSS
836
942
  # it has an OTHER_LOOKUP_KEY but that key doesn't have a fetch_rsrc
837
943
  # so we look in the .map_all_ids_to_* hash for it.
838
944
  elsif fetch_key
839
- id = id_for_identifier fetch_key, fetch_val, !just_refreshed, api: api
945
+ id = id_for_identifier fetch_key, fetch_val, !just_refreshed, cnx: cnx
840
946
  fetch_rsrc = id ? "#{self::RSRC_BASE}/id/#{id}" : nil
841
947
 
842
948
  # no fetch key was given in the args, so try a search term
843
949
  elsif searchterm
844
- id = valid_id searchterm, api: api
950
+ id = valid_id searchterm, cnx: cnx
845
951
  fetch_rsrc = id ? "#{self::RSRC_BASE}/id/#{id}" : nil
846
- err_detail = "matching #{searchterm}"
847
952
 
848
953
  else
849
954
  raise ArgumentError, 'Missing searchterm or fetch key'
850
955
  end
851
956
 
852
- new fetch_rsrc: fetch_rsrc, api: api
957
+ new fetch_rsrc: fetch_rsrc, cnx: cnx
853
958
  end # fetch
854
959
 
855
960
  # Fetch the mostly- or fully-raw JSON or XML data for an object of this
@@ -869,7 +974,7 @@ module JSS
869
974
  # all the ruby goodness of a full instance, but just want a few values for
870
975
  # an object that aren't available in the `all` data
871
976
  #
872
- # This is really just a wrapper around {APIConnection.get_rsrc} that
977
+ # This is really just a wrapper around {APIConnection.c_get} that
873
978
  # automatically fills in the RSRC::BASE value for you.
874
979
  #
875
980
  # @param id [Integer] the id of the object to fetch
@@ -879,18 +984,20 @@ module JSS
879
984
  # @param as_string[Boolean] return the raw JSON or XML string as it comes
880
985
  # from the API, do not parse into a Hash or REXML::Document
881
986
  #
882
- # @param api[JSS::APIConnection] the connection thru which to fetch this
883
- # object. Defaults to the deault API connection in JSS.api
987
+ # @param cnx [Jamf::Connection] the connection thru which to fetch this
988
+ # object. Defaults to the deault API connection in Jamf.cnx
884
989
  #
885
990
  # @return [Hash, REXML::Document, String] the raw data for the object
886
991
  #
887
- def self.get_raw(id, format: :json, as_string: false, api: JSS.api)
992
+ def self.get_raw(id, format: :json, as_string: false, api: nil, cnx: Jamf.cnx)
993
+ cnx = api if api
994
+
888
995
  validate_not_metaclass(self)
889
996
  rsrc = "#{self::RSRC_BASE}/id/#{id}"
890
- data = api.get_rsrc rsrc, format, raw_json: as_string
997
+ data = cnx.c_get rsrc, format, raw_json: as_string
891
998
  return data if format == :json || as_string
892
999
 
893
- REXML::Document.new(data)
1000
+ REXML::Document.new(**data)
894
1001
  end
895
1002
 
896
1003
  # PUT some raw XML to the API for a given id in this subclass.
@@ -903,22 +1010,24 @@ module JSS
903
1010
  # In some cases, where you're making simple changes to simple XML,
904
1011
  # this can be faster than fetching a full instance and the re-saving it.
905
1012
  #
906
- # This is really just a wrapper around {APIConnection.put_rsrc} that
1013
+ # This is really just a wrapper around {APIConnection.c_put} that
907
1014
  # automatically fills in the RSRC::BASE value for you.
908
1015
  #
909
1016
  # @param id [Integer] the id of the object to PUT
910
1017
  #
911
1018
  # @param xml [String, #to_s] The XML to send
912
1019
  #
913
- # @param api[JSS::APIConnection] the connection thru which to fetch this
914
- # object. Defaults to the deault API connection in JSS.api
1020
+ # @param cnx [Jamf::Connection] the connection thru which to fetch this
1021
+ # object. Defaults to the deault API connection in Jamf.cnx
915
1022
  #
916
1023
  # @return [REXML::Document] the XML response from the API
917
1024
  #
918
- def self.put_raw(id, xml, api: JSS.api)
1025
+ def self.put_raw(id, xml, api: nil, cnx: Jamf.cnx)
1026
+ cnx = api if api
1027
+
919
1028
  validate_not_metaclass(self)
920
1029
  rsrc = "#{self::RSRC_BASE}/id/#{id}"
921
- REXML::Document.new(api.put_rsrc rsrc, xml.to_s)
1030
+ REXML::Document.new(cnx.c_put(rsrc, xml.to_s))
922
1031
  end
923
1032
 
924
1033
  # POST some raw XML to the API for a given id in this subclass.
@@ -931,20 +1040,22 @@ module JSS
931
1040
  # This probably isn't as much of a speed gain as get_raw or put_raw, as
932
1041
  # opposed to instantiating a ruby object, but might still be useful.
933
1042
  #
934
- # This is really just a wrapper around {APIConnection.post_rsrc} that
1043
+ # This is really just a wrapper around {APIConnection.c_post} that
935
1044
  # automatically fills in the RSRC::BASE value for you.
936
1045
  #
937
1046
  # @param xml [String, #to_s] The XML to send
938
1047
  #
939
- # @param api[JSS::APIConnection] the connection thru which to fetch this
940
- # object. Defaults to the deault API connection in JSS.api
1048
+ # @param cnx [Jamf::Connection] the connection thru which to fetch this
1049
+ # object. Defaults to the deault API connection in Jamf.cnx
941
1050
  #
942
1051
  # @return [REXML::Document] the XML response from the API
943
1052
  #
944
- def self.post_raw( xml, api: JSS.api)
1053
+ def self.post_raw(xml, api: nil, cnx: Jamf.cnx)
1054
+ cnx = api if api
1055
+
945
1056
  validate_not_metaclass(self)
946
1057
  rsrc = "#{self::RSRC_BASE}/id/-1"
947
- REXML::Document.new(api.post_rsrc rsrc, xml.to_s)
1058
+ REXML::Document.new(cnx.c_post(rsrc, xml.to_s))
948
1059
  end
949
1060
 
950
1061
  # Make a ruby instance of a not-yet-existing APIObject.
@@ -959,24 +1070,30 @@ module JSS
959
1070
  #
960
1071
  # @param name[String] The name of this object, generally must be uniqie
961
1072
  #
962
- # @param api[JSS::APIConnection] the connection thru which to make this
963
- # object. Defaults to the deault API connection in JSS.api
1073
+ # @param cnx [Jamf::Connection] the connection thru which to make this
1074
+ # object. Defaults to the deault API connection in Jamf.cnx
964
1075
  #
965
1076
  # @param args[Hash] The data for creating an object, such as name:
966
1077
  # See {APIObject#initialize}
967
1078
  #
968
1079
  # @return [APIObject] The un-created ruby-instance of a JSS object
969
1080
  #
970
- def self.make(**args)
1081
+ def self.create(**args)
971
1082
  validate_not_metaclass(self)
972
1083
  unless constants.include?(:CREATABLE)
973
- raise JSS::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows."
1084
+ raise Jamf::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows."
974
1085
  end
975
1086
  raise ArgumentError, "Use '#{self.class}.fetch id: xx' to retrieve existing JSS objects" if args[:id]
976
1087
 
977
- args[:api] ||= JSS.api
1088
+ args[:api] ||= Jamf.cnx
978
1089
  args[:id] = :new
979
- new args
1090
+ new(**args)
1091
+ end
1092
+
1093
+ # backward compatability
1094
+ # @deprecated use .create instead
1095
+ def self.make(**args)
1096
+ create(**args)
980
1097
  end
981
1098
 
982
1099
  # Disallow direct use of ruby's .new class method for creating instances.
@@ -985,9 +1102,7 @@ module JSS
985
1102
  validate_not_metaclass(self)
986
1103
 
987
1104
  calling_method = caller_locations(1..1).first.label
988
- unless OK_INSTANTIATORS.include? calling_method
989
- raise JSS::UnsupportedError, 'Use .fetch or .make to instantiate APIObject classes'
990
- end
1105
+ raise Jamf::UnsupportedError, 'Use .fetch or .create to instantiate APIObject classes' unless OK_INSTANTIATORS.include? calling_method
991
1106
 
992
1107
  super
993
1108
  end
@@ -1000,16 +1115,18 @@ module JSS
1000
1115
  # @param victims[Integer,Array<Integer>] An object id or an array of them
1001
1116
  # to be deleted
1002
1117
  #
1003
- # @param api[JSS::APIConnection] the API connection to use.
1004
- # Defaults to the corrently active API. See {JSS::APIConnection}
1118
+ # @param cnx [Jamf::Connection] the API connection to use.
1119
+ # Defaults to the corrently active API. See {Jamf::Connection}
1005
1120
  #
1006
1121
  # @return [Array<Integer>] The id's that didn't exist when we tried to
1007
1122
  # delete them.
1008
1123
  #
1009
- def self.delete(victims, refresh = true, api: JSS.api)
1124
+ def self.delete(victims, refresh = true, api: nil, cnx: Jamf.cnx)
1125
+ cnx = api if api
1126
+
1010
1127
  validate_not_metaclass(self)
1011
1128
 
1012
- raise JSS::InvalidDataError, 'Parameter must be an Integer ID or an Array of them' unless victims.is_a?(Integer) || victims.is_a?(Array)
1129
+ raise Jamf::InvalidDataError, 'Parameter must be an Integer ID or an Array of them' unless victims.is_a?(Integer) || victims.is_a?(Array)
1013
1130
 
1014
1131
  case victims
1015
1132
  when Integer
@@ -1019,10 +1136,10 @@ module JSS
1019
1136
  end
1020
1137
 
1021
1138
  skipped = []
1022
- current_ids = all_ids refresh, api: api
1139
+ current_ids = all_ids refresh, cnx: cnx
1023
1140
  victims.each do |vid|
1024
1141
  if current_ids.include? vid
1025
- api.delete_rsrc "#{self::RSRC_BASE}/id/#{vid}"
1142
+ cnx.c_delete "#{self::RSRC_BASE}/id/#{vid}"
1026
1143
  else
1027
1144
  skipped << vid
1028
1145
  end # if current_ids include vid
@@ -1030,23 +1147,25 @@ module JSS
1030
1147
 
1031
1148
  # clear any cached all-lists or id-maps for this class
1032
1149
  # so they'll re-cache as needed
1033
- api.flushcache self::RSRC_LIST_KEY
1034
- # all :refresh, api: api
1150
+ cnx.flushcache self::RSRC_LIST_KEY
1151
+ # all :refresh, cnx: cnx
1035
1152
 
1036
1153
  skipped
1037
1154
  end # self.delete
1038
1155
 
1039
1156
  # Can't use APIObject directly.
1040
1157
  def self.validate_not_metaclass(klass)
1041
- raise JSS::UnsupportedError, 'JSS::APIObject is a metaclass. Do not use it directly' if klass == JSS::APIObject
1158
+ raise Jamf::UnsupportedError, 'Jamf::APIObject is a metaclass. Do not use it directly' if klass == Jamf::APIObject
1042
1159
  end
1043
1160
 
1044
1161
  # Attributes
1045
1162
  #####################################
1046
1163
 
1047
- # @return [JSS::APIConnection] the API connection thru which we deal with
1164
+ # @return [Jamf::Connection] the API connection thru which we deal with
1048
1165
  # this object.
1049
- attr_reader :api
1166
+ attr_reader :cnx
1167
+ # @deprecated 'api' to refer to connection objects will be removed eventually
1168
+ alias api cnx
1050
1169
 
1051
1170
  # @return the parsed JSON data retrieved from the API when this object was
1052
1171
  # fetched
@@ -1074,9 +1193,9 @@ module JSS
1074
1193
 
1075
1194
  # The args hash must include :id, :name, or :data.
1076
1195
  # * :id or :name will be looked up via the API
1077
- # * * if the subclass includes JSS::Creatable, :id can be :new, to create a new object in the JSS.
1196
+ # * * if the subclass includes Jamf::Creatable, :id can be :new, to create a new object in the JSS.
1078
1197
  # and :name is required
1079
- # * :data must be the JSON output of a separate {JSS::APIConnection} query (a Hash of valid object data)
1198
+ # * :data must be the JSON output of a separate {Jamf::Connection} query (a Hash of valid object data)
1080
1199
  #
1081
1200
  # Some subclasses can accept other options, by pasing their keys in a final Array
1082
1201
  #
@@ -1091,8 +1210,9 @@ module JSS
1091
1210
  #
1092
1211
  #
1093
1212
  def initialize(**args)
1094
- @api = args[:api]
1095
- @api ||= JSS.api
1213
+ @cnx = args[:cnx]
1214
+ @cnx ||= args[:api]
1215
+ @cnx ||= Jamf.cnx
1096
1216
 
1097
1217
  # we're making a new one in the JSS
1098
1218
  if args[:id] == :new
@@ -1112,6 +1232,18 @@ module JSS
1112
1232
  # Public Instance Methods
1113
1233
  #####################################
1114
1234
 
1235
+ # Ruby 3's default behavior when raising exceptions will include the output
1236
+ # of #inspect, recursively for all data in an object.
1237
+ # For many OAPIObjects, esp JPAPI Resources, this includes the embedded
1238
+ # Connection object and all the caches is might hold, which might be
1239
+ # thousands of lines.
1240
+ # we override that here to prevent that. I've heard rumor this will be
1241
+ # fixed in ruby 3.2
1242
+ # def inspect
1243
+ # #<Jamf::Policy:0x0000000110138df8
1244
+ # "<#{self.class}:#{object_id}>"
1245
+ # end
1246
+
1115
1247
  # Either Create or Update this object in the JSS
1116
1248
  #
1117
1249
  # If this item is creatable or updatable, then
@@ -1121,83 +1253,93 @@ module JSS
1121
1253
  #
1122
1254
  def save
1123
1255
  if @in_jss
1124
- raise JSS::UnsupportedError, 'Updating this object in the JSS is currently not supported by ruby-jss' unless updatable?
1125
-
1126
1256
  update
1127
1257
  else
1128
- raise JSS::UnsupportedError, 'Creating this object in the JSS is currently not supported by ruby-jss' unless creatable?
1129
-
1130
1258
  create
1131
1259
  end
1132
1260
  end
1133
1261
 
1262
+ # @deprecated, use #save
1263
+ def create
1264
+ raise Jamf::UnsupportedError, 'Creating this object in the JSS is currently not supported by ruby-jss' unless creatable?
1265
+
1266
+ create_in_jamf
1267
+ end
1268
+
1269
+ # @deprecated, use #save
1270
+ def update
1271
+ raise Jamf::UnsupportedError, 'Updating this object in the JSS is currently not supported by ruby-jss' unless updatable?
1272
+
1273
+ update_in_jamf
1274
+ end
1275
+
1134
1276
  # Mix-in Modules.
1135
1277
  # Each module made for mixing in to APIObject subclasses
1136
1278
  # sets an appropriate constant to true.
1137
1279
  # These methods provide a simple way to programattically determine
1138
1280
  # if an object has one of the mixed-in modules available.
1139
1281
 
1140
- # @return [Boolean] See {JSS::Creatable}
1282
+ # @return [Boolean] See {Jamf::Creatable}
1141
1283
  def creatable?
1142
1284
  defined? self.class::CREATABLE
1143
1285
  end
1144
1286
 
1145
- # @return [Boolean] See {JSS::Updatable}
1287
+ # @return [Boolean] See {Jamf::Updatable}
1146
1288
  def updatable?
1147
1289
  defined? self.class::UPDATABLE
1148
1290
  end
1149
1291
 
1150
- # @return [Boolean] See {JSS::Categorizable}
1292
+ # @return [Boolean] See {Jamf::Categorizable}
1151
1293
  def categorizable?
1152
1294
  defined? self.class::CATEGORIZABLE
1153
1295
  end
1154
1296
 
1155
- # @return [Boolean] See {JSS::VPPable}
1297
+ # @return [Boolean] See {Jamf::VPPable}
1156
1298
  def vppable?
1157
1299
  defined? self.class::VPPABLE
1158
1300
  end
1159
1301
 
1160
- # @return [Boolean] See {JSS::SelfServable}
1302
+ # @return [Boolean] See {Jamf::SelfServable}
1161
1303
  def self_servable?
1162
1304
  defined? self.class::SELF_SERVABLE
1163
1305
  end
1164
1306
 
1165
- # @return [Boolean] See {JSS::Criteriable}
1307
+ # @return [Boolean] See {Jamf::Criteriable}
1166
1308
  def criterable?
1167
1309
  defined? self.class::CRITERIABLE
1168
1310
  end
1169
1311
 
1170
- # @return [Boolean] See {JSS::Sitable}
1312
+ # @return [Boolean] See {Jamf::Sitable}
1171
1313
  def sitable?
1172
1314
  defined? self.class::SITABLE
1173
1315
  end
1174
1316
 
1175
- # @return [Boolean] See {JSS::extendable}
1317
+ # @return [Boolean] See {Jamf::extendable}
1176
1318
  def extendable?
1177
1319
  defined? self.class::EXTENDABLE
1178
1320
  end
1179
1321
 
1180
- # @return [Boolean] See {JSS::Matchable}
1322
+ # @return [Boolean] See {Jamf::Matchable}
1181
1323
  def matchable?
1182
1324
  defined? self.class::MATCHABLE
1183
1325
  end
1184
1326
 
1185
- # @return [Boolean] See {JSS::Locatable}
1327
+ # @return [Boolean] See {Jamf::Locatable}
1186
1328
  def locatable?
1187
1329
  defined? self.class::LOCATABLE
1188
1330
  end
1189
1331
 
1190
- # @return [Boolean] See {JSS::Purchasable}
1332
+ # @return [Boolean] See {Jamf::Purchasable}
1191
1333
  def purchasable?
1192
1334
  defined? self.class::PURCHASABLE
1193
1335
  end
1194
1336
 
1195
- # @return [Boolean] See {JSS::Scopable}
1337
+ # @return [Boolean] See {Jamf::Scopable}
1196
1338
  def scopable?
1197
1339
  defined? self.class::SCOPABLE
1198
1340
  end
1199
1341
 
1200
- # @return [Boolean] See {JSS::Uploadable}
1342
+ # @return [Boolean] See {Jamf::Uploadable}
1201
1343
  def uploadable?
1202
1344
  defined? self.class::UPLOADABLE
1203
1345
  end
@@ -1216,7 +1358,7 @@ module JSS
1216
1358
  def delete
1217
1359
  return unless @in_jss
1218
1360
 
1219
- @api.delete_rsrc @rest_rsrc
1361
+ @cnx.c_delete @rest_rsrc
1220
1362
 
1221
1363
  @rest_rsrc = "#{self.class::RSRC_BASE}/name/#{CGI.escape @name.to_s}"
1222
1364
  @id = nil
@@ -1225,8 +1367,8 @@ module JSS
1225
1367
 
1226
1368
  # clear any cached all-lists or id-maps for this class
1227
1369
  # so they'll re-cache as needed
1228
- @api.flushcache self.class::RSRC_LIST_KEY
1229
- # self.class.all :refresh, api: @api
1370
+ @cnx.flushcache self.class::RSRC_LIST_KEY
1371
+ # self.class.all :refresh, cnx: @cnx
1230
1372
 
1231
1373
  :deleted
1232
1374
  end # delete
@@ -1236,7 +1378,7 @@ module JSS
1236
1378
  # @return [String]
1237
1379
  #
1238
1380
  def to_s
1239
- "#{self.class}, name: #{@name}, id: #{@id}"
1381
+ "#{self.class}@#{cnx.host}, id: #{@id}"
1240
1382
  end
1241
1383
 
1242
1384
  # Remove the init_data and api object from
@@ -1247,7 +1389,7 @@ module JSS
1247
1389
  #
1248
1390
  def pretty_print_instance_variables
1249
1391
  vars = instance_variables.sort
1250
- vars.delete :@api
1392
+ vars.delete :@cnx
1251
1393
  vars.delete :@init_data
1252
1394
  vars.delete :@main_subset
1253
1395
  vars
@@ -1259,7 +1401,7 @@ module JSS
1259
1401
  # object type in the OBJECT_HISTORY_TABLE in the database
1260
1402
  # (e.g. for computers, the object type is 1)
1261
1403
  #
1262
- # NOTE: Object history is not available via the API,
1404
+ # NOTE: Object history is not available via the Classic API,
1263
1405
  # so access is only available through direct MySQL
1264
1406
  # connections
1265
1407
  #
@@ -1281,9 +1423,9 @@ module JSS
1281
1423
  def add_object_history_entry(user: nil, notes: nil, details: nil)
1282
1424
  validate_object_history_available
1283
1425
 
1284
- raise JSS::MissingDataError, 'A user: must be provided to make the entry' unless user
1426
+ raise Jamf::MissingDataError, 'A user: must be provided to make the entry' unless user
1285
1427
 
1286
- raise JSS::MissingDataError, 'Either notes: must be provided to make the entry' unless notes
1428
+ raise Jamf::MissingDataError, 'notes: must be provided to make the entry' unless notes
1287
1429
 
1288
1430
  user = "'#{Mysql.quote user.to_s}'"
1289
1431
  notes = "'#{Mysql.quote notes.to_s}'"
@@ -1302,7 +1444,7 @@ module JSS
1302
1444
  VALUES
1303
1445
  (#{value_list})"
1304
1446
 
1305
- JSS::DB_CNX.db.query q
1447
+ Jamf::DB_CNX.db.query q
1306
1448
  end
1307
1449
 
1308
1450
  # the object history for this object, an array of hashes
@@ -1324,7 +1466,7 @@ module JSS
1324
1466
  AND object_id = #{@id}
1325
1467
  ORDER BY object_history_id ASC"
1326
1468
 
1327
- result = JSS::DB_CNX.db.query q
1469
+ result = Jamf::DB_CNX.db.query q
1328
1470
  history = []
1329
1471
  result.each do |entry|
1330
1472
  history << {
@@ -1362,14 +1504,16 @@ module JSS
1362
1504
  # @return [void]
1363
1505
  #
1364
1506
  def validate_object_history_available
1365
- raise JSS::NoSuchItemError, 'Object not yet created' unless @id && @in_jss
1507
+ raise Jamf::NoSuchItemError, 'Object not yet created' unless @id && @in_jss
1366
1508
 
1367
- raise JSS::InvalidConnectionError, 'Not connected to MySQL' unless JSS::DB_CNX.connected?
1509
+ raise Jamf::InvalidConnectionError, 'Not connected to MySQL' unless Jamf::DB_CNX.connected?
1368
1510
 
1369
- raise JSS::UnsupportedError, "Object History access is not supported for #{self.class} objects at this time" unless defined? self.class::OBJECT_HISTORY_OBJECT_TYPE
1511
+ unless defined? self.class::OBJECT_HISTORY_OBJECT_TYPE
1512
+ raise Jamf::UnsupportedError,
1513
+ "Object History access is not supported for #{self.class} objects at this time"
1514
+ end
1370
1515
  end
1371
1516
 
1372
-
1373
1517
  # If we're making a new object in the JSS, make sure we were given
1374
1518
  # valid data to do so, raise exceptions otherwise.
1375
1519
  #
@@ -1382,16 +1526,15 @@ module JSS
1382
1526
  # @return [void]
1383
1527
  #
1384
1528
  def validate_init_for_creation(args)
1385
- raise JSS::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows." unless creatable?
1529
+ raise Jamf::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows." unless creatable?
1386
1530
 
1387
- raise JSS::MissingDataError, "You must provide a :name to create a #{self.class::RSRC_OBJECT_KEY}." unless args[:name]
1531
+ raise Jamf::MissingDataError, "You must provide a :name to create a #{self.class::RSRC_OBJECT_KEY}." unless args[:name]
1388
1532
 
1389
1533
  return if defined? self.class::NON_UNIQUE_NAMES
1390
1534
 
1391
- matches = self.class.all_names(:refresh, api: @api).select { |n| n.casecmp? args[:name] }
1392
-
1393
- raise JSS::AlreadyExistsError, "A #{self.class::RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" unless matches.empty?
1535
+ matches = self.class.all_names(:refresh, cnx: @cnx).select { |n| n.casecmp? args[:name] }
1394
1536
 
1537
+ raise Jamf::AlreadyExistsError, "A #{self.class::RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" unless matches.empty?
1395
1538
  end
1396
1539
 
1397
1540
  # Given initialization args, perform an API lookup for an object.
@@ -1412,10 +1555,10 @@ module JSS
1412
1555
  raw_json =
1413
1556
  if defined? self.class::USE_XML_WORKAROUND
1414
1557
  # if we're here, the API JSON is borked, so use the XML
1415
- JSS::XMLWorkaround.data_via_xml rsrc, self.class::USE_XML_WORKAROUND, @api
1558
+ Jamf::XMLWorkaround.data_via_xml rsrc, self.class::USE_XML_WORKAROUND, @cnx
1416
1559
  else
1417
1560
  # otherwise
1418
- @api.get_rsrc(rsrc)
1561
+ @cnx.c_get(rsrc)
1419
1562
  end
1420
1563
 
1421
1564
  raw_json[args[:rsrc_object_key]]
@@ -1468,6 +1611,7 @@ module JSS
1468
1611
  def find_main_subset
1469
1612
  return @init_data if @init_data[:id] && @init_data[:name]
1470
1613
  return @init_data[:general] if @init_data[:general] && @init_data[:general][:id] && @init_data[:general][:name]
1614
+
1471
1615
  @init_data.each do |_key, value|
1472
1616
  next unless value.is_a? Hash
1473
1617
  return value if value.keys.include?(:id) && value.keys.include?(:name)
@@ -1569,116 +1713,12 @@ module JSS
1569
1713
  # Most classes will redefine this method.
1570
1714
  #
1571
1715
  def rest_xml
1572
- doc = REXML::Document.new JSS::APIConnection::XML_HEADER
1716
+ doc = REXML::Document.new Jamf::Connection::XML_HEADER
1573
1717
  tmpl = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
1574
1718
  tmpl.add_element('name').text = @name
1575
1719
  doc.to_s
1576
1720
  end
1577
1721
 
1578
- # Meta Programming
1579
- ####################################################
1580
-
1581
- # Loop through the defined lookup keys and make
1582
- # .all_<key>s methods for each one, with
1583
- # alises as needed.
1584
- #
1585
- # This is called automatically in api_object.rb
1586
- # after all subclasses are loaded.
1587
- #
1588
- def self.define_identifier_list_methods
1589
- return unless @subclasses
1590
-
1591
- @subclasses.each do |subclass|
1592
- subclass.lookup_keys.each do |als, key|
1593
- meth_name = "all_#{key}s"
1594
-
1595
- if als == key
1596
- # the all_ method - skip if defined in the class
1597
- next if subclass.instance_methods.include? meth_name
1598
-
1599
- subclass.define_singleton_method meth_name do |refresh = false, api: JSS.api|
1600
- all(refresh, api: api).map { |i| i[key] }
1601
- end
1602
-
1603
- else
1604
- # an alias - skip if defined in the class
1605
- als_name = "all_#{als}s"
1606
- next if subclass.instance_methods.include? als_name
1607
-
1608
- subclass.define_singleton_method als_name do |refresh = false, api: JSS.api|
1609
- send meth_name, refresh, api: api
1610
- end
1611
- end # if
1612
- end # lookup_keys.each
1613
- end # @subclasses.each
1614
- end # self.define_identifier_list_methods
1615
-
1616
1722
  end # class APIObject
1617
1723
 
1618
- end # module JSS
1619
-
1620
- ### Mix-in Sub Modules
1621
- require 'jss/api_object/creatable'
1622
- require 'jss/api_object/uploadable'
1623
- require 'jss/api_object/locatable'
1624
- require 'jss/api_object/matchable'
1625
- require 'jss/api_object/purchasable'
1626
- require 'jss/api_object/updatable'
1627
- require 'jss/api_object/extendable'
1628
- require 'jss/api_object/self_servable'
1629
- require 'jss/api_object/categorizable'
1630
- require 'jss/api_object/vppable'
1631
- require 'jss/api_object/sitable'
1632
- require 'jss/api_object/mdm'
1633
- require 'jss/api_object/management_history'
1634
-
1635
- ### Mix-in Sub Modules with Classes
1636
- require 'jss/api_object/criteriable'
1637
- require 'jss/api_object/scopable'
1638
-
1639
- ### APIObject SubClasses with SubClasses
1640
- require 'jss/api_object/advanced_search'
1641
- require 'jss/api_object/configuration_profile'
1642
- require 'jss/api_object/extension_attribute'
1643
- require 'jss/api_object/group'
1644
- require 'jss/api_object/patch_source'
1645
-
1646
- ### APIObject SubClasses without SubClasses
1647
- require 'jss/api_object/account'
1648
- require 'jss/api_object/building'
1649
- require 'jss/api_object/category'
1650
- require 'jss/api_object/computer'
1651
- require 'jss/api_object/computer_invitation'
1652
- require 'jss/api_object/department'
1653
- require 'jss/api_object/disk_encryption_configurations'
1654
- require "jss/api_object/directory_binding_type"
1655
- require 'jss/api_object/directory_binding'
1656
- require 'jss/api_object/distribution_point'
1657
- require 'jss/api_object/ebook'
1658
- require 'jss/api_object/ibeacon'
1659
- require 'jss/api_object/dock_item'
1660
- require 'jss/api_object/ldap_server'
1661
- require 'jss/api_object/mac_application'
1662
- require 'jss/api_object/mobile_device'
1663
- require 'jss/api_object/mobile_device_application'
1664
- require 'jss/api_object/netboot_server'
1665
- require 'jss/api_object/network_segment'
1666
- require 'jss/api_object/package'
1667
- require 'jss/api_object/patch_title'
1668
- require 'jss/api_object/patch_policy'
1669
- require 'jss/api_object/peripheral_type'
1670
- require 'jss/api_object/peripheral'
1671
- require 'jss/api_object/policy'
1672
- require 'jss/api_object/removable_macaddr'
1673
- require 'jss/api_object/restricted_software'
1674
- require 'jss/api_object/script'
1675
- require 'jss/api_object/site'
1676
- require 'jss/api_object/software_update_server'
1677
- require 'jss/api_object/user'
1678
- require 'jss/api_object/webhook'
1679
- require 'jss/api_object/printer'
1680
-
1681
- ### Other
1682
- require 'jss/api_object/app_store_country_codes'
1683
-
1684
- JSS::APIObject.define_identifier_list_methods
1724
+ end # module Jamf