Skip to content

Commit

Permalink
Merge pull request #39 from facetoe/org_external_id
Browse files Browse the repository at this point in the history
Locate Organizations by their external_id #36
  • Loading branch information
facetoe committed Feb 14, 2016
2 parents a0ee43b + c3e01f8 commit d3d03fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zenpy/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,13 @@ def organization_fields(self, **kwargs):
"""
return self._get_items(self.endpoint.organization_fields, 'organization_field', **kwargs)

def external(self, external_id):
"""
Locate an Organization by it's external_id attribute.
:param external_id: external id of organization
"""
return self._get_items(self.endpoint.external, 'organization', id=external_id)

def requests(self, **kwargs):
return self._get_items(self.endpoint.requests, 'request', **kwargs)

Expand Down
1 change: 1 addition & 0 deletions zenpy/lib/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class Endpoint(object):
organizations.tags = SecondaryEndpoint('organizations/%(id)s/tags.json')
organizations.organization_fields = PrimaryEndpoint('organization_fields')
organizations.requests = SecondaryEndpoint('organizations/%(id)s/requests.json')
organizations.external = SecondaryEndpoint('organizations/search.json?external_id=%(id)s')
search = SearchEndpoint('search.json?')
job_statuses = PrimaryEndpoint('job_statuses')
tags = PrimaryEndpoint('tags')
Expand Down

0 comments on commit d3d03fe

Please sign in to comment.