class Deltacloud::Metric

Constants

MOCK_METRICS_NAMES

Attributes

entity[RW]
properties[RW]

Public Instance Methods

add_property(name, values=nil) click to toggle source
# File lib/deltacloud/models/metric.rb, line 38
def add_property(name, values=nil)
  self.properties ||= []
  return self if self.properties.any? { |p| p.name == name }
  self.properties << Property.new(name, values)
  self
end
to_hash(context) click to toggle source
# File lib/deltacloud/models/metric.rb, line 45
def to_hash(context)
  {
    :id => self.id,
    :href => context.metric_url(self.id),
    :entity => entity,
    :properties => properties.map { |p| p.to_hash(context) }
  }
end
unknown?() click to toggle source
# File lib/deltacloud/models/metric.rb, line 34
def unknown?
  self.entity == :unknown
end