redfish_client 0.6.2 → 0.7.0

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: d565357ebc33ecafd73baf529638da1b24e03ed80c1272f769278f8d65822982
4
- data.tar.gz: 21724f92efa1c966eb1fcd361ae5fbcc34a5c3f4b13d76e261f325f382fce825
3
+ metadata.gz: f6ba76d56a2c09531c6e64bf19821d0b5f582dd70b16d1905aba16dc2b68df2e
4
+ data.tar.gz: 530aebc45865ab6b64d2eb188c76f65dd1537f3e10d2b45c8e8dc29941dd86cb
5
5
  SHA512:
6
- metadata.gz: fe37c7362f8365175014ec302c66aad65d968bb18fac641cdbbe97fc0ca7842330bd4dbbbac02eff150d90ea50148922f73444eaf3bfb89a4bffb92d4f37fec3
7
- data.tar.gz: 29a334780905e1ffea4fd1a9798d8b51aa9120e2aef7031e6e4d0c56d60536759a4d405c5e3cec39a008c0764b72dc3c89b8ad4b8720cc1b076cceb26f61ee6d
6
+ metadata.gz: 7671904be9a15568124d63ebff70d72e3b6f35a0adafc632e278637720aaae2b4e1ee1e29355997c47be9060cf6ce4daae6c8bfc7f2af8682e2c38f8f8e72f2b
7
+ data.tar.gz: 074a32b18fb628befd56cc46977f3efbe431571cda082e4c6498d89a0dbc581debac11e07cbd2e5412437bb1d7cf653aef85b3e98ea071b0957bb43fb4c9eb4b
@@ -149,10 +149,15 @@ module RedfishClient
149
149
  # @param method [Symbol] HTTP method (:get, :post, :patch or :delete)
150
150
  # @param field [String, Symbol] path lookup field
151
151
  # @param path [String] path to post to
152
+ # @param payload Hash<String, >] data to send
153
+ # @param headers [Hash<String, String>] additional headers for this request only
152
154
  # @return [RedfishClient::Response] response
153
155
  # @raise [NoODataId] resource has no OpenData id
154
- def request(method, field, path, payload = nil)
156
+ def request(method, field, path, payload = nil, headers = nil)
157
+ @connector.add_headers(headers) if headers&.any?
155
158
  @connector.request(method, get_path(field, path), payload)
159
+ ensure
160
+ @connector.remove_headers(headers) if headers&.any?
156
161
  end
157
162
 
158
163
  # Issue a GET requests to the selected endpoint.
@@ -169,10 +174,11 @@ module RedfishClient
169
174
  #
170
175
  # @param field [String, Symbol] path lookup field
171
176
  # @param path [String] path to post to
177
+ # @param headers [Hash<String, String>] additional headers for this request only
172
178
  # @return [RedfishClient::Response] response
173
179
  # @raise [NoODataId] resource has no OpenData id
174
- def get(field: "@odata.id", path: nil)
175
- request(:get, field, path)
180
+ def get(field: "@odata.id", path: nil, headers: nil)
181
+ request(:get, field, path, nil, headers)
176
182
  end
177
183
 
178
184
  # Issue a POST requests to the selected endpoint.
@@ -193,10 +199,11 @@ module RedfishClient
193
199
  # @param field [String, Symbol] path lookup field
194
200
  # @param path [String] path to post to
195
201
  # @param payload [Hash<String, >] data to send
202
+ # @param headers [Hash<String, String>] additional headers for this request only
196
203
  # @return [RedfishClient::Response] response
197
204
  # @raise [NoODataId] resource has no OpenData id
198
- def post(field: "@odata.id", path: nil, payload: nil)
199
- request(:post, field, path, payload)
205
+ def post(field: "@odata.id", path: nil, payload: nil, headers: nil)
206
+ request(:post, field, path, payload, headers)
200
207
  end
201
208
 
202
209
  # Issue a PATCH requests to the selected endpoint.
@@ -207,10 +214,11 @@ module RedfishClient
207
214
  # @param field [String, Symbol] path lookup field
208
215
  # @param path [String] path to patch
209
216
  # @param payload [Hash<String, >] data to send
217
+ # @param headers [Hash<String, String>] additional headers for this request only
210
218
  # @return [RedfishClient::Response] response
211
219
  # @raise [NoODataId] resource has no OpenData id
212
- def patch(field: "@odata.id", path: nil, payload: nil)
213
- request(:patch, field, path, payload)
220
+ def patch(field: "@odata.id", path: nil, payload: nil, headers: nil)
221
+ request(:patch, field, path, payload, headers)
214
222
  end
215
223
 
216
224
  # Issue a DELETE requests to the endpoint of the resource.
@@ -219,16 +227,20 @@ module RedfishClient
219
227
  # raised, since deleting non-networked resources makes no sense and
220
228
  # probably indicates bug in library consumer.
221
229
  #
230
+ # @param field [String, Symbol] path lookup field
231
+ # @param path [String] path to patch
232
+ # @param payload [Hash<String, >] data to send
233
+ # @param headers [Hash<String, String>] additional headers for this request only
222
234
  # @return [RedfishClient::Response] response
223
235
  # @raise [NoODataId] resource has no OpenData id
224
- def delete(field: "@odata.id", path: nil, payload: nil)
225
- request(:delete, field, path, payload)
236
+ def delete(field: "@odata.id", path: nil, payload: nil, headers: nil)
237
+ request(:delete, field, path, payload, headers)
226
238
  end
227
239
 
228
240
  # Refresh resource content from the API
229
241
  #
230
242
  # Caling this method will ensure that the resource data is in sync with
231
- # the Redfis API, invalidating any caches as necessary.
243
+ # the Redfish API, invalidating any caches as necessary.
232
244
  def refresh
233
245
  return unless self["@odata.id"]
234
246
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedfishClient
4
- VERSION = "0.6.2"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redfish_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tadej Borovšak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2025-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon