ruby-jss 5.0.0b1 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe2a1fd9beba704e48499993ccfbc030e07eb9a7f008d695d652f5b906dca691
4
- data.tar.gz: 58ba3c159e925c3f86eb65b9d2c3583921810ec7ed18daa0f230219f8c8e5b1c
3
+ metadata.gz: fb8e45fa884fdb03111f19962b52cc59e9d9a959b56139c0494682d1796be369
4
+ data.tar.gz: 51f1c69302671c63da44b535b437ed92741f925741ab27348def5d9bb51ac0c9
5
5
  SHA512:
6
- metadata.gz: e6ab10f5930e059100ce9783714a8495b33719bd3d2445b2aae2b6f5ab4980ba76cd4dfa07b0a9a0e272be8a38913aa7fd2afee609aefc873043e906fa9cb394
7
- data.tar.gz: 19dda1b6bec99106e64e02b04c56d2f3e8387afb6e64bf40d6a61b0dafdab720c9094184eee551c02ec0bf0226c58a462bb97ae42970205fb483d2a460bcd5c8
6
+ metadata.gz: 0f3220a26d97723f97624dedf79abef52ed800aac589f2a485b7d9e37cb14499cce810093ce666209c3355f64b3a5585f901d05c070098bf88bdc48c36cb386a
7
+ data.tar.gz: f9b4b1fba7f67e8cef0a883d7ec92f229f6241a33a48d16c6e45772d9789bc03a0361ab189b35018ddc45c2748e31cf494bde2e2cb1c9fcbae7fe49a2f1468f5
data/CHANGES.md CHANGED
@@ -15,13 +15,20 @@ __Please update all installations of ruby-jss to at least v1.6.0.__
15
15
  Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
16
16
 
17
17
  --------
18
- ## \[5.0.0] Unreleased
18
+ ## \[5.0.1] 2026-01-09
19
+
20
+ ### Fixed
21
+
22
+ - The `Jamf::Connection::JamfProAPI` methods for basic HTTP interaction with the server (`#jp_get`, `#jp_post`, `#jp_put`, `#jp_patch`, & `#jp_delete`) can all now optionally take a second parameter as the request body, or omit such a parameter. Omission is needed for some endpoints, such as POSTing to `/v2/mobile-devices/{id}/unmanage`, which takes no body, and occasionally there have been GET or DELETE endpoints that require a body also (which is allowed in the HTTP spec.) Previously, `#jp_post` required such a body, so the unmanage was failing.
23
+
24
+ --------
25
+ ## \[5.0.0] 2026-01-06
19
26
 
20
27
  ### Added
21
28
 
