Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 4, 2018

Conversation

tanasegabriel
Copy link
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