Beispiel #1
0
    def create_bundle(self, metric_name, source_name, plugin, cls):
        if issubclass(cls, PluginDataModel):
            factory = PluginDataFactory
        else:
            raise Exception("Invalid class type for factory.")

        metric = MetricFactory(name=metric_name)
        source = SourceFactory(name=source_name)
        model = PluginModelFactory()
        cls_args = dict(metric=metric,
                        source=source,
                        plugin=plugin,
                        plugin_model=model)
        inst = factory(**cls_args)
        cls_args.update({
            'source_proxy':
            SourceProxy(name=source.name),
            'metric_proxy':
            MetricProxy(name=metric.name),
            'plugin_proxy':
            PluginProxy(name=plugin.name, hashkey=plugin.hashkey),
            'plugin_model_proxy':
            PluginModelProxy(metric_id=metric.name,
                             plugin_id=plugin.hashkey,
                             hashkey=model.hashkey,
                             name=model.__class__.__name__),
            'inst':
            inst
        })
        return cls_args
Beispiel #2
0
class MoodForm(FormView):
    name = "mood"
    description = "Please enter some information about your mood."
    model = MoodModel
    metric_proxy = MetricProxy(name="mood")
    source_proxy = SourceProxy(name="self")

    score = IntegerField('Mood', [required()],
                         description="Number on a 1-10 scale.")
Beispiel #3
0
class SurveyForm(FormView):
    name = "survey"
    description = "Please enter some long information about your mood."
    model = DataModel
    metric_proxy = MetricProxy(name="data")
    source_proxy = SourceProxy(name="self")

    text = TextField(description="Enter the mood you are feeling.")
    number = IntegerField(description="Number on a 1-10 scale.")
Beispiel #4
0
class MoodModel(PluginDataModel):
    metric_proxy = MetricProxy(name="mood")
    source_proxy = SourceProxy(name="self")
    perms = [
        Scope(ZonePerm("user", current=True), BlockPerm("plugin",
                                                        current=True))
    ]

    score = IntegerField()
Beispiel #5
0
class SettingsModel(PluginDataModel):
    metric_proxy = MetricProxy(name="settings")
    source_proxy = SourceProxy(name="self")
    perms = [
        Scope(ZonePerm("user", current=True), BlockPerm("plugin",
                                                        current=True))
    ]

    your_name = Field()
Beispiel #6
0
class DataModel(PluginDataModel):
    metric_proxy = MetricProxy(name="data")
    source_proxy = SourceProxy(name="self")
    perms = [
        Scope(ZonePerm("user", current=True), BlockPerm("plugin",
                                                        current=True))
    ]

    number = Field()
    text = Field()
Beispiel #7
0
class Checkins(PluginDataModel):
    metric_proxy = MetricProxy(name="checkins")
    source_proxy = SourceProxy(name="foursquare")
    perms = [Scope(ZonePerm("user", current=True), BlockPerm("plugin", all=True))]

    type = Field()
    source = Field()
    venue = Field()
    location = DictField()
    latitude = Field()
    longitude = Field()
    visit_count = FloatField()
    date = DateTimeField
Beispiel #8
0
class NewsFeed(PluginDataModel):
    metric_proxy = MetricProxy(name="newsfeed")
    source_proxy = SourceProxy(name="facebook")
    perms = [
        Scope(ZonePerm("user", current=True), BlockPerm("plugin", all=True))
    ]

    date = DateTimeField()
    update_time = DateTimeField()
    from_id = Field()
    from_name = Field()
    story = Field()
    type = Field()
    likes = ListField()
    comments = ListField()
    message = Field()
    name = Field()
    shares = IntegerField()
    picture = Field()
Beispiel #9
0
class BaseFitbitModel(PluginDataModel):
    metric_proxy = MetricProxy(name="newsfeed")
    source_proxy = SourceProxy(name="fitbit")

    date = DateTimeField()
    value = FloatField()
Beispiel #10
0
class SettingsModel(PluginDataModel):
    metric_proxy = MetricProxy(name="settings")
    source_proxy = SourceProxy(name="self")
    name = Field()
Beispiel #11
0
class TestModel(PluginDataModel):
    metric_proxy = MetricProxy(name="test1")
    source_proxy = SourceProxy(name='test1')

    number = IntegerField()
Beispiel #12
0
class TestLoosePermissions(PluginDataModel):
    metric_proxy = MetricProxy(name="test2")
    source_proxy = SourceProxy(name="test2")
    perms = [Scope(ZonePerm("user", all=True), BlockPerm("plugin", all=True))]