Skip to content

Commit

Permalink
Merge branch 'bamboo_sdk_webhook' of https://github.com/fylein/fyle-i…
Browse files Browse the repository at this point in the history
…ntegrations-settings-api into bamboo_sdk_webhook
  • Loading branch information
Ashutosh619-sudo committed Dec 20, 2023
2 parents 67d118e + 592a11a commit 24a98c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bamboosdk/api/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,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):
Expand Down
12 changes: 12 additions & 0 deletions bamboosdk/api/time_off.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions bamboosdk/bamboohrsdk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .api.employee import Employee
from .api.webhook import Webhook
from .api.time_off import TimeOff

class BambooHrSDK:
"""
Expand All @@ -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()
Expand All @@ -26,10 +28,12 @@ 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):
"""
Set sub domain for all the APIs
"""
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)

0 comments on commit 24a98c4

Please sign in to comment.