ruby-jss 5.0.0 → 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: 5967bd88808e686b9c4d19707e55b05a889cdc50385fd96f9a693112977c6db0
4
- data.tar.gz: f2fe45cdd69563229432a8b9d01d903226108fc0d9dd86bda83edf309ba8f533
3
+ metadata.gz: fb8e45fa884fdb03111f19962b52cc59e9d9a959b56139c0494682d1796be369
4
+ data.tar.gz: 51f1c69302671c63da44b535b437ed92741f925741ab27348def5d9bb51ac0c9
5
5
  SHA512:
6
- metadata.gz: ee53b7ed68c150895a86a9ab02a96b38b95c57e8cb40b74f2ad239948013d66a2969c4a7db79fe7a5ca2a12edf7248f7034e59307a8d767659ac7b3bebeab9a1
7
- data.tar.gz: f33e2504c9b717a93041e639dc0d315fdb5c16756d388da43e94ca2e87f56902075756202c19853aa70e11c08923c0a119a36384104678a6379b7da3477920a4
6
+ metadata.gz: 0f3220a26d97723f97624dedf79abef52ed800aac589f2a485b7d9e37cb14499cce810093ce666209c3355f64b3a5585f901d05c070098bf88bdc48c36cb386a
7
+ data.tar.gz: f9b4b1fba7f67e8cef0a883d7ec92f229f6241a33a48d16c6e45772d9789bc03a0361ab189b35018ddc45c2748e31cf494bde2e2cb1c9fcbae7fe49a2f1468f5
data/CHANGES.md CHANGED
@@ -14,6 +14,13 @@ __Please update all installations of ruby-jss to at least v1.6.0.__
14
14
 
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
+ --------
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
+
17
24
  --------
18
25
  ## \[5.0.0] 2026-01-06
19
26
 
@@ -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.0'.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.0
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: 2026-01-08 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