Project

waqi-ruby

0.0
The project is in a healthy, maintained state
A ruby client to get Real-time Air Quality data feed
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.2

Runtime

 Project Readme

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.