Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit 6a785be

Browse files
authored
Merge pull request #136 from smartsheet-platform/tw-updates
r83 updates
2 parents c41a86d + 3821d58 commit 6a785be

File tree

11 files changed

+789
-41
lines changed

11 files changed

+789
-41
lines changed

smartsheet/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
from .sheet_filter import SheetFilter
9696
from .sheet_filter_details import SheetFilterDetails
9797
from .sheet_publish import SheetPublish
98+
from .sheet_summary import SheetSummary
9899
from .sheet_user_settings import SheetUserSettings
99100
from .shortcut_data_item import ShortcutDataItem
100101
from .sight import Sight
@@ -103,6 +104,7 @@
103104
from .sort_specifier import SortSpecifier
104105
from .source import Source
105106
from .string_object_value import StringObjectValue
107+
from .summary_field import SummaryField
106108
from .template import Template
107109
from .update_request import UpdateRequest
108110
from .user import User

smartsheet/models/cell.py

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@
1818
from __future__ import absolute_import
1919

2020
from .cell_link import CellLink
21+
from .explicit_null import ExplicitNull
2122
from .hyperlink import Hyperlink
2223
from .image import Image
23-
from .object_value import *
24-
from .duration import Duration
25-
from .predecessor_list import PredecessorList
26-
from .contact_object_value import ContactObjectValue
27-
from .multi_contact_object_value import MultiContactObjectValue
28-
from .date_object_value import DateObjectValue
29-
from .string_object_value import StringObjectValue
30-
from .number_object_value import NumberObjectValue
31-
from .boolean_object_value import BooleanObjectValue
24+
from ..object_value import assign_to_object_value
3225
from ..types import *
3326
from ..util import serialize
3427
from ..util import deserialize
@@ -162,36 +155,7 @@ def object_value(self):
162155

163156
@object_value.setter
164157
def object_value(self, value):
165-
if isinstance(value, ObjectValue):
166-
self._object_value = value
167-
elif isinstance(value, dict):
168-
object_type = value['objectType']
169-
if object_type in OBJECT_VALUE['object_type']:
170-
enum_object_type = enum_object_value_type(object_type)
171-
if enum_object_type == DURATION:
172-
self._object_value = Duration(value, self._base)
173-
elif enum_object_type == PREDECESSOR_LIST:
174-
self._object_value = PredecessorList(value, self._base)
175-
elif enum_object_type == CONTACT:
176-
self._object_value = ContactObjectValue(value, self._base)
177-
elif enum_object_type == DATE or enum_object_type == DATETIME or \
178-
enum_object_type == ABSTRACT_DATETIME:
179-
self._object_value = DateObjectValue(value, enum_object_value_type, self._base)
180-
elif enum_object_type == MULTI_CONTACT:
181-
self._object_value = MultiContactObjectValue(value, self._base)
182-
else:
183-
self._object_value = None
184-
else:
185-
raise ValueError(
186-
("`{0}` is an invalid value for ObjectValue`object_type`,"
187-
" must be one of {1}").format(
188-
object_type, OBJECT_VALUE['object_type']))
189-
elif isinstance(value, six.string_types):
190-
self._object_value = StringObjectValue(value)
191-
elif isinstance(value, (six.integer_types, float)):
192-
self._object_value = NumberObjectValue(value)
193-
elif isinstance(value, bool):
194-
self._object_value = BooleanObjectValue(value)
158+
self._object_value = assign_to_object_value(value)
195159

196160
@property
197161
def override_validation(self):

smartsheet/models/search_result_item.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(self, props=None, base_obj=None):
4040
'folder',
4141
'workspace',
4242
'sight',
43+
'summaryField',
4344
'template',
4445
'discussion',
4546
'attachment'],

smartsheet/models/sheet.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
from .enums import AccessLevel, AttachmentType
2828
from .project_settings import ProjectSettings
2929
from .row import Row
30+
from .sheet_summary import SheetSummary
31+
from .sheet_user_permissions import SheetUserPermissions
3032
from .sheet_user_settings import SheetUserSettings
3133
from .source import Source
3234
from ..types import *
@@ -61,6 +63,7 @@ def __init__(self, props=None, base_obj=None):
6163
self._filters = TypedList(SheetFilter)
6264
self._from_id = Number()
6365
self._gantt_enabled = Boolean()
66+
self._has_summary_fields = Boolean()
6467
self._id_ = Number()
6568
self._modified_at = Timestamp()
6669
self._name = String()
@@ -73,7 +76,9 @@ def __init__(self, props=None, base_obj=None):
7376
self._rows = TypedList(Row)
7477
self._show_parent_rows_for_filters = Boolean()
7578
self._source = TypedObject(Source)
79+
self._summary = TypedObject(SheetSummary)
7680
self._total_row_count = Number()
81+
self._user_permissions = TypedObject(SheetUserPermissions)
7782
self._user_settings = TypedObject(SheetUserSettings)
7883
self._version = Number()
7984
self._workspace = TypedObject(Workspace)
@@ -201,6 +206,14 @@ def gantt_enabled(self):
201206
def gantt_enabled(self, value):
202207
self._gantt_enabled.value = value
203208

