Skip to content
Dark Sky API for Crystal
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec
src
.gitignore
.travis.yml
LICENSE
README.md
shard.yml

README.md

crystal-darksky

Build Status

Dark Sky API wrapper in Crystal.

Documentation: https://darksky.net/dev/docs

Installation

Add this to your application's shard.yml:

dependencies:
  darksky:
    github: sb89/crystal-darksky

Usage

require "darksky"

client = Darksky.new("api key...")

forecast = client.get_forecast("38.385939", "-97.43004")

forecast.currently.try do |c|
  p "The temperature is #{c.temperature}!"
end

Additional options can be specified when calling Darksky.new(...). These options will be used for each API request.

client = Darksky.new("api key...", lang: Darksky::Language::NL, units: Darksky::Units::SI, extend_hourly: true, exclude: [Darksky::Blocks::Minutely, Darksky::Blocks::Daily] )

Additional options can also be specified when calling get_forecast(...). Any options specified here will override the options specified in the new() method for this request.

client.get_forecast("38.385939", "-97.43004", lang: Darksky::Language::NL, units: Darksky::Units::SI, extend_hourly: true, exclude: [Darksky::Blocks::Minutely, Darksky::Blocks::Daily] )

Contributing

  1. Fork it ( https://github.com/sb89/crystal-darksky/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

  • sb89 Steven - creator, maintainer
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.