22
29
  - A new dependency on the [pixar-ruby-extensions gem](https://rubygems.org/gems/pixar-ruby-extensions), which are similar to those found in the JamfRubyExtensions module built into ruby-jss. Once all use of JamfRubyExtensions has been replaced by the new gem, JamfRubyExtensions will be removed. Staying DRY is a good thing.
23
30
 
24
- - Jamf::Computer and Jamf::MobileDevice now have a class method `.management_id(ident, cnx: Jamf.cnx)` and a matching instance method `#management_id`. Even though the classes are based on the Classic API endpoints for Computers and MobileDevices, the 'managementId' value (a UUID used by Apples MDM/DDM) is not available in the Classic API data. These methods reach out to the Jamf Pro API to find the id for the instance, or the identified object.
31
+ - Jamf::Computer and Jamf::MobileDevice now have a class method `.management_id(ident, cnx: Jamf.cnx)` and a matching instance method `#management_id`. Even though the classes are based on the Classic API endpoints for Computers and MobileDevices, the 'managementId' value (a UUID used by Apple's MDM/DDM) is not available in the Classic API data. These methods reach out to the Jamf Pro API to find the id for the instance, or the identified object. The upcoming JComputer and JMobileDevice classes will embody the Jamf Pro API endpoints directly.
25
32
 
26
33
  ### Changed
27
34
 
@@ -37,25 +44,27 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
37
44
 
38
45
  This fixes [GitHub Issue 107](https://github.com/PixarAnimationStudios/ruby-jss/issues/107) - many thanks to @csfjeff for reporting the problem!
39
46
 
40
-
41
-
42
47
  --------
43
48
  ## \[4.2.4] 2025-10-31
44
49
 
45
50
  ### Added
51
+
46
52
  - Set request User-Agent header to indicate ruby-jss version
47
53
 
48
54
  ### Changed
55
+
49
56
  - Use the 'TOMORROW OPEN SOURCE TECHNOLOGY LICENSE 1.0' (TOST) License
50
57
  - The terms are unchanged, but it now has an offical name.
51
58
 
52
59
  ### Fixed
60
+
53
61
  - Resolved [GitHub Issue 106](https://github.com/PixarAnimationStudios/ruby-jss/issues/106). REXML v3.4.3 or higher doesn't allow the creation of REXML::Document instances without a root element. Many thanks to @hiboma for the bug report and a suggested fix!
54
62
 
55
63
  --------
56
64
  ## \[4.2.3] 2025-09-23
57
65
 
58
66
  ### Fixed
67
+
59
68
  - Fixed bug were `#save` was not returning the object's Jamf ID when updating scopable objects.
60
69
  - Fixed bug where `Jamf::Policy#retry_event=` raised error when no retry_attempts are defined.
61
70
 
@@ -63,6 +72,7 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
63
72
  ## \[4.2.2] 2025-09-06
64
73
 
65
74
  ### Fixed
75
+
66
76
  - Class `Jamf::JPackage` no longer raises `Errno::EINVAL Invalid argument @ io_fread` when generating manifest checksums for very large package files.
67
77
 
68
78
 
@@ -355,11 +355,7 @@ module Jamf
355
355
  commandData: command_data
356
356
  }
357
357
 
358
- if JSS.devmode?
359
- puts "Sending XML:\n"
360
- REXML::Document.new(cmd_xml).write STDOUT, 2
361
- puts "\n\nTo rsrc: #{rsrc}"
362
- end
358
+ puts "Sending data:\n#{data}" if JSS.devmode?
363
359
 
364
360
  cnx.jp_post MDM_COMMAND_RSRC, data
365
361
  end
@@ -378,7 +374,7 @@ module Jamf
378
374
  #
379
375
  # @param cnx [Jamf::Connection] an API connection to use.
380
376
  #
381
- # @return [Array<Integer>] The ids of the target devices for a command
377
+ # @return [Array<String,Integer>] The ids of the target devices for a command
382
378
  #
383
379
  def raw_targets_to_mgmt_ids(targets, expand_groups: true, unmanaged_ok: false, jamf_ids: false, api: nil, cnx: Jamf.cnx)
384
380
  cnx = api if api
@@ -593,7 +589,7 @@ module Jamf
593
589
  }
594
590
  cmd_data[:message] = message if message
595
591
  cmd_data[:phoneNumber] = phoneNumber if phoneNumber
596
- cmd_data[:pin] = passcode if passcode
592
+ cmd_data[:pin] = passcode unless passcode.pix_empty?
597
593
 
598
594
  send_mdm_command(targets, cmd_data, cnx: cnx)
599
595
  end
@@ -722,8 +718,8 @@ module Jamf
722
718
  data = {
723
719
  commandType: DELETE_USER,
724
720
  userName: user,
725
- force: force,
726
- all: all
721
+ forceDeletion: force,
722
+ deleteAllUsers: all
727
723
  }
728
724
  send_mdm_command targets, data, cnx: cnx
729
725
  end
@@ -915,7 +911,7 @@ module Jamf
915
911
  alias set_name device_name
916
912
  alias set_device_name device_name
917
913
 
918
- # TODO: Re-enable this when the wallpaper MDM commands are migrated to JPAPI
914
+ # TODO: Update/migrate this when the wallpaper MDM command is migrated to JPAPI
919
915
  #
920
916
  # Send a wallpaper command to one or more targets
921
917
  #
@@ -955,9 +951,15 @@ module Jamf
955
951
  end
956
952
 
957
953
  targets = raw_targets_to_mgmt_ids targets, jamf_ids: true, cnx: cnx
958
- cmd_xml = mdm_command_xml(command, opts, targets)
954
+ cmd_xml = mdm_command_xml(:Wallpaper, opts, targets)
959
955
  rsrc = 'mobiledevicecommands/command/Wallpaper'
960
956
 
957
+ if JSS.devmode?
958
+ puts "Sending XML:\n"
959
+ REXML::Document.new(cmd_xml).write STDOUT, 2
960
+ puts "\n\nTo rsrc: #{rsrc}"
961
+ end
962
+
961
963
  xml_resp = cnx.c_post rsrc, cmd_xml
962
964
 
963
965
  hash = {}
@@ -1449,11 +1451,10 @@ module Jamf
1449
1451
  #
1450
1452
  # @return (see .send_mdm_command)
1451
1453
  #
1452
- def device_name(name)
1454
+ def set_device_name(name)
1453
1455
  self.class.device_name @id, name, cnx: @cnx
1454
1456
  end
1455
- alias set_name device_name
1456
- alias set_device_name device_name
1457
+ alias set_name set_device_name
1457
1458
 
1458
1459
  # Send a wallpaper command to this object
1459
1460
  #
@@ -44,15 +44,17 @@ module Jamf
44
44
 
45
45
  # @return [Hash] the result of the get
46
46
  #######################################################
47
- def jp_get(rsrc)
47
+ def jp_get(rsrc, data = nil)
48
48
  validate_connected
49
+
49
50
  rsrc = rsrc.delete_prefix Jamf::Connection::SLASH
50
51
  resp = @jp_cnx.get(rsrc) do |req|
51
52
  # Modify the request here if needed.
52
53
  # puts "JPAPI Cookie is: #{req.headers['Cookie']}"
54
+ req.body = data if data
53
55
  end
54
- @last_http_response = resp
55
56
 
57
+ @last_http_response = resp
56
58
  return resp.body if resp.success?
57
59
 
58
60
  raise Jamf::Connection::JamfProAPIError, resp
@@ -69,12 +71,14 @@ module Jamf
69
71
  #
70
72
  # @return [String] the response body
71
73
  #######################################################
72
- def jp_post(rsrc, data)
74
+ def jp_post(rsrc, data = nil)
73
75
  validate_connected
76
+
74
77
  rsrc = rsrc.delete_prefix Jamf::Connection::SLASH
75
78
  resp = @jp_cnx.post(rsrc) do |req|
76
- req.body = data
79
+ req.body = data if data
77
80
  end
81
+
78
82
  @last_http_response = resp
79
83
  return resp.body if resp.success?
80
84
 
@@ -92,12 +96,14 @@ module Jamf
92
96
  # @return [String] the response from the server.
93
97
  #
94
98
  #######################################################
95
- def jp_put(rsrc, data)
99
+ def jp_put(rsrc, data = nil)
96
100
  validate_connected
101
+
97
102
  rsrc = rsrc.delete_prefix Jamf::Connection::SLASH
98
103
  resp = @jp_cnx.put(rsrc) do |req|
99
- req.body = data
104
+ req.body = data if data
100
105
  end
106
+
101
107
  @last_http_response = resp
102
108
  return resp.body if resp.success?
103
109
 
@@ -115,14 +121,16 @@ module Jamf
115
121
  # @return [String] the response from the server.
116
122
  #
117
123
  #######################################################
118
- def jp_patch(rsrc, data)
124
+ def jp_patch(rsrc, data = nil)
119
125
  validate_connected
126
+
120
127
  rsrc = rsrc.delete_prefix Jamf::Connection::SLASH
121
128
  resp = @jp_cnx.patch(rsrc) do |req|
122
129
  # Patch requests must use this content type!
123
130
  req.headers['Content-Type'] = 'application/merge-patch+json'
124
- req.body = data
131
+ req.body = data if data
125
132
  end
133
+
126
134
  @last_http_response = resp
127
135
  return resp.body if resp.success?
128
136
 
@@ -138,10 +146,14 @@ module Jamf
138
146
  # @return [String] the response from the server.
139
147
  #
140
148
  #######################################################
141
- def jp_delete(rsrc)
149
+ def jp_delete(rsrc, data = nil)
142
150
  validate_connected
143
151
  rsrc = rsrc.delete_prefix Jamf::Connection::SLASH
144
- resp = @jp_cnx.delete rsrc
152
+
153
+ resp = @jp_cnx.delete(rsrc) do |req|
154
+ req.body = data if data
155
+ end
156
+
145
157
  @last_http_response = resp
146
158
  return resp.body if resp.success?
147
159
 
@@ -164,7 +176,7 @@ module Jamf
164
176
  end
165
177
 
166
178
  # @param rsrc[String] the API resource being uploadad-to,
167
- # the URL part after 'JSSResource/'
179
+ # the URL part after 'api/'
168
180
  #
169
181
  # @param local_file[String, Pathname] the local file to upload
170
182
  #
data/lib/jamf/version.rb CHANGED
@@ -9,6 +9,6 @@
9
9
  module Jamf
10
10
 
11
11
  ### The version of ruby-jss
12
- VERSION = '5.0.0b1'.freeze
12
+ VERSION = '5.0.1'.freeze
13
13
 
14
14
  end # module
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jss
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0b1
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Lasell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-12-03 00:00:00.000000000 Z
12
+ date: 2026-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pixar-ruby-extensions
@@ -544,9 +544,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
544
544
  version: 2.6.3
545
545
  required_rubygems_version: !ruby/object:Gem::Requirement
546
546
  requirements:
547
- - - ">"
547
+ - - ">="
548
548
  - !ruby/object:Gem::Version
549
- version: 1.3.1
549
+ version: '0'
550
550
  requirements: []
551
551
  rubygems_version: 3.0.3.1
552
552
  signing_key: