class ClockSchema(ma.ModelSchema): class Meta: model = ClockDevice fields = ('id', 'scale', 'time', 'url') scale = ma.Integer(attribute='_scale') url = ma.AbsoluteUrlFor('clock_detail', id='<id>')
class ControllerBlockSchema(ma.ModelSchema): class Meta: model = ControllerBlock fields = ('type', 'updated_at', 'is_static', 'object_id', 'name', 'url') type = ma.Function(lambda obj: obj.__class__.__name__) url = ma.AbsoluteUrlFor('controllerblockdetail', id='<id>')
class TemperatureSensorDeviceSchema(ma.ModelSchema): """ Serialization schema for the TemperatureSensorDevice """ class Meta: model = TemperatureSensorDevice fields = ('id', 'value', 'url') url = ma.AbsoluteUrlFor('temperature_sensor_detail', id='<id>')
class PIDLoopSchema(ma.ModelSchema): """ Serialization schema for the PID Loop algorithm """ class Meta: model = PID fields = ('id', 'input', 'actuator', 'setpoint', 'url') url = ma.AbsoluteUrlFor('pid_loop_detail', id='<id>')
class ControllerSchema(ma.ModelSchema): class Meta: model = Controller fields = ('id', 'connected', 'profile', 'available_blocks', 'name', 'description', 'uri') profile = ma.HyperlinkRelated('controllerprofiledetail') available_blocks = ma.AbsoluteUrlFor('controlleravailableblocklist', controller_id='<id>')
class ClockSchema(ControllerBlockSchema): """ A clock that ticks """ class Meta: model = ClockDevice fields = ('id', 'scale', 'time', 'url') scale = ma.Integer(attribute='_scale') url = ma.AbsoluteUrlFor('clockdevice.details_view', id='<id>')
class PluginSchema(ma.Schema): id = ma.String(attribute="identifier") url = ma.AbsoluteUrlFor('plugin_detail', id='<identifier>') name = ma.String() description = ma.String() author = ma.String() license = ma.String() version = ma.String() website = ma.String() enabled = ma.Boolean()