metric_configuration_snapshot.rb
757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class Kalibro::MetricConfigurationSnapshot < Kalibro::Model
attr_accessor :code, :weight, :aggregation_form, :metric, :base_tool_name, :range
def weight=(value)
@weight = value.to_f
end
def metric=(value)
if value.kind_of?(Hash)
@metric = Kalibro::Metric.to_object(value)
else
@metric = value
end
end
def range=(value)
value.to_a
@range = []
value.each do |range_snapshot|
@range << Kalibro::RangeSnapshot.to_object(range_snapshot)
end
end
def range_snapshot
range
end
def to_hash
hash = super
hash[:attributes!][:range] = {'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:type' => 'kalibro:rangeSnapshotXml' }
hash
end
end