diff --git a/smartsheet/models/webhook.py b/smartsheet/models/webhook.py index 76708a8..cc88eff 100644 --- a/smartsheet/models/webhook.py +++ b/smartsheet/models/webhook.py @@ -56,7 +56,7 @@ def __init__(self, props=None, base_obj=None): self._stats = TypedObject(WebhookStats) self._status = String() self._version = Number() - self._subscope = WebhookSubscope() + self._subscope = TypedObject(WebhookSubscope) if props: deserialize(self, props) @@ -197,6 +197,14 @@ def status(self): def status(self, value): self._status.value = value + @property + def subscope(self): + return self._subscope.value + + @subscope.setter + def subscope(self, value): + self._subscope.value = value + @property def version(self): return self._version.value diff --git a/smartsheet/models/webhook_subscope.py b/smartsheet/models/webhook_subscope.py index b387be4..0f40af7 100644 --- a/smartsheet/models/webhook_subscope.py +++ b/smartsheet/models/webhook_subscope.py @@ -19,17 +19,19 @@ from ..types import * from ..util import serialize +from ..util import deserialize class WebhookSubscope(object): """Represents the webhook subscope object.""" - def __init__(self, column_ids=None): + def __init__(self, props=None): """Initialize the Webhook Subscope model.""" self._column_ids = TypedList(six.integer_types) - if column_ids is not None: - self._column_ids.load(column_ids) + + if props: + deserialize(self, props) @property def column_ids(self): diff --git a/tests/integration/test_webhooks.py b/tests/integration/test_webhooks.py index b7610ab..66f1f79 100644 --- a/tests/integration/test_webhooks.py +++ b/tests/integration/test_webhooks.py @@ -15,7 +15,7 @@ def test_create_webhook(self, smart_setup): webhook.scope_object_id = smart_setup['sheet'].id webhook.events.append('*.*') webhook.version = 1 - webhook.subscope = smart.models.WebhookSubscope(column_ids=[smart_setup['sheet'].columns[0].id]) + webhook.subscope = smart.models.WebhookSubscope({'column_ids': [smart_setup['sheet'].columns[0].id]}) action = smart.Webhooks.create_webhook(webhook) assert action.message == 'SUCCESS'