Skip to content

Commit c8cabbd

Browse files
add all decide objects
1 parent 61fe356 commit c8cabbd

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

optimizely/decision/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2020, Optimizely
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.

optimizely/decision/decide_option.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2020, Optimizely
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
15+
class DecideOption(object):
16+
DISABLE_DECISION_EVENT = 'DISABLE_DECISION_EVENT'
17+
ENABLED_FLAGS_ONLY = 'ENABLED_FLAGS_ONLY'
18+
IGNORE_USER_PROFILE_SERVICE = 'IGNORE_USER_PROFILE_SERVICE'
19+
INCLUDE_REASONS = 'INCLUDE_REASONS'
20+
EXCLUDE_VARIABLES = 'EXCLUDE_VARIABLES'

optimizely/decision/decision.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2020, Optimizely
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
15+
class Decision(object):
16+
def __init__(self, variation_key=None, enabled=None,
17+
variables=None, rule_key=None, flag_key=None, user_context=None, reasons=None):
18+
self.variation_key = variation_key
19+
self.enabled = enabled or False
20+
self.variables = variables or {}
21+
self.rule_key = rule_key
22+
self.flag_key = flag_key
23+
self.user_context = user_context
24+
self.reasons = reasons or []
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2020, Optimizely
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
15+
class DecisionMessage(object):
16+
SDK_NOT_READY = 'Optimizely SDK not configured properly yet.'
17+
FLAG_KEY_INVALID = 'No flag was found for key "%s".'
18+
VARIABLE_VALUE_INVALID = 'Variable value for key "%s" is invalid or wrong type.'

0 commit comments

Comments
 (0)