diff --git a/pipedrive/client.py b/pipedrive/client.py index a219105..8b6c7c1 100644 --- a/pipedrive/client.py +++ b/pipedrive/client.py @@ -12,6 +12,7 @@ from pipedrive.pipelines import Pipelines from pipedrive.products import Products from pipedrive.recents import Recents +from pipedrive.stages import Stages from pipedrive.users import Users from pipedrive.webhooks import Webhooks @@ -34,6 +35,7 @@ def __init__(self, client_id=None, client_secret=None, domain=None): self.pipelines = Pipelines(self) self.products = Products(self) self.recents = Recents(self) + self.stages = Stages(self) self.users = Users(self) self.webhooks = Webhooks(self) diff --git a/pipedrive/stages.py b/pipedrive/stages.py new file mode 100644 index 0000000..536ce89 --- /dev/null +++ b/pipedrive/stages.py @@ -0,0 +1,27 @@ +class Stages(object): + def __init__(self, client): + self._client = client + + def get_stage(self, stage_id, **kwargs): + url = 'stages/{}'.format(stage_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) + + def get_all_stages(self, **kwargs): + url = 'stages' + return self._client._get(self._client.BASE_URL + url, **kwargs) + + def get_stage_deals(self, stage_id, **kwargs): + url = 'stages/{}/deals'.format(stage_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) + + def create_stage(self, data, **kwargs): + url = 'stages' + return self._client._post(self._client.BASE_URL + url, data, **kwargs) + + def update_stage(self, stage_id, data, **kwargs): + url = 'stages/{}'.format(stage_id) + return self._client._put(self._client.BASE_URL + url, data, **kwargs) + + def delete_stage(self, stage_id, **kwargs): + url = 'stages/{}'.format(stage_id) + return self._client._delete(self._client.BASE_URL + url, **kwargs)