class RestGearGroup

Attributes

cartridges[RW]
gear_profile[RW]
gears[RW]
name[RW]

Public Class Methods

new(group_instance, gear_states = {}) click to toggle source
# File lib/stickshift-controller/app/models/rest_gear_group.rb, line 4
def initialize(group_instance, gear_states = {})
  app               = group_instance.app
  self.name         = group_instance.name
  self.gear_profile = group_instance.node_profile
  self.gears        = group_instance.gears.map{ |gear| {:id => gear.uuid, :state => gear_states[gear.uuid] || 'unknown'} }
  self.cartridges   = group_instance.component_instances.map { |comp_inst| app.comp_instance_map[comp_inst].cart_properties.merge({:name => app.comp_instance_map[comp_inst].parent_cart_name}) }
  self.cartridges.delete_if{ |comp| comp[:name] == app.name }
end

Public Instance Methods

to_xml(options={}) click to toggle source
# File lib/stickshift-controller/app/models/rest_gear_group.rb, line 13
def to_xml(options={})
  options[:tag_name] = "gear_group"
  super(options)
end