-
Notifications
You must be signed in to change notification settings - Fork 37
feat: get_optimizely_config API #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b46b95e
0f2cf5a
e2cccb8
4deaf60
6f2a79f
b7e25fb
7709dff
7a9cb08
15bcb76
720d350
ec4f84f
caad32d
1704ada
dcc7389
19bb7fd
2aa243c
a95c669
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,10 +45,10 @@ def __init__(self, id, key, feature_enabled, variables_map): | |
|
||
|
||
class OptimizelyVariable(object): | ||
def __init__(self, id, key, type, value): | ||
def __init__(self, id, key, variable_type, value): | ||
self.id = id | ||
self.key = key | ||
self.type = type | ||
self.type = variable_type | ||
self.value = value | ||
|
||
|
||
|
@@ -57,21 +57,22 @@ class OptimizelyConfigService(object): | |
|
||
def __init__(self, project_config): | ||
""" | ||
Arguments: | ||
Args: | ||
project_config ProjectConfig | ||
""" | ||
self.experiments = project_config.experiments | ||
self.feature_flags = project_config.feature_flags | ||
self.groups = project_config.groups | ||
self.revision = project_config.revision | ||
|
||
def get_optimizely_config(self): | ||
self._create_lookup_maps() | ||
|
||
def get_config(self): | ||
""" Returns instance of OptimizelyConfig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gets |
||
|
||
Returns: | ||
Optimizely Config instance. | ||
""" | ||
self._create_lookup_maps() | ||
|
||
experiments_key_map, experiments_id_map = self._get_experiments_maps() | ||
features_map = self._get_features_map(experiments_id_map) | ||
|
@@ -104,7 +105,7 @@ def _create_lookup_maps(self): | |
def _get_variables_map(self, variation, experiment): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit. I personally prefer arranging this as |
||
""" Gets variables map for given variation and experiment. | ||
|
||
Arguments: | ||
Args: | ||
variation dict | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is very vague. Dict consisting of what? |
||
experiment dict | ||
|
||
|
@@ -130,7 +131,7 @@ def _get_variables_map(self, variation, experiment): | |
def _get_variations_map(self, experiment): | ||
""" Gets variation map for the given experiment. | ||
|
||
Arguments: | ||
Args: | ||
experiment dict | ||
|
||
Returns: | ||
|
@@ -188,7 +189,7 @@ def _get_experiments_maps(self): | |
def _get_features_map(self, experiments_id_map): | ||
""" Gets features map for the project config. | ||
|
||
Arguments: | ||
Args: | ||
experiments_id_map dict -- experiment id to OptimizelyExperiment map | ||
|
||
Returns: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to check
instance
ofProjectConfig
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect to be used elsewhere. And in the main class, we validate project_config before using OptimizelyService. I can still validate if you so, but will have to keep a validity flag so that get_config returns nil and does not break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my suggestion is to validate but @aliabbasrizvi will you suggest for validation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @msohailhussain, we should validate here.