Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sb89/crystal-darksky
Dark Sky API for Crystal
https://github.com/sb89/crystal-darksky
Last synced: 9 days ago
JSON representation
Dark Sky API for Crystal
- Host: GitHub
- URL: https://github.com/sb89/crystal-darksky
- Owner: sb89
- License: mit
- Created: 2017-03-07T19:58:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-02T09:11:40.000Z (over 2 years ago)
- Last Synced: 2024-08-01T17:36:38.360Z (3 months ago)
- Language: Crystal
- Size: 13.7 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - crystal-darksky - Wrapper for the [Dark Sky](https://darksky.net) API (Third-party APIs)
- awesome-crystal - crystal-darksky - Wrapper for the [Dark Sky](https://darksky.net) API (Third-party APIs)
- awesome-crystal - crystal-darksky - Wrapper for the [Dark Sky](https://darksky.net) API (Third-party APIs)
README
# crystal-darksky
Dark Sky API wrapper in Crystal.
Documentation: https://darksky.net/dev/docs
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
darksky:
github: sb89/crystal-darksky
```## Usage
```crystal
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.```crystal
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.
```crystal
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](https://github.com/sb89) Steven - creator, maintainer