Skip to content

Commit

Permalink
Merge branch 'release/0.12.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Nov 15, 2017
2 parents 4907492 + 618f363 commit a1dd162
Show file tree
Hide file tree
Showing 26 changed files with 4,577 additions and 1,947 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.2
0.12.3
2 changes: 1 addition & 1 deletion bunq/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ApiClient(object):
HEADER_AUTHENTICATION = 'X-Bunq-Client-Authentication'

# Default header values
_USER_AGENT_BUNQ = 'bunq-sdk-python/0.12.2'
_USER_AGENT_BUNQ = 'bunq-sdk-python/0.12.3'
_GEOLOCATION_ZERO = '0 0 0 0 NL'
_LANGUAGE_EN_US = 'en_US'
_REGION_NL_NL = 'nl_NL'
Expand Down
19 changes: 15 additions & 4 deletions bunq/sdk/json/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from bunq.sdk import client
from bunq.sdk import context
from bunq.sdk.model import core
from bunq.sdk import security
from bunq.sdk.json import converter
from bunq.sdk.model import core
from bunq.sdk.model.generated import endpoint
from bunq.sdk.model.generated import object_

Expand Down Expand Up @@ -387,20 +387,31 @@ def deserialize(cls, target_class, obj):
share_detail.__dict__ = {
cls._ATTRIBUTE_PAYMENT: converter.deserialize(
object_.ShareDetailPayment,
obj[cls._FIELD_PAYMENT]
cls._get_field_or_none(cls._FIELD_DRAFT_PAYMENT, obj)
),
cls._ATTRIBUTE_READ_ONLY: converter.deserialize(
object_.ShareDetailReadOnly,
obj[cls._FIELD_READ_ONLY]
cls._get_field_or_none(cls._FIELD_READ_ONLY, obj)
),
cls._ATTRIBUTE_DRAFT_PAYMENT: converter.deserialize(
object_.ShareDetailDraftPayment,
obj[cls._FIELD_DRAFT_PAYMENT]
cls._get_field_or_none(cls._FIELD_DRAFT_PAYMENT, obj)
),
}

return share_detail

@staticmethod
def _get_field_or_none(field, obj):
"""
:type field: str
:type obj: dict
:return: dict|None
"""

return obj[field] if field in obj else None

@classmethod
def serialize(cls, share_detail):
"""
Expand Down
2 changes: 1 addition & 1 deletion bunq/sdk/json/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class JsonAdapter(object):
_WARNING_KEY_UNKNOWN = '[bunq SDK beta] Key "{}" in "{}" is unknown.'

# Overlapping key names to be suffixed by and underscore
_KEYS_OVERLAPPING = {'id', 'type'}
_KEYS_OVERLAPPING = {'id', 'type', 'object'}

# Suffix to strip from the keys during serialization
_SUFFIX_KEY_OVERLAPPING = '_'
Expand Down
5 changes: 2 additions & 3 deletions bunq/sdk/model/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from bunq.sdk import client
from bunq.sdk import context
from bunq.sdk.json import converter


Expand Down Expand Up @@ -269,7 +268,7 @@ def server_public_key(self):
@classmethod
def create(cls, api_context, public_key_string):
"""
:type api_context: context.ApiContext
:type api_context: bunq.sdk.context.ApiContext
:type public_key_string: str
:rtype: client.BunqResponse[Installation]
Expand Down Expand Up @@ -353,7 +352,7 @@ def user_company(self):
@classmethod
def create(cls, api_context):
"""
:type api_context: context.ApiContext
:type api_context: bunq.sdk.context.ApiContext
:rtype: client.BunqResponse[SessionServer]
"""
Expand Down
Loading

0 comments on commit a1dd162

Please sign in to comment.