Module: ChinaAqi

Defined in:
lib/china_aqi.rb,
lib/china_aqi/base.rb,
lib/china_aqi/utility.rb,
lib/china_aqi/version.rb,
lib/china_aqi/exceptions.rb,
lib/china_aqi/aqi/station.rb,
lib/china_aqi/aqi/dynamic/co.rb,
lib/china_aqi/aqi/dynamic/o3.rb,
lib/china_aqi/aqi/dynamic/no2.rb,
lib/china_aqi/aqi/dynamic/so2.rb,
lib/china_aqi/aqi/dynamic/city.rb,
lib/china_aqi/aqi/dynamic/pm10.rb,
lib/china_aqi/aqi/dynamic/pm25.rb,
lib/china_aqi/aqi/static/global.rb,
lib/china_aqi/aqi/static/ranking.rb,
lib/china_aqi/aqi/dynamic/city_pro.rb,
lib/china_aqi/helper/city_stations.rb,
lib/china_aqi/helper/available_cities.rb

Defined Under Namespace

Modules: Utility Classes: AvailableCities, Base, CO, City, CityPro, CityStations, DynamicBase, Global, InstallGenerator, NO2, NotImplementedError, O3, PM10, PM25, Ranking, SO2, StaticBase, Station, TokenMissingError

Constant Summary collapse

VERSION =
'0.0.5'.freeze

Class Method Summary collapse

Class Method Details

.available_citiesObject



6
7
8
# File 'lib/china_aqi/helper/available_cities.rb', line 6

def available_cities
  AvailableCities.new.get
end

.get_stations_for_city(city) ⇒ Object

create a helper in ChinaAqi module



8
9
10
# File 'lib/china_aqi/helper/city_stations.rb', line 8

def get_stations_for_city(city)
  CityStations.new(city).get
end

.tokenObject



3
4
5
6
7
8
9
# File 'lib/china_aqi.rb', line 3

def self.token
  @token ||= begin
    if Module.const_defined?('Rails')
      Rails.application.config.china_aqi_token if Rails.application.config.respond_to?(:china_aqi_token)
    end
  end
end

.token=(token_string) ⇒ Object



11
12
13
# File 'lib/china_aqi.rb', line 11

def self.token=(token_string)
  @token = token_string
end