class KeyMetrics::KeyMetrics
Attributes
keymetric_1_icon_base64[RW]
keymetric_1_label[RW]
keymetric_1_value[RW]
keymetric_2_icon_base64[RW]
keymetric_2_label[RW]
keymetric_2_value[RW]
keymetric_3_icon_base64[RW]
keymetric_3_label[RW]
keymetric_3_value[RW]
version[RW]
Public Instance Methods
as_json()
click to toggle source
# File lib/key_metrics.rb, line 31 def as_json response = nil #if self.version.to_f > 0 response = { :keymetric_1 => { :label => self.keymetric_1_label, :value => self.keymetric_1_value, :icon => self.keymetric_1_icon_base64 }, :keymetric_2 => { :label => self.keymetric_2_label, :value => self.keymetric_2_value, :icon => self.keymetric_2_icon_base64 }, :keymetric_3 => { :label => self.keymetric_3_label, :value => self.keymetric_3_value, :icon => self.keymetric_3_icon_base64 }, } #else # response = { # :error => "Unkown version type" # } #end response end
set_key_metrics(req, keymetric_1 = { :label => "Metric
click to toggle source
# File lib/key_metrics.rb, line 12 def set_key_metrics(req, keymetric_1 = { :label => "Metric #1", :value => "null", :icon => nil}, keymetric_2 = { :label => "Metric #2", :value => "null", :icon => nil}, keymetric_3 = { :label => "Metric #3", :value => "null", :icon => nil}) self.version = req['keymetrics.version'] self.keymetric_1_label = keymetric_1[:label] self.keymetric_1_value = keymetric_1[:value] self.keymetric_1_icon_base64 = keymetric_1[:icon] self.keymetric_2_label = keymetric_2[:label] self.keymetric_2_value = keymetric_2[:value] self.keymetric_2_icon_base64 = keymetric_2[:icon] self.keymetric_3_label = keymetric_3[:label] self.keymetric_3_value = keymetric_3[:value] self.keymetric_3_icon_base64 = keymetric_3[:icon] end