GithubHelp home page GithubHelp logo

anamba / updown.cr Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 9 KB

updown.io API helper

License: MIT License

Crystal 100.00%
crystal crystal-language crystal-lang shard updownio updown-api updown-monitoring updown

updown.cr's Introduction

updown.cr - updown.io API helper

Version License

See updown.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.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      updown:
        github: anamba/updown.cr
  2. Run shards install

Usage

Configure API key either by setting UPDOWN_API_KEY in your environment or Updown.settings.api_key = "your key here".

require "updown"

# create a new check
check = Updown::Check.new("https://updown.io")
check.save

# list all existing checks
checks = Updown::Check.all
check = 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 save
check.period       # 300
check.period = 60  # 60
check.save         # true (or Updown::Error)

All methods that call the Updown API raise Updown::Error on a non-200 response code.

Contributing

  1. Fork it (https://github.com/anamba/updown.cr/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

Contributors

updown.cr's People

Contributors

anamba avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.