Class: UpGuard::SystemMetric
- Inherits:
-
BaseObject
- Object
- BaseObject
- UpGuard::SystemMetric
- Defined in:
- lib/upguard/SystemMetric.rb
Instance Attribute Summary collapse
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from BaseObject
#appliance_api_key, #appliance_url, #insecure, #sec_key
Instance Method Summary collapse
- #from_hash(h) ⇒ Object
-
#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ SystemMetric
constructor
A new instance of SystemMetric.
- #to_hash ⇒ Object
- #to_json(options = nil) ⇒ Object
Methods inherited from BaseObject
#http_delete, #http_get, #http_post, #http_put, #make_headers
Constructor Details
#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ SystemMetric
Returns a new instance of SystemMetric.
6 7 8 9 10 11 |
# File 'lib/upguard/SystemMetric.rb', line 6 def initialize(appliance_url, appliance_api_key, sec_key, insecure = false) super(appliance_url, appliance_api_key, sec_key, insecure) self.metric = nil self.value = nil self. = nil end |
Instance Attribute Details
#metric ⇒ Object
Returns the value of attribute metric.
3 4 5 |
# File 'lib/upguard/SystemMetric.rb', line 3 def metric @metric end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/upguard/SystemMetric.rb', line 5 def @timestamp end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/upguard/SystemMetric.rb', line 4 def value @value end |
Instance Method Details
#from_hash(h) ⇒ Object
13 14 15 16 17 |
# File 'lib/upguard/SystemMetric.rb', line 13 def from_hash(h) self.metric = h['metric'] if h.include?('metric') self.value = h['value'] if h.include?('value') self. = h['timestamp'] if h.include?('timestamp') end |
#to_hash ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/upguard/SystemMetric.rb', line 18 def to_hash h = {} h['metric'] = self.metric h['value'] = self.value h['timestamp'] = self. return h end |
#to_json(options = nil) ⇒ Object
25 26 27 28 |
# File 'lib/upguard/SystemMetric.rb', line 25 def to_json( = nil) h = to_hash return h.to_json() end |