Class: Radfish::BmcInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/radfish/bmc_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BmcInfo

Returns a new instance of BmcInfo.



7
8
9
10
# File 'lib/radfish/bmc_info.rb', line 7

def initialize(client)
  @client = client
  @cache = {}
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/radfish/bmc_info.rb', line 5

def client
  @client
end

Instance Method Details

#firmware_versionObject



26
27
28
# File 'lib/radfish/bmc_info.rb', line 26

def firmware_version
  fetch_bmc_info[:firmware_version] || fetch_bmc_info[:bmc_firmware_version]
end

#healthObject



46
47
48
# File 'lib/radfish/bmc_info.rb', line 46

def health
  fetch_bmc_info[:health] || fetch_bmc_info[:bmc_health]
end

#hostnameObject



42
43
44
# File 'lib/radfish/bmc_info.rb', line 42

def hostname
  fetch_bmc_info[:hostname] || fetch_bmc_info[:bmc_hostname]
end

#ip_addressObject



38
39
40
# File 'lib/radfish/bmc_info.rb', line 38

def ip_address
  fetch_bmc_info[:ip_address] || fetch_bmc_info[:bmc_ip_address]
end

#keysObject



12
13
14
# File 'lib/radfish/bmc_info.rb', line 12

def keys
  [:license_version, :firmware_version, :redfish_version, :mac_address, :ip_address, :hostname, :health]
end

#license_versionObject



22
23
24
# File 'lib/radfish/bmc_info.rb', line 22

def license_version
  fetch_bmc_info[:license_version] || fetch_bmc_info[:bmc_license_version]
end

#mac_addressObject



34
35
36
# File 'lib/radfish/bmc_info.rb', line 34

def mac_address
  fetch_bmc_info[:mac_address] || fetch_bmc_info[:bmc_mac_address]
end

#redfish_versionObject



30
31
32
# File 'lib/radfish/bmc_info.rb', line 30

def redfish_version
  fetch_bmc_info[:redfish_version]
end

#to_hObject



16
17
18
19
20
# File 'lib/radfish/bmc_info.rb', line 16

def to_h
  keys.each_with_object({}) do |key, hash|
    hash[key] = send(key)
  end
end