-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): Add endpoints to handle API update ignores (#1693)
Provides two endpoints, a getter and setter, to handle returning the currently ignored update
- Loading branch information
1 parent
aeb1785
commit 8c5eae9
Showing
4 changed files
with
108 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import json | ||
import os | ||
|
||
PATH = os.path.abspath(os.path.dirname(__file__)) | ||
filepath = os.path.join(PATH, 'ignore.json') | ||
|
||
|
||
def _set_ignored_version(version): | ||
""" | ||
Private helper function that writes the most updated | ||
API version that was ignored by a user in the app | ||
:param version: Most recent ignored API update | ||
""" | ||
data = {'version': version} | ||
with open(filepath, 'w') as data_file: | ||
json.dump(data, data_file) | ||
|
||
|
||
def _get_ignored_version(): | ||
""" | ||
:return: Most recently ignored API version | ||
""" | ||
if os.path.exists(filepath): | ||
with open(filepath) as data_file: | ||
data = json.load(data_file) | ||
version = data.get('version') | ||
else: | ||
version = None | ||
return version |
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