Skip to content

Commit

Permalink
feat(settings): add validation for required fields method
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarrascosa committed Feb 27, 2021
1 parent e2ed7e3 commit 36d4d06
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions FaceitIntegration/lib/script_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
'output_file'
]

CORE_REQUIRED_KEYS = [
'faceit_api_key'
]


class FaceitIntegrationSettings(object):
def __init__(self, settings_file=None):
Expand Down Expand Up @@ -38,3 +42,13 @@ def save(self, settings_file, script_name='', parent=None):

def load_settings(self, json_data):
self.__dict__ = json.loads(json_data, encoding="utf-8")

def validate_core_fields(self):
"""
:return: bool
"""
return_value = True
for key in CORE_REQUIRED_KEYS:
return_value = return_value if return_value and self.__getattribute__(key) else False
return return_value

0 comments on commit 36d4d06

Please sign in to comment.