Skip to content

Commit 1ec07c1

Browse files
committed
Adding custom attribute support to Company.
1 parent 8856142 commit 1ec07c1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

intercom/company.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313
class Company(Resource, Delete, Count, Find, All, Save, Load, Users):
1414
update_verb = 'post'
1515
identity_vars = ['id', 'company_id']
16+
17+
@property
18+
def flat_store_attributes(self):
19+
return ['custom_attributes']

tests/integration/test_company.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ def test_add_user_custom_attributes(self):
5454
self.assertEqual(len(user.companies), 2)
5555
self.assertEqual(user.companies[0].company_id, "9")
5656

57+
# check the custom attributes
58+
company = Company.find(company_id=6)
59+
self.assertEqual(
60+
company.custom_attributes['referral_source'], "Google")
61+
5762
def test_find_by_company_id(self):
5863
# Find a company by company_id
5964
company = Company.find(company_id=self.company.company_id)

0 commit comments

Comments
 (0)