Skip to content

Commit 14ae0a6

Browse files
authored
Merge pull request #13 from splitio/add_title_and_comment_when_removing_split_from_env
Add title and comment when removing split from env
2 parents bcd1dbc + 44b98da commit 14ae0a6

File tree

7 files changed

+23
-12
lines changed

7 files changed

+23
-12
lines changed

CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@
2121
3.1.5 (Sept 8th, 2022)
2222
- Added `import_attributes_from_json` for trafficType object
2323
3.1.6 (Nov 2nd, 2022)
24-
- Added `baselineTreatment` for splitDefinition object
24+
- Added `baselineTreatment` for splitDefinition object
25+
3.1.7 (Mar 2nd, 2023)
26+
- Added `comment` and `title` as optional parameters for the `remove_from_environment` method of a Split
27+
- Updated default logging to be more useful

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ addopts = --verbose
66

77
[metadata]
88
name = splitapiclient
9-
version = 3.1.6
9+
version = 3.1.7
1010
description = This Python Library provide full support for Split REST Admin API, allow creating, deleting and editing Environments, Splits, Split Definitions, Segments, Segment Keys, Users, Groups, API Keys, Change Requests, Attributes and Identities
1111
long_description = file: README.md
1212
long_description_content_type = text/markdown

splitapiclient/http_clients/sync_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _handle_invalid_response(self, response):
5555
if exc:
5656
raise exc()
5757
else:
58-
raise HTTPResponseError()
58+
raise HTTPResponseError(response.text)
5959

6060
def _handle_connection_error(self, e):
6161
'''

splitapiclient/microclients/split_microclient.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class SplitMicroClient:
7878
},
7979
'remove_from_environment': {
8080
'method': 'DELETE',
81-
'url_template': ('splits/ws/{workspaceId}/{splitName}/environments/{environmentId}'),
81+
'url_template': ('splits/ws/{workspaceId}/{splitName}/environments/{environmentId}?title={title}&comment={comment}'),
8282
'headers': [{
8383
'name': 'Authorization',
8484
'template': 'Bearer {value}',
@@ -240,11 +240,11 @@ def add_to_environment(self, split_name, environment_id, workspace_id, data):
240240
)
241241
return SplitDefinition(response, environment_id, workspace_id, self._http_client)
242242

243-
def remove_from_environment(self, split_name, environment_id, workspace_id):
243+
def remove_from_environment(self, split_name, environment_id,comment, title, workspace_id ):
244244
'''
245245
Remove split from environment
246246
247-
:param split: split name, environment id, workspace id
247+
:param split: split name, environment id, workspace id, comment, title
248248
249249
:returns: True if successful
250250
:rtype: boolean
@@ -254,7 +254,9 @@ def remove_from_environment(self, split_name, environment_id, workspace_id):
254254
self._endpoint['remove_from_environment'],
255255
workspaceId = workspace_id,
256256
environmentId = environment_id,
257-
splitName = split_name
257+
splitName = split_name,
258+
comment = comment,
259+
title = title
258260
)
259261
return response
260262

splitapiclient/resources/split.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ def add_to_environment(self, environment_id, data, apiclient=None):
7373
imc = require_client('Split', self._client, apiclient)
7474
return imc.add_to_environment(self._name, environment_id, self._workspace_id, data)
7575

76-
def remove_from_environment(self, environment_id, apiclient=None):
76+
def remove_from_environment(self, environment_id, comment="", title="", apiclient=None):
7777
'''
7878
Remove split from environment
7979
8080
:param data: environment id
81+
:param data: title
82+
:param data: comment
8183
:param apiclient: If this instance wasn't returned by the client,
8284
the IdentifyClient instance should be passed in order to perform the
8385
http call
@@ -86,7 +88,7 @@ def remove_from_environment(self, environment_id, apiclient=None):
8688
:rtype: SplitDefinition
8789
'''
8890
imc = require_client('Split', self._client, apiclient)
89-
return imc.remove_from_environment(self._name, environment_id, self._workspace_id)
91+
return imc.remove_from_environment(self._name, environment_id, comment, title, self._workspace_id)
9092

9193
def associate_tags(self, tags, apiclient=None):
9294
'''

splitapiclient/tests/resources/test_split.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,17 @@ def test_remove_from_environment(self, mocker):
112112
'ws_id',
113113
http_client_mock
114114
)
115-
attr = sp.remove_from_environment(environment_id)
115+
title="title"
116+
comment="comment"
117+
attr = sp.remove_from_environment(environment_id, comment, title)
116118

117119
http_client_mock.make_request.assert_called_once_with(
118120
SplitMicroClient._endpoint['remove_from_environment'],
119121
workspaceId = 'ws_id',
120122
splitName = 'name',
121-
environmentId = environment_id
123+
environmentId = environment_id,
124+
title=title,
125+
comment=comment
122126
)
123127
assert attr == True
124128

splitapiclient/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.1.6'
1+
__version__ = '3.1.7'

0 commit comments

Comments
 (0)