Skip to content

Return 'user.User' when listing all of the users of a company#200

Merged
tanasegabriel merged 1 commit intomasterfrom
gabriel/fix_users_in_companies_return
Oct 4, 2018
Merged

Return 'user.User' when listing all of the users of a company#200
tanasegabriel merged 1 commit intomasterfrom
gabriel/fix_users_in_companies_return

Conversation

@tanasegabriel
Copy link
Copy Markdown
Contributor

Fix for #180
We're incorrectly returning users belonging to companies as company.Company objects and this can cause issues if trying to update the user right away, unless an extra call to list the user is used - this PR addresses this.

Before:

>>> for user in intercom.companies.users(company_id):
...   user.custom_attributes["newCDA"] = "yup"
...   intercom.users.save(user)
...
<intercom.company.Company object at 0x7f109be4d710>
>>> for user in intercom.companies.users(company_id):
...   print(user.__class__)
...
<class 'intercom.company.Company'>

After:

>>> for user in intercom.companies.users(company_id):
...   user.custom_attributes["newCDA"] = "yup"
...   intercom.users.save(user)
...
<intercom.user.User object at 0x110ba8898>
>>> for user in intercom.companies.users(company_id):
...   print(user.__class__)
...
<class 'intercom.user.User'>

@tanasegabriel tanasegabriel merged commit 4527408 into master Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant