Skip to content

Commit

Permalink
Merge branch 'master' into jpetrucciani_actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetrucciani committed Oct 9, 2019
2 parents 96a167c + 75b725b commit f43869a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
9 changes: 8 additions & 1 deletion hubspot3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ def companies(self):

return CompaniesClient(**self.auth, **self.options)

@property
def companies_properties(self):
"""returns a hubspot3 companies properties client"""
from hubspot3.companies_properties import CompaniesPropertiesClient

return CompaniesPropertiesClient(**self.auth, **self.options)

@property
def contact_lists(self):
"""returns a hubspot3 contact_lists client"""
Expand Down Expand Up @@ -344,7 +351,7 @@ def workflows(self):

@property
def usage_limits(self):
"""fetches and returns a nice usage liimitation object"""
"""fetches and returns a nice usage limitation object"""
if self._usage_limits.need_update:
limits = self._base._call("integrations/v1/limit/daily")[0]
self._usage_limits = Hubspot3UsageLimits(
Expand Down
10 changes: 8 additions & 2 deletions hubspot3/companies.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def search_domain(
)

def get_all(
self, extra_properties: Union[str, List] = None, **options
self,
prettify_output: bool = True,
extra_properties: Union[str, List] = None,
**options
) -> Optional[List]:
"""get all companies, including extra properties if they are passed in"""
finished = False
Expand Down Expand Up @@ -115,13 +118,16 @@ def get_all(
params={
"limit": query_limit,
"offset": offset,
"properties": properties,
"propertiesWithHistory": properties,
"includeMergeAudits": "true",
},
**options
)
output.extend(
[
prettify(company, id_key="companyId")
if prettify_output
else company
for company in batch["companies"]
if not company["isDeleted"]
]
Expand Down
37 changes: 37 additions & 0 deletions hubspot3/companies_properties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
hubspot companies properties api
"""
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
from typing import List, Optional, Union


COMPANIES_PROPERTIES_API_VERSION = "1"


class CompaniesPropertiesClient(BaseClient):
"""
The hubspot3 Companies Properties client uses the _make_request method to call the
API for data. It returns a python object translated from the json returned.
"""

def __init__(self, *args, **kwargs):
"""initialize an companies properties client"""
super(CompaniesPropertiesClient, self).__init__(*args, **kwargs)
self.log = get_log("hubspot3.companies_properties")

def _get_path(self, subpath: str) -> str:
return "properties/v{}/companies/{}".format(
COMPANIES_PROPERTIES_API_VERSION, subpath
)

def get_all_companies_properties(
self, extra_properties: Union[str, List] = None, **options
) -> Optional[List]:
"""
Retrieve all of the company properties, including their definition, for a given account.
:see: https://developers.hubspot.com/docs/methods/companies/get_company_properties
"""
return self._call(
"properties".format(COMPANIES_PROPERTIES_API_VERSION), **options
)
1 change: 0 additions & 1 deletion hubspot3/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
__version__ = "3.2.32"


BASE_URL = "https://api.hubapi.com"

OBJECT_TYPE_COMPANIES = "companies"
Expand Down

0 comments on commit f43869a

Please sign in to comment.