Skip to content

Commit

Permalink
improvements in user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Yordy Gelvez committed Feb 27, 2018
1 parent 6511e62 commit 6a4f7ed
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 11 deletions.
50 changes: 46 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ token = client.get_recent_changes(since_timestamp="YYYY-MM-DD HH:MM:SS")
### Deals section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Deals

#### Get deals
If you need a specific deal send the deal id, if you don't just call the method
```
get_specific_deal = client.get_deals(deal_id="")
get_deals = client.get_deals()
```

Expand Down Expand Up @@ -130,7 +133,7 @@ get_products_deal = client.get_deal_products(deal_id="")
### Notes section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Notes

#### Get notes
If you need a specific note send the note id, if you don't just call the method without send anything
If you need a specific note send the note id, if you don't just call the method
```
get_specific_note = client.get_notes(note_id="")
Expand All @@ -139,7 +142,7 @@ get_notes = client.get_notes()

#### Add a note
```
add_note = client.create_note(content="")
add_note = client.create_note(content="", org_id="")
```

#### Update a note
Expand All @@ -155,7 +158,10 @@ delete_note = client.delete_note(note_id="")
### Organizations section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Organizations

#### Get organizations
If you need a specific organization send the organization id, if you don't just call the method
```
get_specific_organization = client.get_organizations(org_id="")
get_organizations = client.get_organizations()
```

Expand All @@ -177,7 +183,7 @@ delete_organization = client.delete_organization(data_id="")
### Persons section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Persons

#### Get persons
If you need the details of a person send the person id, if you don't just call the method without send anything
If you need the details of a person send the person id, if you don't just call the method
```
get_details_person = client.get_persons(person_id="")
Expand Down Expand Up @@ -209,10 +215,46 @@ delete_persons = client.delete_person(data_id="")
get_persons_deals = client.get_person_deals(person_id="")
```


### Products section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Products

#### Get products
If you need a specific product send the product id, if you don't just call the method
```
get_specific_product = client.get_products(product_id="")
get_products = client.get_products()
```

#### Get products by name
```
find_product = client.get_product_by_name(term="")
```

#### Create a product
```
add_product = client.create_product(name="")
```

#### Update a product
```
update_product = client.update_product(product_id="", name="")
```

#### Delete a product
```
delete_product = client.delete_product(product_id="")
```

#### Get deals where a product is attached to
```
get_product_deal = client.get_product_deal(product_id="")
```

### Activities section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Activities

#### Get activities
If you need the activity details send the activity id, if you don't just call the method without send anything
If you need the activity details send the activity id, if you don't just call the method
```
get_details_activity = client.get_activities(activity_id="")
Expand Down
32 changes: 25 additions & 7 deletions pipedrive/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ def _post(self, endpoint, data=None, json=None, **kwargs):
def _delete(self, endpoint, **kwargs):
return self.make_request('delete', endpoint, **kwargs)

def _patch(self, endpoint, data=None, json=None, **kwargs):
return self.make_request('patch', endpoint, data=data, json=json, **kwargs)

def _put(self, endpoint, json=None, **kwargs):
return self.make_request('put', endpoint, json=json, **kwargs)

Expand Down Expand Up @@ -160,9 +157,27 @@ def get_recent_changes(self, **kwargs):
url = "recents"
return self._get(url, **kwargs)

def get_data(self, endpoint, **kwargs):
if endpoint != "":
return self._get(endpoint, **kwargs)

def get_specific_data(self, endpoint, data_id, **kwargs):
if endpoint != "":
url = "{0}/{1}".format(endpoint, data_id)
return self._get(url, **kwargs)

def create_data(self, endpoint, **kwargs):
if endpoint != "" and kwargs is not None:
params = {}
params.update(kwargs)
return self._post(endpoint, json=params)

# Deals section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Deals
def get_deals(self, **kwargs):
url = "deals"
def get_deals(self, deal_id=None, **kwargs):
if deal_id is not None:
url = "deals/{0}".format(deal_id)
else:
url = "deals"
return self._get(url, **kwargs)

def create_deal(self, **kwargs):
Expand Down Expand Up @@ -272,8 +287,11 @@ def delete_note(self, note_id):
return self._delete(url)

# Organizations section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Organizations
def get_organizations(self, **kwargs):
url = "organizations"
def get_organizations(self, org_id=None, **kwargs):
if org_id is not None:
url = "organizations/{0}".format(org_id)
else:
url = "organizations"
return self._get(url, **kwargs)

def create_organization(self, **kwargs):
Expand Down

0 comments on commit 6a4f7ed

Please sign in to comment.