From 7e62a69177c80888585fbadd2224d84d64ddbc51 Mon Sep 17 00:00:00 2001 From: Daniil Belyakov Date: Tue, 15 Aug 2017 17:22:06 +0200 Subject: [PATCH] Little cleanup --- bunq/sdk/context.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/bunq/sdk/context.py b/bunq/sdk/context.py index 34311f8..f685ed2 100644 --- a/bunq/sdk/context.py +++ b/bunq/sdk/context.py @@ -254,27 +254,6 @@ def session_context(self): return self._session_context - def to_json(self): - """ - Serializes an ApiContext to JSON string - - :rtype: str - """ - - return converter.class_to_json(self) - - @classmethod - def from_json(cls, data): - """ - Creates an ApiContext instance from JSON string. - - :type data: str - - :rtype: ApiContext - """ - - return converter.json_to_class(ApiContext, data) - def save(self, path=None): """ :type path: str @@ -288,6 +267,15 @@ def save(self, path=None): with open(path, self._FILE_MODE_WRITE) as file_: file_.write(self.to_json()) + def to_json(self): + """ + Serializes an ApiContext to JSON string. + + :rtype: str + """ + + return converter.class_to_json(self) + @classmethod def restore(cls, path=None): """ @@ -301,6 +289,18 @@ def restore(cls, path=None): with open(path, cls._FILE_MODE_READ) as file_: return cls.from_json(file_.read()) + + @classmethod + def from_json(cls, json_str): + """ + Creates an ApiContext instance from JSON string. + + :type json_str: str + + :rtype: ApiContext + """ + + return converter.json_to_class(ApiContext, json_str) def __eq__(self, other): return (self.token == other.token and