Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
Add industry for accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
snarayanank2 committed Jan 27, 2020
1 parent 2630555 commit 819e727
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
8 changes: 7 additions & 1 deletion freshsalessdk/freshsalessdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_appointments(self, id):

class Accounts(APIBase):
def __init__(self, domain, api_key):
default_params = {'include': 'appointments,owner',
default_params = {'include': 'appointments,owner,industry_type',
'sort': 'updated_at', 'sort_type': 'desc'}
super().__init__(domain=domain, api_key=api_key,
resource_type='sales_accounts', default_params=default_params)
Expand All @@ -183,6 +183,12 @@ def _normalize(self, obj, container):
if 'owner_id' in obj:
owner = APIBase._find_obj_by_id(objs=users, id=obj['owner_id'])
obj['owner'] = owner
industry_types = []
if 'industry_types' in container:
industry_types = container['industry_types']
if 'industry_type_id' in obj:
industry_type = APIBase._find_obj_by_id(objs=industry_types, id=obj['industry_type_id'])
obj['industry_type'] = industry_type


class Deals(APIBase):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='freshsalessdk',
version='0.1.2',
version='0.1.3',
author='Siva Narayanan',
author_email='[email protected]',
description='Python SDK for accessing Freshsales',
Expand Down
10 changes: 9 additions & 1 deletion test/account.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"cf_purchase_intent": "xxx",
"cf_engagement_level": "xxx",
"cf_product_awareness": "xxx",
"cf_import_source": "xxx"
"cf_import_source": "xxx",
"cf_number_of_employees_range": "xxx"
},
"created_at": "xxx",
"updated_at": "xxx",
Expand All @@ -71,5 +72,12 @@
"is_active": 0,
"work_number": "xxx",
"mobile_number": "xxx"
},
"industry_type_id": 0,
"industry_type": {
"partial": true,
"id": 0,
"name": "xxx",
"position": 0
}
}

0 comments on commit 819e727

Please sign in to comment.