Skip to content

Ruby client library for the World Air Quality Index (WAQI) APIs

License

Notifications You must be signed in to change notification settings

waqi-dev-community/waqi-ruby-client

Repository files navigation

WAQI RUBY CLIENT

Gem Version Gem Test Passing

This is a Ruby client for communicating with the World Air Quality Index API.

Installation

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.

Usage

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")

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Waqi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Ruby client library for the World Air Quality Index (WAQI) APIs

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published