Skip to content
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
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Release History
- ``client.get_memberships(...)`` has a change in signature. The limit and offset parameters have swapped positions to keep
consistency with the rest of the SDK.
- ``client.groups(...)`` has been changed to ``client.get_groups``. The limit and offset parameters have swapped positions.
- The ``unshared_at`` parameter for ``item.create_shared_link(...)`` and ``file.get_shared_link_download_url(...)``
now takes an `RFC3339-formatted <https://tools.ietf.org/html/rfc3339#section-5.8>` ``unicode`` string instead of a
``datetime.date``. Users migrating from v1.x can pass the value of ``date.isoformat()`` instead of the ``date``
object itself.
- ``Events.get_events(...)`` now returns a list of ``Event`` instances rather than a list of ``dict``
representing events. ``Event`` inherits from ``Mapping`` but will not have all the same capabilities as
``dict``.
Expand Down
6 changes: 4 additions & 2 deletions boxsdk/object/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,11 @@ def get_shared_link_download_url(
`unicode` or None
:param unshared_at:
The date on which this link should be disabled. May only be set if the current user is not a free user
and has permission to set expiration dates.
and has permission to set expiration dates. Takes an RFC3339-formatted string, e.g.
'2018-10-31T23:59:59-07:00' for 11:59:59 PM on October 31, 2018 in the America/Los_Angeles timezone.
The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
:type unshared_at:
:class:`datetime.date` or None
`unicode` or None
:param allow_preview:
Whether or not the item being shared can be previewed when accessed via the shared link.
If this parameter is None, the default setting will be used.
Expand Down
8 changes: 5 additions & 3 deletions boxsdk/object/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,11 @@ def create_shared_link(
`unicode` or None
:param unshared_at:
The date on which this link should be disabled. May only be set if the current user is not a free user
and has permission to set expiration dates.
and has permission to set expiration dates. Takes an RFC3339-formatted string, e.g.
'2018-10-31T23:59:59-07:00' for 11:59:59 PM on October 31, 2018 in the America/Los_Angeles timezone.
The time portion can be omitted, which defaults to midnight (00:00:00) on that date.
:type unshared_at:
:class:`datetime.date` or None
`unicode` or None
:param allow_download:
Whether or not the item being shared can be downloaded when accessed via the shared link.
If this parameter is None, the default setting will be used.
Expand Down Expand Up @@ -225,7 +227,7 @@ def create_shared_link(
}

if unshared_at is not None:
data['shared_link']['unshared_at'] = unshared_at.isoformat()
data['shared_link']['unshared_at'] = unshared_at

if allow_download is not None or allow_preview is not None:
data['shared_link']['permissions'] = permissions = {}
Expand Down
3 changes: 1 addition & 2 deletions test/unit/object/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding: utf-8

from __future__ import unicode_literals
from datetime import date
import os
from mock import Mock
import pytest
Expand Down Expand Up @@ -325,7 +324,7 @@ def shared_link_password(request):
return request.param


@pytest.fixture(params=(date(2015, 5, 5), None))
@pytest.fixture(params=('2018-10-31', '2018-10-31T23:59:59-07:00', None))
def shared_link_unshared_at(request):
return request.param

Expand Down
2 changes: 1 addition & 1 deletion test/unit/object/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def test_get_shared_link_download_url(
if shared_link_access is not None:
expected_data['shared_link']['access'] = shared_link_access
if shared_link_unshared_at is not None:
expected_data['shared_link']['unshared_at'] = shared_link_unshared_at.isoformat()
expected_data['shared_link']['unshared_at'] = shared_link_unshared_at
if shared_link_can_preview is not None:
expected_data['shared_link']['permissions'] = permissions = {}
permissions['can_preview'] = shared_link_can_preview
Expand Down
2 changes: 1 addition & 1 deletion test/unit/object/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_get_shared_link(
if shared_link_access is not None:
expected_data['shared_link']['access'] = shared_link_access
if shared_link_unshared_at is not None:
expected_data['shared_link']['unshared_at'] = shared_link_unshared_at.isoformat()
expected_data['shared_link']['unshared_at'] = shared_link_unshared_at
if shared_link_can_download is not None or shared_link_can_preview is not None:
expected_data['shared_link']['permissions'] = permissions = {}
if shared_link_can_download is not None:
Expand Down