Class: Stackify::Metrics::MetricForSubmit
- Defined in:
- lib/stackify/metrics/metric.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#monitor_id ⇒ Object
Returns the value of attribute monitor_id.
-
#monitor_type_id ⇒ Object
Returns the value of attribute monitor_type_id.
-
#occurred_utc ⇒ Object
Returns the value of attribute occurred_utc.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(metric) ⇒ MetricForSubmit
constructor
A new instance of MetricForSubmit.
- #to_h ⇒ Object
Constructor Details
#initialize(metric) ⇒ MetricForSubmit
Returns a new instance of MetricForSubmit.
49 50 51 52 53 54 55 |
# File 'lib/stackify/metrics/metric.rb', line 49 def initialize metric @value = metric.value.round 2 @monitor_id = metric.monitor_id || 0 @occurred_utc = metric.occurred_utc @count = metric.count @monitor_type_id = metric.metric_type end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
47 48 49 |
# File 'lib/stackify/metrics/metric.rb', line 47 def count @count end |
#monitor_id ⇒ Object
Returns the value of attribute monitor_id.
47 48 49 |
# File 'lib/stackify/metrics/metric.rb', line 47 def monitor_id @monitor_id end |
#monitor_type_id ⇒ Object
Returns the value of attribute monitor_type_id.
47 48 49 |
# File 'lib/stackify/metrics/metric.rb', line 47 def monitor_type_id @monitor_type_id end |
#occurred_utc ⇒ Object
Returns the value of attribute occurred_utc.
47 48 49 |
# File 'lib/stackify/metrics/metric.rb', line 47 def occurred_utc @occurred_utc end |
#value ⇒ Object
Returns the value of attribute value.
47 48 49 |
# File 'lib/stackify/metrics/metric.rb', line 47 def value @value end |
Instance Method Details
#to_h ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/stackify/metrics/metric.rb', line 57 def to_h { 'Value' => @value, 'MonitorID' => @monitor_id, 'OccurredUtc' => DateTime.parse(@occurred_utc.to_s).iso8601, 'Count' => @count, 'MonitorTypeID' => @monitor_type_id } end |