Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Time off request API methods #57

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

JosephvB-JBA
Copy link

I plan to use these API's in the future, thanks for the project so far 👍

Add API methods for:

  • Create / Update time off request
  • Update time off request status
  • Get company time off policies
  • Get company time off types

Fix:

  • Get time off requests: Must include start + end params in get request

Add utility method for:

  • Turning dictionary to xml for Create/Update time off request

@JosephvB-JBA
Copy link
Author

Currently adding test cases to support the new API methods 👍

Comment on lines +260 to +266
if request_data.get('notes') and len(request_data.get('notes')) > 0:
notes = ''
for n in request_data['notes']:
f = n.get('type', 'employee')
t = n.get('text', '')
notes += '\n\t\t<note from="{0}">{1}</note>'.format(f, t)
xml += '\n\t<notes>{0}\n\t</notes>'.format(notes)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if request_data.get('notes') and len(request_data.get('notes')) > 0:
notes = ''
for n in request_data['notes']:
f = n.get('type', 'employee')
t = n.get('text', '')
notes += '\n\t\t<note from="{0}">{1}</note>'.format(f, t)
xml += '\n\t<notes>{0}\n\t</notes>'.format(notes)
notes = ''
for note in request_data.get('notes', []):
f = note.get('type', 'employee')
t = note.get('text', '')
notes += '\n\t\t<note from="{0}">{1}</note>'.format(f, t)
xml += '\n\t<notes>{0}\n\t</notes>'.format(notes)

Same pattern can be used for dates 😉

params['end'] = end_date
if status:
params['status'] = status
# Must set dates or request errors 400 Bad Request
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BambooHR's API says it is optional. 🤔
https://www.bamboohr.com/api/documentation/time_off.php#getRequest

start (optional) - Only show time off that occurs on/after the specified start date.
end (optional) - Only show time off that occurs on/before the specified end date.

Copy link

@horida horida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants