diff --git a/bamboosdk/api/api_base.py b/bamboosdk/api/api_base.py index e2dd6ffc..c514604b 100644 --- a/bamboosdk/api/api_base.py +++ b/bamboosdk/api/api_base.py @@ -120,8 +120,9 @@ def set_api_token(self, api_token): self.__api_token = api_token self.headers = { - "content-type": "application/json", - "authorization": f"Basic {self.__encode_username_password()}" + 'Accept': 'application/json', + 'content-type': 'application/json', + 'authorization': f'Basic {self.__encode_username_password()}' } def set_sub_domain(self, sub_domain): diff --git a/bamboosdk/api/time_off.py b/bamboosdk/api/time_off.py new file mode 100644 index 00000000..c616e79b --- /dev/null +++ b/bamboosdk/api/time_off.py @@ -0,0 +1,12 @@ +from .api_base import ApiBase + +class TimeOff(ApiBase): + CHECK_URL = '/v1/meta/time_off/types/' + + def get(self): + """ + Get method to get the different fields, + used here for checking connection. + Returns: + """ + return self._get_request(self.CHECK_URL) diff --git a/bamboosdk/bamboohrsdk.py b/bamboosdk/bamboohrsdk.py index 71edb27d..7b92468f 100644 --- a/bamboosdk/bamboohrsdk.py +++ b/bamboosdk/bamboohrsdk.py @@ -1,5 +1,6 @@ from .api.employee import Employee from .api.webhook import Webhook +from .api.time_off import TimeOff class BambooHrSDK: """ @@ -16,6 +17,7 @@ def __init__(self, api_token: str, sub_domain: str): self.employees = Employee() self.webhook = Webhook() + self.time_off = TimeOff() self.set_api_token() self.set_sub_domain() @@ -26,6 +28,7 @@ def set_api_token(self): """ self.employees.set_api_token(self.__api_token) self.webhook.set_api_token(self.__api_token) + self.time_off.set_api_token(self.__api_token) def set_sub_domain(self): """ @@ -33,3 +36,4 @@ def set_sub_domain(self): """ self.employees.set_sub_domain(self.__sub_domain) self.webhook.set_sub_domain(self.__sub_domain) + self.time_off.set_sub_domain(self.__sub_domain)