Updown

A Ruby wrapper and CLI for the updown.io API

Installation

Add this line to your application's Gemfile:

gem 'updown'

Or install it yourself as:

$ gem install updown

Configuration

Set your API key

# config/initializers/updown.rb
Updown.configure do |config|
  config.api_key = 'your_api_key'
end
# or
Updown.configuration.api_key = 'your_api_key'

Or set the UPDOWN_API_KEY environment variable

Find your API key in your settings page.

Usage

List all your checks:

Updown::Check.all
# => [<Updown::Check>, <Updown::Check>, … ]

List downtimes for a specific check (paginated, 100 per call):

check.downtimes
# => [<Updown::Downtime>, <Updown::Downtime>, … ]

check.downtimes page: 2
# => [<Updown::Downtime>]

Create a new check:

Updown::Check.create 'https://google.com'
# => <Updown::Check>

You can also set any parameters allowed by the API, like enabled, published, period or apdex_t:

Updown::Check.create 'https://google.com', period: 30, published: true
# => <Updown::Check>

In case of validation errors, an Updown::Error will be raised:

Updown::Check.create 'https://google.com', period: 45
# => Updown::Error: URL is already registered (given: "https://google.com"), Period is not included in the list (given: 45)

Update a specific check:

check.update period: 30
# => <Updown::Check>

Delete a specific check:

check.destroy
# => true

Learn more about the API here: https://updown.io/api

Command Line

This gem also comes with an updown shell command. First, configure your API key:

$ updown configure YOUR_API_KEY

See the status of your checks:

$ updown status
 [up]  rjis — https://google.com
[DOWN] bn94 — https://bing.com
 [up]  qwer — http://stackoverflow.com

Open the status page of a check:

$ updown open rjis

Add a new check:

$ updown add https://google.com

Todo

  • Write tests!

Contributing

  1. Fork it ( https://github.com/askehansen/updown-ruby/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request