Skip to content

Commit 7e62a69

Browse files
authored
Little cleanup
1 parent 60440e0 commit 7e62a69

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

bunq/sdk/context.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -254,27 +254,6 @@ def session_context(self):
254254

255255
return self._session_context
256256

257-
def to_json(self):
258-
"""
259-
Serializes an ApiContext to JSON string
260-
261-
:rtype: str
262-
"""
263-
264-
return converter.class_to_json(self)
265-
266-
@classmethod
267-
def from_json(cls, data):
268-
"""
269-
Creates an ApiContext instance from JSON string.
270-
271-
:type data: str
272-
273-
:rtype: ApiContext
274-
"""
275-
276-
return converter.json_to_class(ApiContext, data)
277-
278257
def save(self, path=None):
279258
"""
280259
:type path: str
@@ -288,6 +267,15 @@ def save(self, path=None):
288267
with open(path, self._FILE_MODE_WRITE) as file_:
289268
file_.write(self.to_json())
290269

270+
def to_json(self):
271+
"""
272+
Serializes an ApiContext to JSON string.
273+
274+
:rtype: str
275+
"""
276+
277+
return converter.class_to_json(self)
278+
291279
@classmethod
292280
def restore(cls, path=None):
293281
"""
@@ -301,6 +289,18 @@ def restore(cls, path=None):
301289

302290
with open(path, cls._FILE_MODE_READ) as file_:
303291
return cls.from_json(file_.read())
292+
293+
@classmethod
294+
def from_json(cls, json_str):
295+
"""
296+
Creates an ApiContext instance from JSON string.
297+
298+
:type json_str: str
299+
300+
:rtype: ApiContext
301+
"""
302+
303+
return converter.json_to_class(ApiContext, json_str)
304304

305305
def __eq__(self, other):
306306
return (self.token == other.token and

0 commit comments

Comments
 (0)