Skip to content

Commit 95a6c4d

Browse files
committed
Release 2.26.0 (2020-04-14)
-------------------- ! BREAKING CHANGES ! -------------------- * The ``Query.filter`` method will return a clone/copy of itself. This will preserve the state of ``filters`` on the original Query object. * The ``Query.all`` method will **not** clear the filters after returning. * The ``Query.all`` method will return a ``TypeError`` if a type other than an ``int`` is passed to the ``limit`` argument. * The ``Query.count`` method will **not** clear the filters after returning. * see: #121 * The ``AgencyChain.agencies`` field will be returned as a list of Resource objects * see: f34afd52
1 parent 9ca3f1e commit 95a6c4d

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

HISTORY.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
33
History
44
=======
55

6+
2.26.0 (2020-04-14)
7+
-------------------
8+
9+
**Breaking Changes**
10+
11+
* The ``Query.filter`` method will return a clone/copy of itself. This will
12+
preserve the state of ``filters`` on the original Query object.
13+
* The ``Query.all`` method will **not** clear the filters after returning.
14+
* The ``Query.all`` method will return a ``TypeError`` if a type other than
15+
an ``int`` is passed to the ``limit`` argument.
16+
* The ``Query.count`` method will **not** clear the filters after returning.
17+
* see: https://github.com/gadventures/gapipy/pull/121
18+
19+
New behaviour with the ``Query.filter`` method
20+
21+
.. code-block:: python
22+
23+
>>> from gapipy import Client
24+
>>> api = Client(application_key='MY_SECRET_KEY')
25+
26+
# create a filter on the departures
27+
>>> query = api.departures.filter(**{"tour_dossier.id": "24309"})
28+
>>> query.count()
29+
494
30+
31+
# we preserve the filter status of the current query
32+
>>> query.filter(**{"availability.status": "AVAILABLE"}).count()
33+
80
34+
35+
>>> query.count()
36+
494
37+
38+
* The ``AgencyChain.agencies`` field will be returned as a list of Resource objects
39+
* see: https://github.com/gadventures/gapipy/commit/f34afd52
40+
41+
642
2.25.1 (2020-01-02)
743
-------------------
844

README.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Quick Start
4444
>>> booking.external_id = 'def'
4545
>>> booking.save()
4646
47+
48+
Since `2.25.1 (2020-01-02)`_
49+
50+
.. code-block:: python
51+
4752
>>> # since 2.25.0 reference stubs that fail to fetch will return a
4853
4954
>>> # subclass of requests.HTTPError (See: https://github.com/gadventures/gapipy/pull/119)
@@ -119,9 +124,16 @@ only supported for queries whose resources are listable.
119124
Generator over all resources in the current query. If ``limit`` is a
120125
positive integer ``n``, then only the first ``n`` results will be returned.
121126

127+
* A ``TypeError`` will be raised if limit is not ``None`` or ``int`` type
128+
* A ``ValueError`` will be raised if ``limit <= 0``>
129+
122130
``filter(field1=value1, [field2=value2, ...])``
131+
``filter(**{"nested.field": "value", "field": "anothervalue"})``
132+
123133
Filter resources on the provided fields and values. Calls to ``filter`` can
124-
be chained.
134+
be chained. The method will return a clone of the ``Query`` object and must
135+
be stored in a separate variable in order to have access to **stacked**
136+
filters.
125137

126138
``count()``
127139
Return the number of resources in the current query (by reading the

gapipy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = '2.25.1'
3+
__version__ = '2.26.0'
44
__title__ = 'gapipy'
55

66
from .client import Client # NOQA

0 commit comments

Comments
 (0)