Class: Pvectl::Models::TimeConfig

Inherits:
Base
  • Object
show all
Defined in:
lib/pvectl/models/time_config.rb,
sig/pvectl/models/time_config.rbs

Overview

Represents the time and timezone settings of a Proxmox node.

Immutable value object holding the response from GET /nodes/{node}/time, augmented with the node name (which is not part of the API payload but is the identifying context for the lookup).

Display formatting is handled by Presenters::TimeConfig.

Examples:

Creating from API data

data = { time: 1_715_000_000, localtime: 1_715_007_200, timezone: "Europe/Warsaw" }
model = TimeConfig.new(data.merge(node_name: "pve1"))
model.timezone #=> "Europe/Warsaw"

See Also:

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TimeConfig

Creates a new TimeConfig.



38
39
40
41
42
43
44
# File 'lib/pvectl/models/time_config.rb', line 38

def initialize(attributes = {})
  super
  @node_name = @attributes[:node_name]
  @time = @attributes[:time]
  @localtime = @attributes[:localtime]
  @timezone = @attributes[:timezone]
end

Instance Attribute Details

#localtimeInteger? (readonly)



30
31
32
# File 'lib/pvectl/models/time_config.rb', line 30

def localtime
  @localtime
end

#node_nameString? (readonly)



23
24
25
# File 'lib/pvectl/models/time_config.rb', line 23

def node_name
  @node_name
end

#timeInteger? (readonly)



26
27
28
# File 'lib/pvectl/models/time_config.rb', line 26

def time
  @time
end

#timezoneString? (readonly)



33
34
35
# File 'lib/pvectl/models/time_config.rb', line 33

def timezone
  @timezone
end