class CrystalWeather::API

Overview

API is the interface that allows caller to interact with OpenWeatherMap's API

Defined in:

api.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(api_key : String, lang : String, units_format : String) #

Creates a new API object. Please make sure that :

  • you created an api_key on OpenWeatherMap's website
  • the lang you choose is valid
  • the units_format format you choose is valid

[View source]

Instance Method Detail

def current(location : String) : Types::Current #

Fetches the current weather for a specific location


[View source]
def forecast(location : String) : Types::Forecast #

Fetches the forecast for a specific location


[View source]
def lang : String #

Choosen lang between : ar, bg, ca, cz, de, el, fa, fi, fr, gl, hr, hu, it, ja, kr, la, lt, mk, nl, pl, pt, ro, ru, se, sk, sl, es, tr, ua, vi, zh_cn, zh_tw, en.


[View source]
def raw_current(location : String) : JSON::Any #

Gets the raw data of the current weather for a specific location


[View source]
def raw_forecast(location : String) : JSON::Any #

Gets the raw data of the forecast for a specific location


[View source]
def units_format : String #

Choosen units format between : default, metric or imperial


[View source]