https://github.com/dxw/opsgenie-schedule
A simple gem that fetches the scheduled people working on a given date for any Opsgenie schedule.
https://github.com/dxw/opsgenie-schedule
delivery-plus tech-ops
Last synced: 11 months ago
JSON representation
A simple gem that fetches the scheduled people working on a given date for any Opsgenie schedule.
- Host: GitHub
- URL: https://github.com/dxw/opsgenie-schedule
- Owner: dxw
- License: mit
- Created: 2019-09-30T13:44:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-07-18T04:53:40.000Z (12 months ago)
- Last Synced: 2025-07-18T08:20:52.201Z (12 months ago)
- Topics: delivery-plus, tech-ops
- Language: Ruby
- Homepage:
- Size: 96.7 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://github.com/dxw/opsgenie-schedule/actions)
# Opsgenie Schedule
A simple gem that fetches the scheduled people working on a given date for any Opsgenie schedule.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'opsgenie-schedule'
```
And then execute:
```bash
$ bundle
```
Or install it yourself as:
```bash
$ gem install opsgenie-schedule
```
## Usage
Require and initialize the gem like so:
```ruby
require 'opsgenie'
Opsgenie.configure(api_key: "YOUR_OPSGENIE_API_KEY")
```
And fetch a schedule by its name:
```ruby
schedule = Opsgenie::Schedule.find_by_name("schedule_name")
```
Or its ID
```ruby
schedule = Opsgenie::Schedule.find_by_id("some_uuid")
```
You can then fetch the people scheduled for today like so:
```ruby
schedule.on_calls
#=> [
# ,
#
#]
```
Or a given date time like so:
```ruby
date = DateTime.parse("2019-01-01T10:00:00")
schedule.on_calls(date)
#=> [
# ,
#
#]
```
You can also fetch a timeline for a schedule:
```ruby
schedule.timeline
```
Or a specific rotation:
```ruby
schedule.rotation[0].timeline
```
You can also specify where you want a timeline to start from:
```ruby
schedule.timeline(date: Date.parse("2019-01-01"))
# => [#,
# @start_date=#,
# @user=
# #>,
# ...]
# ],
# ...
# ]
# >
```
As well as the interval you want to see a timeline for:
```ruby
# `interval_unit` can be one of `:days`, `:weeks` or `:months`
schedule.timeline(interval: 1, interval_unit: :months)
#=> [...]
```
These options also work for a rotation's timeline too:
```ruby
schedule.rotation[0].timeline(
date: Date.parse("2019-01-01"),
interval: 1,
interval_unit: :months
)
#=>
```
## Development
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
To install this gem onto your local machine, run `bundle exec rake install`.
To release a new version, update the version number in `opsgenie-schedule.gemspec`, 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.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/dxw/opsgenie-schedule. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the MarketplaceOpportunityScraper project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dxw/opsgenie-schedule/blob/master/CODE_OF_CONDUCT.md).