Skip to content

Commit e4066c1

Browse files
committed
update attribute microclient interface
1 parent 32f1c83 commit e4066c1

2 files changed

Lines changed: 18 additions & 23 deletions

File tree

identify/main/identify_sync_client.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,27 @@ def get_all(self, traffic_type_id):
6262
trafficTypeId=traffic_type_id
6363
)
6464

65-
def create(self, traffic_type_id, attr_data):
65+
def create(self, traffic_type_id, attr_id, display_name, description,
66+
data_type, is_searchable):
6667
'''
6768
Creates an attribute for a specific traffic type.
6869
6970
:param traffic_type_id: Id of the traffic type for which an attribute
7071
will be created.
71-
:param attr_data: Dictionary with the the data to create the new
72-
attribute. Should include the followind fields:
73-
- 'id': Id of the new attribute
74-
- 'displayName': Display Name of the new attribute
75-
- 'description': Description of the new attribute
76-
- 'dataType': Data type of the new attribute
72+
:param attr_id: string. New attribute's Id
73+
:param display_name: string. New attribute's display name
74+
:param description: string. New attribute's description
75+
:param data_type: string. New attribute's data type
76+
:param is_searchable: string.
7777
'''
7878
return Attribute.create(
7979
self._http_client,
80-
attr_data.get('id'),
80+
attr_id,
8181
traffic_type_id,
82-
attr_data.get('displayName'),
83-
attr_data.get('description'),
84-
attr_data.get('dataType'),
85-
attr_data.get('isSearchable')
82+
display_name,
83+
description,
84+
data_type,
85+
is_searchable
8686
)
8787

8888
def delete(self, traffic_type_id, attribute_id):
@@ -93,7 +93,11 @@ def delete(self, traffic_type_id, attribute_id):
9393
will be removed.
9494
:param attribute_id: Id of the attribute to be removed.
9595
'''
96-
return Attribute.delete(self._http_client, attribute_id, traffic_type_id)
96+
return Attribute.delete(
97+
self._http_client,
98+
attribute_id,
99+
traffic_type_id
100+
)
97101

98102

99103
class IdentityMicroClient:

identify/tests/e2e/e2etests.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,7 @@ def test_attribute_endpoints(self):
9797
'dataType': 'STRING',
9898
'isSearchable': False,
9999
}
100-
new_attr = c.attribute.create(
101-
'1',
102-
{
103-
'id': 'aa',
104-
'displayName': 'AA',
105-
'description': 'DESC',
106-
'dataType': 'STRING',
107-
'isSearchable': False,
108-
}
109-
)
100+
new_attr = c.attribute.create('1', 'aa', 'AA', 'DESC', 'STRING', False)
110101
assert new_attr_props == new_attr.to_dict()
111102

112103
res_delete = c.attribute.delete(1, 'aa')

0 commit comments

Comments
 (0)