- Notifications
You must be signed in to change notification settings - Fork0
anamba/updown.cr
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Seeupdown.io API Docs for more information on available endpoints and parameters.
Status: Works, but error handling is pretty rough (API documentation is a little sparse in this area, so it needs more real-world testing). Please open issues for anything you that could be improved.
Add the dependency to your
shard.yml
:dependencies:updown:github:anamba/updown.cr
Run
shards install
Configure API key either by setting UPDOWN_API_KEY in your environment orUpdown.settings.api_key = "your key here"
.
require"updown"# create a new checkcheck=Updown::Check.new("https://updown.io")check.save# list all existing checkschecks=Updown::Check.allcheck= checks.last.get# re-fetch with metrics# find a single check - to find token, either use `Updown::Check.all`# or look at check page url (https://updown.io/[token])check=Updown::Check.get("token")# returns nil if token doesn't exist (or wrong API key)# change attributes and savecheck.period# 300check.period=60# 60check.save# true (or Updown::Error)
All methods that call the Updown API raiseUpdown::Error
on a non-200 response code.
- Fork it (https://github.com/anamba/updown.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Aaron Namba - creator and maintainer