Skip to content

Commit 2fb8645

Browse files
committed
Refactored the json/adapters.
1 parent 9131d9e commit 2fb8645

14 files changed

+696
-662
lines changed

bunq/__init__.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,51 @@ def initialize_converter():
1313

1414
from bunq.sdk.http import api_client
1515
from bunq.sdk.context import api_context
16-
from bunq.sdk.json import adapters
1716
from bunq.sdk.json import converter
1817
from bunq.sdk.model.generated import object_
1918
from bunq.sdk.model.generated import endpoint
2019
from bunq.sdk.model.core.installation import Installation
2120
from bunq.sdk.model.core.session_server import SessionServer
21+
from bunq.sdk.json.installation_adapter import InstallationAdapter
22+
from bunq.sdk.json.session_server_adapter import SessionServerAdapter
23+
from bunq.sdk.json.installation_context_adapter import InstallationContextAdapter
24+
from bunq.sdk.json.api_environment_type_adapter import ApiEnvironmentTypeAdapter
25+
from bunq.sdk.json.float_adapter import FloatAdapter
26+
from bunq.sdk.json.geolocation_adapter import GeolocationAdapter
27+
from bunq.sdk.json.monetary_account_reference_adapter import MonetaryAccountReferenceAdapter
28+
from bunq.sdk.json.share_detail_adapter import ShareDetailAdapter
29+
from bunq.sdk.json.date_time_adapter import DateTimeAdapter
30+
from bunq.sdk.json.pagination_adapter import PaginationAdapter
2231

23-
converter.register_adapter(Installation, adapters.InstallationAdapter)
32+
converter.register_adapter(Installation, InstallationAdapter)
2433
converter.register_adapter(
2534
SessionServer,
26-
adapters.SessionServerAdapter
35+
SessionServerAdapter
2736
)
2837
converter.register_adapter(
2938
api_context.InstallationContext,
30-
adapters.InstallationContextAdapter
39+
InstallationContextAdapter
3140
)
3241
converter.register_adapter(
3342
api_context.ApiEnvironmentType,
34-
adapters.ApiEnvironmentTypeAdapter
43+
ApiEnvironmentTypeAdapter
3544
)
36-
converter.register_adapter(float, adapters.FloatAdapter)
37-
converter.register_adapter(object_.Geolocation, adapters.GeolocationAdapter)
45+
converter.register_adapter(float, FloatAdapter)
46+
converter.register_adapter(object_.Geolocation, GeolocationAdapter)
3847
converter.register_adapter(
3948
object_.MonetaryAccountReference,
40-
adapters.MonetaryAccountReferenceAdapter
49+
MonetaryAccountReferenceAdapter
4150
)
42-
converter.register_adapter(object_.ShareDetail, adapters.ShareDetailAdapter)
43-
converter.register_adapter(datetime.datetime, adapters.DateTimeAdapter)
44-
converter.register_adapter(Pagination, adapters.PaginationAdapter)
51+
converter.register_adapter(object_.ShareDetail, ShareDetailAdapter)
52+
converter.register_adapter(datetime.datetime, DateTimeAdapter)
53+
converter.register_adapter(Pagination, PaginationAdapter)
4554

4655
def register_anchor_adapter(class_to_register):
4756
if issubclass(class_to_register, AnchoredObjectInterface):
57+
from bunq.sdk.json.anchored_object_model_adapter import AnchoredObjectModelAdapter
4858
converter.register_adapter(
4959
class_to_register,
50-
adapters.AnchoredObjectModelAdapter
60+
AnchoredObjectModelAdapter
5161
)
5262

5363
def get_class(class_string_to_get):

bunq/sdk/http/api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def _fetch_response_id(self, response):
285285
if self.HEADER_RESPONSE_ID_LOWER_CASED in headers:
286286
return headers[self.HEADER_RESPONSE_ID_LOWER_CASED]
287287

288-
return self._ERROR_COULD_NOT_DETERMINE_RESPONSE_ID_HEADER;
288+
return self._ERROR_COULD_NOT_DETERMINE_RESPONSE_ID_HEADER
289289

290290
def put(self, uri_relative, request_bytes, custom_headers):
291291
"""
@@ -335,4 +335,4 @@ def delete(self, uri_relative, custom_headers):
335335
self._BYTES_EMPTY,
336336
{},
337337
custom_headers
338-
)
338+
)

0 commit comments

Comments
 (0)