Class: UnifiProtect::NVR
- Inherits:
-
Object
show all
- Defined in:
- lib/unifi_protect/nvr.rb
Constant Summary
collapse
- TIME_FIELDS =
i[upSince].freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(client:, nvr:) ⇒ NVR
9
10
11
12
|
# File 'lib/unifi_protect/nvr.rb', line 9
def initialize(client:, nvr:)
@client = client
@nvr = nvr
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/unifi_protect/nvr.rb', line 26
def method_missing(method_name, *args)
value = @nvr.send(method_name, *args)
return Time.at(value / 1000) if value && TIME_FIELDS.include?(method_name)
value
end
|
Instance Attribute Details
#nvr ⇒ Object
Returns the value of attribute nvr.
7
8
9
|
# File 'lib/unifi_protect/nvr.rb', line 7
def nvr
@nvr
end
|
Instance Method Details
#inspect ⇒ Object
18
19
20
|
# File 'lib/unifi_protect/nvr.rb', line 18
def inspect
to_s
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
22
23
24
|
# File 'lib/unifi_protect/nvr.rb', line 22
def respond_to_missing?(method_name, include_private = false)
@nvr.respond_to?(method_name) || super
end
|
#to_s ⇒ Object
14
15
16
|
# File 'lib/unifi_protect/nvr.rb', line 14
def to_s
"#<#{self.class.name} id=#{@nvr.id.inspect} name=#{@nvr.name.inspect}>"
end
|