This is a Ruby client for communicating with the World Air Quality Index API.
You can install the client library via RubyGems:
gem install waqi-ruby
Or add it to your Gemfile:
gem 'waqi-ruby'
Then run bundle install
.
To use the library, first initialize the client with your API token:
require 'waqi'
client = Waqi::Client.new(api_key: 'YOUR_API_KEY')
You can get your API key by visiting this link.
For City Feed:
client.get_city_feed('beijing')
For Lat/Lng based Geolocalized Feed:
client.get_geo_feed(lat: -87.723900, lng: 41.913600)
For Ip based Geolocalized Feed:
client.get_geo_feed_by_ip
For Map Queries:
client.map_station(latlng: [-87.723900,41.913600], networks: 'all')
NOTE: latlng datatype must be an array in the format [lat1,lng1,lat2,lng2,...]. networks datatype must be a string and can take any of the following values - 'all', 'official' (or 'hourly') and 'citizen' (or 'airnet').
For Station Search:
client.search_station("munich")
Bug reports and pull requests are welcome on GitHub at https://github.com/waqi-dev-community/waqi-ruby-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Waqi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.