china_aqi 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +156 -0
- data/Rakefile +6 -0
- data/china_aqi.gemspec +26 -0
- data/lib/china_aqi.rb +18 -0
- data/lib/china_aqi/aqi/dynamic/city.rb +6 -0
- data/lib/china_aqi/aqi/dynamic/city_pro.rb +6 -0
- data/lib/china_aqi/aqi/dynamic/co.rb +5 -0
- data/lib/china_aqi/aqi/dynamic/no2.rb +5 -0
- data/lib/china_aqi/aqi/dynamic/o3.rb +5 -0
- data/lib/china_aqi/aqi/dynamic/pm10.rb +5 -0
- data/lib/china_aqi/aqi/dynamic/pm25.rb +5 -0
- data/lib/china_aqi/aqi/dynamic/so2.rb +5 -0
- data/lib/china_aqi/aqi/static/global.rb +8 -0
- data/lib/china_aqi/aqi/static/ranking.rb +6 -0
- data/lib/china_aqi/aqi/station.rb +33 -0
- data/lib/china_aqi/base.rb +95 -0
- data/lib/china_aqi/exceptions.rb +4 -0
- data/lib/china_aqi/helper/city_stations.rb +14 -0
- data/lib/china_aqi/utility.rb +32 -0
- data/lib/china_aqi/version.rb +3 -0
- data/lib/generators/china_aqi/install/USAGE +9 -0
- data/lib/generators/china_aqi/install/install_generator.rb +8 -0
- data/spec/china_aqi_spec.rb +11 -0
- data/spec/spec_helper.rb +4 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ca4d41542b8602aa534e099a19393fdd74ff74e6
|
4
|
+
data.tar.gz: 1622846a24168d2ca7724a0f8ea981a2d46e4b2f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f47c648c382a4258f1ce0cf8d74e2a57e0c0e6b13e5c3b6ea38448fd9455798f5416c4a7ff75f10383850227e1d6ace422e660f56002fc821e259e54b5fc875
|
7
|
+
data.tar.gz: ea802169eb2a35232b3e58e06480b4cb52a7634103d2d08c8a657b748d3b2ef37616cf9ca3b74d548534ec2823b5a209c46b87b7ba42fbbfa33db345b85e921a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Xuhao
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
# ChinaAqi
|
2
|
+
|
3
|
+
[](https://travis-ci.org/Xuhao/china_aqi)
|
4
|
+
[](https://codeclimate.com/github/Xuhao/china_aqi)
|
5
|
+
|
6
|
+
China Air Quality Index API for Ruby. Thanks [pm25.in][pm25_in] for provide all the AQI sources for us as free, all the data is form China's official sector. it's a reall gread work!
|
7
|
+
|
8
|
+
ChinaAqi gem provide some interface base on Ruby On Rails, before to use it, you need ask for a token form [pm25.in][pm25_in_api].
|
9
|
+
|
10
|
+
All monitoring stations in most cities of China are available, most AQI data are available, they are:
|
11
|
+
|
12
|
+
- **CO**: 一氧化碳
|
13
|
+
- **NO2**: 二氧化氮
|
14
|
+
- **O3**: 臭氧
|
15
|
+
- **PM10**: 颗粒物(粒径小于等于10μm)
|
16
|
+
- **PM2.5**: 颗粒物(粒径小于等于2.5μm)
|
17
|
+
- **SO2**: 二氧化硫
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
gem 'china_aqi'
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
$ bundle
|
28
|
+
|
29
|
+
Or install it yourself as:
|
30
|
+
|
31
|
+
$ gem install china_aqi
|
32
|
+
|
33
|
+
Run install generator:
|
34
|
+
|
35
|
+
$ rails generate china_aqi:install
|
36
|
+
|
37
|
+
It will create file: config/initializers/china_aqi.rb
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
As we mention at the beginning, we must get a token form [pm25.in][pm25_in_api] before we use their APIs, it's free!
|
42
|
+
|
43
|
+
Once you get the token, put it in config/initializers/china_aqi.rb, then enjoy!
|
44
|
+
|
45
|
+
### Parameters
|
46
|
+
|
47
|
+
Most APIs accept three params:
|
48
|
+
|
49
|
+
- `city`: city name can be chinese characters, pinyin and area code('上海' or 'shanghai' or '021')
|
50
|
+
- `avg`: true/false, optional, if true,return average for all monitoring stations, default is true.
|
51
|
+
- `stations`: yes/no, optional, if yes, return data for all monitoring stations; if no, just return average without stations data, default is yes.
|
52
|
+
|
53
|
+
`avg` and `stations` params is optional, it will use defaut value if not set them.
|
54
|
+
|
55
|
+
### Examples
|
56
|
+
|
57
|
+
##### CO: 一氧化碳
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
shanghai = ChinaAqi::CO.new('上海', avg: true, stations: :yes) # same as ChinaAqi::CO.new('上海')
|
61
|
+
# => #<ChinaAqi::CO:0x007fbf9d953238 @city="021", @parmas={:avg=>true ...
|
62
|
+
shanghai.get
|
63
|
+
# => [{"aqi"=>57, "area"=>"上海", "co"=>0.0, "co_24h"=>0.0, "position_name"=>"普陀", "primary_pollutant" ...
|
64
|
+
ChinaAqi::CO.get('上海', avg: true, stations: :yes) # => Same as above
|
65
|
+
```
|
66
|
+
|
67
|
+
##### NO2: 二氧化氮
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
ChinaAqi::NO2.new('021').get # or ChinaAqi::NO2.get('021')
|
71
|
+
# => [{"aqi"=>57, "area"=>"上海", "no2"=>0, "no2_24h"=>0, "position_name"=>"普陀", "primary_pollutant" ...
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
##### O3: 臭氧
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
ChinaAqi::O3.new('shanghai').get # or ChinaAqi::O3.get('shanghai')
|
79
|
+
# => [{"aqi"=>57, "area"=>"上海", "o3"=>0, "o3_24h"=>0, "o3_8h"=>0, "o3_8h_24h"=>0, "position_name" ...
|
80
|
+
```
|
81
|
+
|
82
|
+
##### PM10: 颗粒物(粒径小于等于10μm)
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
ChinaAqi::PM10.new('上海').get # or ChinaAqi::PM10.get('上海')
|
86
|
+
# => [{"aqi"=>57, "area"=>"上海", "pm10"=>55, "pm10_24h"=>64, "position_name"=>"普陀", "primary_pollutant" ...
|
87
|
+
```
|
88
|
+
##### PM2.5: 颗粒物(粒径小于等于2.5μm)
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
ChinaAqi::PM25.new('shanghai').get # or ChinaAqi::PM25.get('shanghai')
|
92
|
+
# => [{"aqi"=>57, "area"=>"上海", "pm2_5"=>21, "pm2_5_24h"=>38, "position_name"=>"普陀", "primary_pollutant" ...
|
93
|
+
```
|
94
|
+
|
95
|
+
##### SO2: 二氧化硫
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
ChinaAqi::SO2.new('shanghai').get # or ChinaAqi::SO2.get('shanghai')
|
99
|
+
# => [{"aqi"=>57, "area"=>"上海", "so2"=>0, "so2_24h"=>0, "position_name"=>"普陀", "primary_pollutant" ...
|
100
|
+
```
|
101
|
+
|
102
|
+
##### Simple data for all monitoring stations in one city
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
ChinaAqi::City.new('shanghai').get # or ChinaAqi::City.get('shanghai')
|
106
|
+
# => [{"aqi"=>57, "area"=>"上海", "so2"=>0, "so2_24h"=>0, "position_name"=>"普陀", "primary_pollutant" ...
|
107
|
+
```
|
108
|
+
|
109
|
+
##### Detail data for all monitoring stations in one city
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
ChinaAqi::CityPro.new('shanghai').get # or ChinaAqi::CityPro.get('shanghai')
|
113
|
+
# => [{"aqi"=>57, "area"=>"上海", "co"=>0.0, "co_24h"=>0.0, "no2"=>0, "no2_24h"=>0, ...
|
114
|
+
```
|
115
|
+
|
116
|
+
##### Fetch all data
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
ChinaAqi::Global.new.get
|
120
|
+
# same as below:
|
121
|
+
ChinaAqi::Global.get
|
122
|
+
# => [{"aqi"=>57, "area"=>"上海", "co"=>0.0, "co_24h"=>0.0, "no2"=>0, "no2_24h"=>0, ...
|
123
|
+
```
|
124
|
+
|
125
|
+
##### AQI Ranking for China
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
ChinaAqi::Ranking.new.get
|
129
|
+
# same as below:
|
130
|
+
ChinaAqi::Ranking.get
|
131
|
+
# => [{"aqi"=>57, "area"=>"上海", "co"=>0.0, "co_24h"=>0.0, "no2"=>0, "no2_24h"=>0, ...
|
132
|
+
```
|
133
|
+
|
134
|
+
### Helpers
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
# Get station names and station codes for one city
|
138
|
+
ChinaAqi.get_stations_for_city('上海')
|
139
|
+
ChinaAqi.get_stations_for_city('shanghai')
|
140
|
+
ChinaAqi.get_stations_for_city('021')
|
141
|
+
# same as:
|
142
|
+
ChinaAqi::CityStations.get('上海/shanghai/021')
|
143
|
+
# {"city"=>"上海", "stations"=>[{"station_name"=>"普陀" ..
|
144
|
+
```
|
145
|
+
|
146
|
+
## Contributing
|
147
|
+
|
148
|
+
1. Fork it
|
149
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
150
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
151
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
152
|
+
5. Create new Pull Request
|
153
|
+
|
154
|
+
|
155
|
+
[pm25_in]: http://www.pm25.in
|
156
|
+
[pm25_in_api]: http://www.pm25.in/api_doc
|
data/Rakefile
ADDED
data/china_aqi.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'china_aqi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "china_aqi"
|
8
|
+
spec.version = ChinaAqi::VERSION
|
9
|
+
spec.authors = ["Xuhao"]
|
10
|
+
spec.email = ["xuhao@rubyfans.com"]
|
11
|
+
spec.description = %q{China AQI API from PM25.in}
|
12
|
+
spec.summary = %q{China AQI API from PM25.in}
|
13
|
+
spec.homepage = "https://github.com/Xuhao/china_aqi"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_dependency 'activesupport'
|
25
|
+
spec.add_dependency 'httparty'
|
26
|
+
end
|
data/lib/china_aqi.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "china_aqi/version"
|
2
|
+
module ChinaAqi
|
3
|
+
def self.token
|
4
|
+
@token ||= begin
|
5
|
+
if Module.const_defined?('Rails')
|
6
|
+
Rails.application.config.china_aqi_token if Rails.application.config.respond_to?(:china_aqi_token)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.token=(token_string)
|
12
|
+
@token = token_string
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'china_aqi/base'
|
17
|
+
require 'china_aqi/exceptions'
|
18
|
+
require 'china_aqi/helper/city_stations'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module ChinaAqi
|
2
|
+
# Fetch data for one monitoring station
|
3
|
+
#
|
4
|
+
# example:
|
5
|
+
#
|
6
|
+
# ChinaAqi::Station.new('1141A').get
|
7
|
+
#
|
8
|
+
# same as:
|
9
|
+
#
|
10
|
+
# ChinaAqi::CityStations.get(station_code)
|
11
|
+
#
|
12
|
+
# You can get all station codes for one city like this:
|
13
|
+
#
|
14
|
+
# ChinaAqi::CityStations.new(station_code).get
|
15
|
+
#
|
16
|
+
# or like this:
|
17
|
+
#
|
18
|
+
# ChinaAqi.get_stations_for_city(city)
|
19
|
+
#
|
20
|
+
# and like this:
|
21
|
+
#
|
22
|
+
# ChinaAqi::CityStations.get(city)
|
23
|
+
class Station < Base
|
24
|
+
self.method = :aqis_by_station
|
25
|
+
attr_accessor :station_code
|
26
|
+
|
27
|
+
def initialize(station_code)
|
28
|
+
super
|
29
|
+
@station_code = station_code
|
30
|
+
@parmas = { station_code: station_code, token: ChinaAqi.token }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'china_aqi/utility'
|
2
|
+
module ChinaAqi
|
3
|
+
# Fetch data with different method
|
4
|
+
#
|
5
|
+
# Pass city name and params those API accept.
|
6
|
+
#
|
7
|
+
# shanghai = ChinaAqi::PM25.new('city_name', params = { avg: true/false, stations: :yes/:no })
|
8
|
+
# shanghai.get
|
9
|
+
#
|
10
|
+
# this is same as:
|
11
|
+
#
|
12
|
+
# ChinaAqi::PM25.get('city_name', params = { avg: true/false, stations: :yes/:no })
|
13
|
+
#
|
14
|
+
# params:
|
15
|
+
# avg: if true,return average for all monitoring stations, default is true
|
16
|
+
# stations: if yes, return data for all monitoring stations; if no, just return average.
|
17
|
+
#
|
18
|
+
# checkout explanation in http://www.pm25.in/api_doc
|
19
|
+
#
|
20
|
+
# examples
|
21
|
+
#
|
22
|
+
# shanghai = ChinaAqi::PM25.new('上海') # #<ChinaAqi::PM25:0x007fe2a631aef8 @city="上海"...
|
23
|
+
# shanghai.get # [{"aqi"=>74, "area"=>"上海", "pm2_5"=>48,...
|
24
|
+
# ChinaAqi::PM25.get('shanghai') # Same as above
|
25
|
+
#
|
26
|
+
# # Get so2 data for 上海
|
27
|
+
# ChinaAqi::SO2.new('上海', avg: false, stations: :no).get # [{"aqi"=>74, "area"=>"上海", "pm2_5"=>48,...
|
28
|
+
#
|
29
|
+
# # Get all data for one stations with code "1141A"
|
30
|
+
# ChinaAqi::Station.new('1141A').get # [{"aqi"=>75, "area"=>"上海", "co"=>0.0, "co_24h"=>0.0
|
31
|
+
#
|
32
|
+
# # Get all data that the API provide
|
33
|
+
# ChinaAqi::Global.new.get
|
34
|
+
#
|
35
|
+
|
36
|
+
class Base
|
37
|
+
include ChinaAqi::Utility
|
38
|
+
attr_accessor :token
|
39
|
+
|
40
|
+
def initialize(*args)
|
41
|
+
raise TokenMissingError, %~
|
42
|
+
#{'*' * 66}
|
43
|
+
Token is missing!
|
44
|
+
|
45
|
+
Set token as below:
|
46
|
+
|
47
|
+
ChinaAqi.token = "you_token"
|
48
|
+
|
49
|
+
If you use it under Rails, set token as normal rails configuration:
|
50
|
+
|
51
|
+
# config/application.rb
|
52
|
+
config.china_aqi_token = "you_token"
|
53
|
+
|
54
|
+
#{'*' * 66}~ unless ChinaAqi.token
|
55
|
+
@token = ChinaAqi.token
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.get(*args)
|
59
|
+
self.new(*args).get
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# APIs with some parameters
|
64
|
+
class DynamicBase < Base
|
65
|
+
attr_accessor :city
|
66
|
+
|
67
|
+
def initialize(city, querys = {avg: true, stations: :yes})
|
68
|
+
super
|
69
|
+
@city = city
|
70
|
+
@parmas = querys.merge(city: city, token: ChinaAqi.token)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# APIs without any parameters
|
75
|
+
class StaticBase < Base
|
76
|
+
def initialize
|
77
|
+
super
|
78
|
+
@parmas = { token: ChinaAqi.token }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
require 'china_aqi/aqi/dynamic/city'
|
84
|
+
require 'china_aqi/aqi/dynamic/city_pro'
|
85
|
+
require 'china_aqi/aqi/dynamic/co'
|
86
|
+
require 'china_aqi/aqi/dynamic/no2'
|
87
|
+
require 'china_aqi/aqi/dynamic/o3'
|
88
|
+
require 'china_aqi/aqi/dynamic/pm10'
|
89
|
+
require 'china_aqi/aqi/dynamic/pm25'
|
90
|
+
require 'china_aqi/aqi/dynamic/so2'
|
91
|
+
|
92
|
+
require 'china_aqi/aqi/static/global'
|
93
|
+
require 'china_aqi/aqi/static/ranking'
|
94
|
+
|
95
|
+
require 'china_aqi/aqi/station'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'china_aqi/utility'
|
2
|
+
module ChinaAqi
|
3
|
+
# All monitoring station names in one city
|
4
|
+
class CityStations < DynamicBase
|
5
|
+
self.method = :station_names
|
6
|
+
end
|
7
|
+
|
8
|
+
# create a helper in ChinaAqi module
|
9
|
+
def get_stations_for_city(city)
|
10
|
+
CityStations.new(city).get
|
11
|
+
end
|
12
|
+
|
13
|
+
module_function :get_stations_for_city
|
14
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'active_support/core_ext/class/attribute'
|
3
|
+
require 'active_support/json/decoding'
|
4
|
+
require 'active_support/core_ext/object/to_query'
|
5
|
+
require 'active_support/concern'
|
6
|
+
module ChinaAqi
|
7
|
+
module Utility
|
8
|
+
extend ::ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
include HTTParty
|
12
|
+
attr_accessor :parmas
|
13
|
+
class_attribute :base_uri, :method
|
14
|
+
self.base_uri = URI::HTTP.build({host: 'www.pm25.in'})
|
15
|
+
end
|
16
|
+
|
17
|
+
def get
|
18
|
+
::ActiveSupport::JSON.decode(HTTParty.get(url).body)
|
19
|
+
end
|
20
|
+
|
21
|
+
def uri
|
22
|
+
raise NotImplementedError, "Please set value for 'method' class attributes in '#{self.class.name}' class." unless self.class.method
|
23
|
+
self.class.base_uri.path = "/api/querys/#{self.class.method.to_s}.json"
|
24
|
+
self.class.base_uri.query = @parmas.to_query
|
25
|
+
self.class.base_uri
|
26
|
+
end
|
27
|
+
|
28
|
+
def url
|
29
|
+
uri.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Description:
|
2
|
+
Append china_aqi_token config to config/application.rb, This file is used for set customer token for PM25.in
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails g china_aqi:install
|
6
|
+
|
7
|
+
This will append below line to config/application.rb:
|
8
|
+
|
9
|
+
config.china_aqi_token = 'you_token_here'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class ChinaAqi::InstallGenerator < Rails::Generators::Base
|
2
|
+
def append_token_config
|
3
|
+
application "config.china_aqi_token = 'you_token_here'"
|
4
|
+
puts "Find below line in \e[33mconfig/application.rb\e[0m:"
|
5
|
+
puts "\e[32m config.china_aqi_token = '\e[0m\e[31myou_token_here\e[0m\e[32m'\e[0m"
|
6
|
+
puts "Put your token."
|
7
|
+
end
|
8
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: china_aqi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Xuhao
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httparty
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: China AQI API from PM25.in
|
84
|
+
email:
|
85
|
+
- xuhao@rubyfans.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .rspec
|
92
|
+
- .travis.yml
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- china_aqi.gemspec
|
98
|
+
- lib/china_aqi.rb
|
99
|
+
- lib/china_aqi/aqi/dynamic/city.rb
|
100
|
+
- lib/china_aqi/aqi/dynamic/city_pro.rb
|
101
|
+
- lib/china_aqi/aqi/dynamic/co.rb
|
102
|
+
- lib/china_aqi/aqi/dynamic/no2.rb
|
103
|
+
- lib/china_aqi/aqi/dynamic/o3.rb
|
104
|
+
- lib/china_aqi/aqi/dynamic/pm10.rb
|
105
|
+
- lib/china_aqi/aqi/dynamic/pm25.rb
|
106
|
+
- lib/china_aqi/aqi/dynamic/so2.rb
|
107
|
+
- lib/china_aqi/aqi/static/global.rb
|
108
|
+
- lib/china_aqi/aqi/static/ranking.rb
|
109
|
+
- lib/china_aqi/aqi/station.rb
|
110
|
+
- lib/china_aqi/base.rb
|
111
|
+
- lib/china_aqi/exceptions.rb
|
112
|
+
- lib/china_aqi/helper/city_stations.rb
|
113
|
+
- lib/china_aqi/utility.rb
|
114
|
+
- lib/china_aqi/version.rb
|
115
|
+
- lib/generators/china_aqi/install/USAGE
|
116
|
+
- lib/generators/china_aqi/install/install_generator.rb
|
117
|
+
- spec/china_aqi_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
homepage: https://github.com/Xuhao/china_aqi
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.0.3
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: China AQI API from PM25.in
|
143
|
+
test_files:
|
144
|
+
- spec/china_aqi_spec.rb
|
145
|
+
- spec/spec_helper.rb
|