radfish 0.2.2 → 0.2.4

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: 7d6c54aeb9655a43ed2fddc650f5ad6ab7042ee36c6e28977b080033a7d66ad8
4
- data.tar.gz: bd313932fe76b381a63d9b6ef1e8d91129cd61666ba0739c9629c45f3f198589
3
+ metadata.gz: 6da783b12d9a90873743161fff969aae700800a544b1223f488e9828964b3a97
4
+ data.tar.gz: f42f9b1ae0ffbf3d50ad13732895b82472839133ece168b1cfb06b015f1d07a7
5
5
  SHA512:
6
- metadata.gz: 759f93847d982760321fd989f0aa3931f01602371b2485d276c8a57b623d210a47c2b791911e7d850e87360ae7d1f57b6ba697d06065a1377b73c977638ae3ae
7
- data.tar.gz: 792d117f69fb50fe9c6f62ca271edadd7886e901d958e372ea052e55d4b38d4987bb4060f4e28336e67221a1df8dfb8b9885680cf1f85ecdad6722d6e07b508b
6
+ metadata.gz: 0edb45f482cd15f8d389064273572d158f195500c613f99a652b713438c16715703de07130f8421dd6e2d6b7d1b2a7df4eb066d1aa0d6625cfa2e2827572bc9b
7
+ data.tar.gz: f0ba4c5e3c0d07e0f06df7f2b15a56dc99b9349d537e71c3c48037bf1d757aae773ac1d5b5df671a6398656cb12a2b0d000a6d923876c8f37d5f5f74c1f4c14a
@@ -188,18 +188,31 @@ module Radfish
188
188
  private
189
189
 
190
190
  def build_controller(raw)
191
- # Only extract friendly name/id if plainly available; keep raw in adapter_data
192
- id = if raw.respond_to?(:[])
193
- raw['id'] || raw[:id]
194
- elsif raw.respond_to?(:id)
195
- raw.id
196
- end
197
- name = if raw.respond_to?(:[])
198
- raw['name'] || raw[:name]
199
- elsif raw.respond_to?(:name)
200
- raw.name
201
- end
202
- Controller.new(client: self, id: id, name: name, vendor: @vendor, adapter_data: raw)
191
+ # Expect adapters to provide normalized fields; keep mapping straightforward.
192
+ fetch = ->(key) do
193
+ if raw.respond_to?(:[])
194
+ raw[key.to_s] || raw[key.to_sym]
195
+ elsif raw.respond_to?(key.to_sym)
196
+ raw.public_send(key.to_sym)
197
+ end
198
+ end
199
+
200
+ Controller.new(
201
+ client: self,
202
+ id: fetch.call(:id),
203
+ name: fetch.call(:name),
204
+ model: fetch.call(:model),
205
+ firmware_version: fetch.call(:firmware_version),
206
+ encryption_mode: fetch.call(:encryption_mode),
207
+ encryption_capability: fetch.call(:encryption_capability),
208
+ controller_type: fetch.call(:controller_type),
209
+ pci_slot: fetch.call(:pci_slot),
210
+ status: fetch.call(:status),
211
+ drives_count: fetch.call(:drives_count),
212
+ battery_status: fetch.call(:battery_status),
213
+ vendor: @vendor,
214
+ adapter_data: raw
215
+ )
203
216
  end
204
217
  end
205
218
  end
@@ -4,14 +4,28 @@ module Radfish
4
4
  # Lightweight value object representing a storage controller.
5
5
  # Holds a stable identifier and optional name.
6
6
  class Controller
7
- attr_reader :id, :name, :vendor, :adapter_data
7
+ attr_reader :id, :name, :model, :vendor, :adapter_data, :firmware_version,
8
+ :encryption_mode, :encryption_capability, :controller_type,
9
+ :pci_slot, :status, :drives_count, :battery_status
8
10
 
9
- def initialize(client:, id:, name: nil, vendor: nil, adapter_data: nil)
11
+ def initialize(client:, id:, name: nil, model: nil, vendor: nil, adapter_data: nil,
12
+ firmware_version: nil, encryption_mode: nil, encryption_capability: nil,
13
+ controller_type: nil, pci_slot: nil, status: nil, drives_count: nil,
14
+ battery_status: nil)
10
15
  @client = client
11
16
  @id = id
12
17
  @name = name
18
+ @model = model
13
19
  @vendor = vendor
14
20
  @adapter_data = adapter_data
21
+ @firmware_version = firmware_version
22
+ @encryption_mode = encryption_mode
23
+ @encryption_capability = encryption_capability
24
+ @controller_type = controller_type
25
+ @pci_slot = pci_slot
26
+ @status = status
27
+ @drives_count = drives_count
28
+ @battery_status = battery_status
15
29
  end
16
30
 
17
31
  # Convenience accessors delegate to the client wrappers
@@ -24,11 +38,25 @@ module Radfish
24
38
  end
25
39
 
26
40
  def to_h
27
- { id: id, name: name, vendor: vendor }
41
+ {
42
+ id: id,
43
+ name: name,
44
+ model: model,
45
+ vendor: vendor,
46
+ firmware_version: firmware_version,
47
+ encryption_mode: encryption_mode,
48
+ encryption_capability: encryption_capability,
49
+ controller_type: controller_type,
50
+ pci_slot: pci_slot,
51
+ status: status,
52
+ drives_count: drives_count,
53
+ battery_status: battery_status
54
+ }.compact
28
55
  end
29
56
 
30
57
  def ==(other)
31
58
  other.is_a?(Controller) && other.id == id && other.vendor.to_s == vendor.to_s
32
59
  end
60
+
33
61
  end
34
62
  end
@@ -18,6 +18,7 @@ module Radfish
18
18
  def storage_summary
19
19
  raise NotImplementedError, "Adapter must implement #storage_summary"
20
20
  end
21
+
21
22
  end
22
23
  end
23
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Radfish
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel