Skip to content

Commit 309336d

Browse files
kelseymorris95jmoldow
authored andcommitted
Docs update (#159)
Update HISTORY and README for new release.
1 parent 3e7b673 commit 309336d

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

HISTORY.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@ Release History
66
Upcoming
77
++++++++
88

9+
New Release?
10+
++++++++++++++++++
11+
12+
**Breaking Changes**
13+
14+
- ``Events.get_events(...)`` now returns a list of ``Event`` instances rather than a list of ``dict``
15+
representing events. ``Event`` inherits from ``Mapping`` but will not have all the same capabilities as
16+
``dict``.
17+
18+
+ Your code is affected if you use ``Events.get_events(...)`` and expect a list of ``dict`` rather than a list of
19+
``Mapping``. For example, if you use ``__setitem__`` (``event['key'] = value``), ``update()``, ``copy()``, or
20+
if your code depends on the ``str`` or ``repr`` of the ``Event``. Use of ``__getitem__`` (``event['key']``),
21+
``get()``, and other ``Mapping`` methods is unaffected. See
22+
https://docs.python.org/2.7/library/collections.html#collections-abstract-base-classes for methods supported on
23+
``Mapping`` instances.
24+
25+
+ Migration: If you still need to treat an ``Event`` as a ``dict``, you can get a deepcopy of the original ``dict``
26+
using the new property on ``BaseAPIJSONObject``, ``response_object``.
27+
28+
**Features**
29+
30+
- Added ability to create custom subclasses of SDK objects with ``_item_type`` defined.
31+
- Added an ``Event`` class.
32+
33+
**Other**
34+
35+
- Added extra information to ``BoxAPIException``.
36+
- Added ``collaboration()`` method to ``Client``.
37+
- Reworked the class hierarchy. Previously, ``BaseEndpoint`` was the parent of ``BaseObject`` which was the parent
38+
of all smart objects. Now ``BaseObject`` is a child of both ``BaseEndpoint`` and ``BaseAPIJSONObject``.
39+
``BaseObject`` is the parent of all objects that are a part of the REST API. Another subclass of
40+
``BaseAPIJSONObject``, ``APIJSONObject``, was created to represent pseudo-smart objects such as ``Event`` that are not
41+
directly accessible through an API endpoint.
42+
943
1.5.3
1044
++++++++++++++++++
1145

README.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,32 @@ Development Client
390390
For exploring the Box API, or to quickly get going using the SDK, the ``DevelopmentClient`` class combines the
391391
``LoggingClient`` with the ``DeveloperTokenClient``.
392392

393+
Customization
394+
-------------
395+
396+
Custom Subclasses
397+
~~~~~~~~~~~~~~~~~
398+
399+
Custom subclasses of any SDK object with an ``_item_type`` field can be defined:
400+
401+
.. code-block:: pycon
402+
403+
from boxsdk import Client
404+
from boxsdk import Folder
405+
406+
class MyFolderSubclass(Folder):
407+
pass
408+
409+
client = Client(oauth)
410+
folder = client.folder('0')
411+
412+
>>> print folder
413+
>>> <Box MyFolderSubclass - 0>
414+
415+
If a subclass of an SDK object with an ``_item_type`` field is defined, instances of this subclass will be
416+
returned from all SDK methods that previously returned an instance of the parent. See ``BaseAPIJSONObjectMeta``
417+
and ``Translator`` to see how the SDK performs dynamic lookups to determine return types.
418+
393419
Contributing
394420
------------
395421

0 commit comments

Comments
 (0)