module IqairAirvisual::Community
Public Instance Methods
cities(country_name, state_name)
click to toggle source
# File lib/iqair_airvisual/community.rb, line 14 def cities(country_name, state_name) path = 'cities' params = { country: country_name, state: state_name } authorise_and_send(http_method: :get, path: path, params: params) end
city(country_name, state_name, city_name)
click to toggle source
# File lib/iqair_airvisual/community.rb, line 39 def city(country_name, state_name, city_name) path = 'city' params = { country: country_name, state: state_name, city: city_name } authorise_and_send(http_method: :get, path: path, params: params) end
countries()
click to toggle source
# File lib/iqair_airvisual/community.rb, line 3 def countries path = 'countries' authorise_and_send(http_method: :get, path: path) end
nearest_city(latitude: nil, longitude: nil)
click to toggle source
IP Geo-locate
# File lib/iqair_airvisual/community.rb, line 24 def nearest_city(latitude: nil, longitude: nil) if (latitude && !longitude) || (!latitude && longitude) raise 'Both latitude and longitude are required if GPS co-ordinates specified.' end path = 'nearest_city' params = {} if (latitude && longitude) params = { lat: latitude, lon: longitude } end authorise_and_send(http_method: :get, path: path, params: params) end
states(country_name)
click to toggle source
# File lib/iqair_airvisual/community.rb, line 8 def states(country_name) path = 'states' params = { country: country_name } authorise_and_send(http_method: :get, path: path, params: params) end