2021-05-05 12:20:31 +00:00
|
|
|
# Moji Weather API (for Aliyun Cloud Market)
|
|
|
|
|
|
|
|
## Usage:
|
|
|
|
|
|
|
|
```ruby
|
2021-05-05 13:16:45 +00:00
|
|
|
client = MojiWeather::Api::Client.new app_code: "YOUR_APP_CODE"
|
|
|
|
|
|
|
|
result = client.query MojiWeather::Api::ApiType::AQI, location: {lat: 39.95, lon: 116.36}
|
|
|
|
result = client.query MojiWeather::Api::ApiType::AQI, city_id: 2
|
2021-05-05 12:20:31 +00:00
|
|
|
```
|
2021-05-05 13:16:45 +00:00
|
|
|
`ApiType` has the following possible values (more is WIP):
|
2021-05-05 13:18:30 +00:00
|
|
|
* `MojiWeather::Api::ApiType::CONDITION`: Real-time condition
|
|
|
|
* `MojiWeather::Api::ApiType::FORECAST_24HRS`: 24-hour forecast
|
2021-05-05 13:28:53 +00:00
|
|
|
* `MojiWeather::Api::ApiType::FORECAST_15DAYS`: 15-day forecast
|
|
|
|
* `MojiWeather::Api::ApiType::LIMIT`: Number plate limitation for vehicles in certain cities
|
|
|
|
* `MojiWeather::Api::ApiType::LIFE_INDEX`: Useful life tips and index score based on weather (in Chinese)
|
2021-05-05 13:18:30 +00:00
|
|
|
* `MojiWeather::Api::ApiType::AQI`: Air quality index(AQI)
|