A Ruby Wrapper for the BreatheHR API
Add this line to your application's Gemfile:
gem 'breathe'
And then execute:
bundle
Or install it yourself as:
gem install breathe
Require the gem:
require "breathe"
Initialize the client like so:
client = Breathe::Client.new(api_key: YOUR_API_KEY)
And use like so
client.absences.list
#=> [...]
client.sicknesses.list
#=> [...]
client.employees.list
#=> [...]
client.employees.get(id)
#=> [...]
client.employee_training_courses.list
#=> [...]
You can also pass in arguments like so:
client.absences(per_page: 12, start_date: Date.today)
#=> [...]
You can also paginate through the data like so:
client.absences.list.next_page
#=> [...]
client.absences.list.previous_page
#=> [...]
client.absences.list.last_page
#=> [...]
client.absences.list.first_pages
#=> [..]
If you don't want to paginate at all, you can initialize the client with the auto_paginate
argument set to true
like so:
client = Breathe::Client.new(api_key: YOUR_API_KEY, auto_paginate: true)
Only the absences endpoint is currently supported. PRs are accepted for more endpoints!
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
To release a new version, update the version number in lib/breathe/version.rb
, commit the change and then create a git tag for that version in the format x.x.x
(where x is each version number). Github Actions will then automatically push the latest version to Rubygems.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/breathe. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Breathe project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.