How to use the predicthq.endpoints.v1.signals.schemas.Signal function in predicthq

To help you get started, we’ve selected a few predicthq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github predicthq / sdk-py / tests / endpoints / v1 / signals_tests.py View on Github external
def test_create_via_signal(self, client, responses):
        signal = Signal()
        signal.name = "Test"
        signal.country = "NZ"
        signal.add_dimension("city", "category")
        signal.add_dimension("revenue", "number")
        result = signal.save(client.signals)
        self.assertIsInstance(result, Signal)
        self.assertIsInstance(result, SavedSignal)
        self.assertIsNotNone(result.id)
github predicthq / sdk-py / tests / endpoints / v1 / signals_tests.py View on Github external
def test_create_via_signal(self, client, responses):
        signal = Signal()
        signal.name = "Test"
        signal.country = "NZ"
        signal.add_dimension("city", "category")
        signal.add_dimension("revenue", "number")
        result = signal.save(client.signals)
        self.assertIsInstance(result, Signal)
        self.assertIsInstance(result, SavedSignal)
        self.assertIsNotNone(result.id)
github predicthq / sdk-py / tests / endpoints / v1 / signals_tests.py View on Github external
def test_get(self, client, responses):
        result = client.signals.get(id="zVNLr8tHvWQw")
        self.assertIsInstance(result, Signal)
        self.assertIsInstance(result, SavedSignal)
github predicthq / sdk-py / predicthq / endpoints / v1 / signals / endpoint.py View on Github external
    @accepts(Signal, query_string=False, role="create")
    @returns(SavedSignal)
    def create(self, **data):
        return self.client.post(self.build_url('v1', 'signals'), json=data)
github predicthq / sdk-py / predicthq / endpoints / v1 / signals / schemas.py View on Github external
def summary(self):
        return self._endpoint.dimensions(id=self.id)

    def analysis(self, **params):
        return self._endpoint.analysis(id=self.id, **params)


class NewSignal(Signal):

    class Options(Signal.Options):
        pass


class SavedSignal(SignalID, Signal):

    class Options(Signal.Options):
        pass


class SignalResultSet(ResultSet):

    results = ResultType(SavedSignal)


class DataPoint(Model):

    uid = StringType(required=True)
    date = DateTimeType(required=True)
    latitude = FloatType(min_value=-90, max_value=90, required=True)
    longitude = FloatType(min_value=-180, max_value=180, required=True)
    initiated = DateTimeType()
    completed = DateTimeType()
github predicthq / sdk-py / predicthq / endpoints / v1 / signals / schemas.py View on Github external
return self._endpoint.sink(id=self.id, data_points=data_points, chunk_size=chunk_size)

    def summary(self):
        return self._endpoint.dimensions(id=self.id)

    def analysis(self, **params):
        return self._endpoint.analysis(id=self.id, **params)


class NewSignal(Signal):

    class Options(Signal.Options):
        pass


class SavedSignal(SignalID, Signal):

    class Options(Signal.Options):
        pass


class SignalResultSet(ResultSet):

    results = ResultType(SavedSignal)


class DataPoint(Model):

    uid = StringType(required=True)
    date = DateTimeType(required=True)
    latitude = FloatType(min_value=-90, max_value=90, required=True)
    longitude = FloatType(min_value=-180, max_value=180, required=True)
github predicthq / sdk-py / predicthq / endpoints / v1 / signals / schemas.py View on Github external
return self._endpoint.create(self)

    def delete(self):
        self._endpoint.delete(id=self.id)

    def sink(self, data_points, chunk_size=1000):
        return self._endpoint.sink(id=self.id, data_points=data_points, chunk_size=chunk_size)

    def summary(self):
        return self._endpoint.dimensions(id=self.id)

    def analysis(self, **params):
        return self._endpoint.analysis(id=self.id, **params)


class NewSignal(Signal):

    class Options(Signal.Options):
        pass


class SavedSignal(SignalID, Signal):

    class Options(Signal.Options):
        pass


class SignalResultSet(ResultSet):

    results = ResultType(SavedSignal)