-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DepartureComponents resource, upped version to 0.1.41
New resource which provides detailed data about the components which make up a purchased departure. See official documentation for more details: https://developers.gadventures.com/docs/departure_component.html
- Loading branch information
Showing
6 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__version__ = '0.1.40' | ||
__version__ = '0.1.41' | ||
__title__ = 'gapipy' | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from __future__ import unicode_literals | ||
|
||
from ...models.base import BaseModel | ||
from ...utils import get_resource_class_from_resource_name | ||
from ..base import Resource | ||
|
||
class AssociatedDossier(BaseModel): | ||
_as_is_fields = ["type"] | ||
_model_fields = [ | ||
("dossier", object), | ||
] | ||
|
||
def _set_model_field(self, field, value): | ||
resource_cls = get_resource_class_from_resource_name(self.type) | ||
stub = resource_cls(value, stub=True) | ||
setattr(self, field, stub) | ||
|
||
class DepartureComponent(Resource): | ||
_resource_name = 'departure_components' | ||
_is_listable = True | ||
_is_parent_resource = False | ||
|
||
_as_is_fields = [ | ||
"id", "href", "name", "code", "type", "flags", | ||
] | ||
|
||
_date_fields = ["start_date"] | ||
_date_time_fields_utc = ["date_created", "date_last_modified"] | ||
|
||
_model_fields = [ | ||
("associated_dossier", AssociatedDossier), | ||
] |