Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion smartsheet/models/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions smartsheet/models/webhook_subscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down