209+
@property
210+
def has_summary_fields(self):
211+
return self._has_summary_fields.value
212+
213+
@has_summary_fields.setter
214+
def has_summary_fields(self, value):
215+
self._has_summary_fields.value = value
216+
204217
@property
205218
def id_(self):
206219
return self._id_.value
@@ -297,6 +310,14 @@ def source(self):
297310
def source(self, value):
298311
self._source.value = value
299312

313+
@property
314+
def summary(self):
315+
return self._summary.value
316+
317+
@summary.setter
318+
def summary(self, value):
319+
self._summary.value = value
320+
300321
@property
301322
def total_row_count(self):
302323
return self._total_row_count.value
@@ -305,6 +326,14 @@ def total_row_count(self):
305326
def total_row_count(self, value):
306327
self._total_row_count.value = value
307328

329+
@property
330+
def user_permissions(self):
331+
return self._user_permissions.value
332+
333+
@user_permissions.setter
334+
def user_permissions(self, value):
335+
self._user_permissions.value = value
336+
308337
@property
309338
def user_settings(self):
310339
return self._user_settings.value

smartsheet/models/sheet_summary.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
2+
# Smartsheet Python SDK.
3+
#
4+
# Copyright 2019 Smartsheet.com, Inc.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License"): you may
7+
# not use this file except in compliance with the License. You may obtain
8+
# a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
# License for the specific language governing permissions and limitations
16+
# under the License.
17+
18+
from __future__ import absolute_import
19+
20+
from ..types import *
21+
from ..util import serialize
22+
from ..util import deserialize
23+
from .summary_field import SummaryField
24+
25+
26+
class SheetSummary(object):
27+
28+
"""Smartsheet SheetSummary data model."""
29+
30+
def __init__(self, props=None, base_obj=None):
31+
"""Initialize the SheetSummary model."""
32+
self._base = None
33+
if base_obj is not None:
34+
self._base = base_obj
35+
36+
self._fields = TypedList(SummaryField)
37+
38+
if props:
39+
deserialize(self, props)
40+
41+
# requests package Response object
42+
self.request_response = None
43+
self.__initialized = True
44+
45+
@property
46+
def fields(self):
47+
return self._fields
48+
49+
@fields.setter
50+
def fields(self, value):
51+
self._fields.load(value)
52+
53+
def to_dict(self):
54+
return serialize(self)
55+
56+
def to_json(self):
57+
return json.dumps(self.to_dict())
58+
59+
def __str__(self):
60+
return self.to_json()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
2+
# Smartsheet Python SDK.
3+
#
4+
# Copyright 2019 Smartsheet.com, Inc.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License"): you may
7+
# not use this file except in compliance with the License. You may obtain
8+
# a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
# License for the specific language governing permissions and limitations
16+
# under the License.
17+
18+
from __future__ import absolute_import
19+
20+
from ..types import *
21+
from ..util import serialize
22+
from ..util import deserialize
23+
24+
25+
class SheetUserPermissions(object):
26+
27+
"""Smartsheet SheetUserPermissions data model."""
28+
29+
def __init__(self, props=None, base_obj=None):
30+
"""Initialize the SheetUserPermissions model."""
31+
self._base = None
32+
if base_obj is not None:
33+
self._base = base_obj
34+
35+
self._summary_permissions = String()
36+
37+
if props:
38+
deserialize(self, props)
39+
40+
# requests package Response object
41+
self.request_response = None
42+
self.__initialized = True
43+
44+
@property
45+
def summary_permissions(self):
46+
return self._summary_permissions.value
47+
48+
@summary_permissions.setter
49+
def summary_permissions(self, value):
50+
self._summary_permissions.value = value
51+
52+
def to_dict(self):
53+
return serialize(self)
54+
55+
def to_json(self):
56+
return json.dumps(self.to_dict())
57+
58+
def __str__(self):
59+
return self.to_json()

0 commit comments

Comments
 (0)