smart_weather 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,240 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "name": "北京",
5
+ "abbr": "京",
6
+ "code": "10101",
7
+ "spelling": "BJ"
8
+ },
9
+ {
10
+ "id": 2,
11
+ "name": "上海",
12
+ "abbr": "沪",
13
+ "code": "10102",
14
+ "spelling": "SH"
15
+ },
16
+ {
17
+ "id": 3,
18
+ "name": "天津",
19
+ "abbr": "津",
20
+ "code": "10103",
21
+ "spelling": "TJ"
22
+ },
23
+ {
24
+ "id": 4,
25
+ "name": "重庆",
26
+ "abbr": "渝",
27
+ "code": "10104",
28
+ "spelling": "CQ"
29
+ },
30
+ {
31
+ "id": 5,
32
+ "name": "黑龙江",
33
+ "abbr": "黑",
34
+ "code": "10105",
35
+ "spelling": "HLJ"
36
+ },
37
+ {
38
+ "id": 6,
39
+ "name": "吉林",
40
+ "abbr": "吉",
41
+ "code": "10106",
42
+ "spelling": "JL"
43
+ },
44
+ {
45
+ "id": 7,
46
+ "name": "辽宁",
47
+ "abbr": "辽",
48
+ "code": "10107",
49
+ "spelling": "LN"
50
+ },
51
+ {
52
+ "id": 8,
53
+ "name": "内蒙古",
54
+ "abbr": "蒙",
55
+ "code": "10108",
56
+ "spelling": "NMG"
57
+ },
58
+ {
59
+ "id": 9,
60
+ "name": "河北",
61
+ "abbr": "冀",
62
+ "code": "10109",
63
+ "spelling": "HB"
64
+ },
65
+ {
66
+ "id": 10,
67
+ "name": "山西",
68
+ "abbr": "晋",
69
+ "code": "10110",
70
+ "spelling": "XS"
71
+ },
72
+ {
73
+ "id": 11,
74
+ "name": "陕西",
75
+ "abbr": "陕",
76
+ "code": "10111",
77
+ "spelling": "SX"
78
+ },
79
+ {
80
+ "id": 12,
81
+ "name": "山东",
82
+ "abbr": "鲁",
83
+ "code": "10112",
84
+ "spelling": "SD"
85
+ },
86
+ {
87
+ "id": 13,
88
+ "name": "新疆",
89
+ "abbr": "新",
90
+ "code": "10113",
91
+ "spelling": "XJ"
92
+ },
93
+ {
94
+ "id": 14,
95
+ "name": "西藏",
96
+ "abbr": "藏",
97
+ "code": "10114",
98
+ "spelling": "XZ"
99
+ },
100
+ {
101
+ "id": 15,
102
+ "name": "青海",
103
+ "abbr": "青",
104
+ "code": "10115",
105
+ "spelling": "QH"
106
+ },
107
+ {
108
+ "id": 16,
109
+ "name": "甘肃",
110
+ "abbr": "甘",
111
+ "code": "10116",
112
+ "spelling": "GS"
113
+ },
114
+ {
115
+ "id": 17,
116
+ "name": "宁夏",
117
+ "abbr": "宁",
118
+ "code": "10117",
119
+ "spelling": "NX"
120
+ },
121
+ {
122
+ "id": 18,
123
+ "name": "河南",
124
+ "abbr": "豫",
125
+ "code": "10118",
126
+ "spelling": "HN"
127
+ },
128
+ {
129
+ "id": 19,
130
+ "name": "江苏",
131
+ "abbr": "苏",
132
+ "code": "10119",
133
+ "spelling": "JS"
134
+ },
135
+ {
136
+ "id": 20,
137
+ "name": "湖北",
138
+ "abbr": "鄂",
139
+ "code": "10120",
140
+ "spelling": "FB"
141
+ },
142
+ {
143
+ "id": 21,
144
+ "name": "浙江",
145
+ "abbr": "浙",
146
+ "code": "10121",
147
+ "spelling": "ZJ"
148
+ },
149
+ {
150
+ "id": 22,
151
+ "name": "安徽",
152
+ "abbr": "皖",
153
+ "code": "10122",
154
+ "spelling": "AH"
155
+ },
156
+ {
157
+ "id": 23,
158
+ "name": "福建",
159
+ "abbr": "闽",
160
+ "code": "10123",
161
+ "spelling": "FJ"
162
+ },
163
+ {
164
+ "id": 24,
165
+ "name": "江西",
166
+ "abbr": "赣",
167
+ "code": "10124",
168
+ "spelling": "JX"
169
+ },
170
+ {
171
+ "id": 25,
172
+ "name": "湖南",
173
+ "abbr": "湘",
174
+ "code": "10125",
175
+ "spelling": "HUN"
176
+ },
177
+ {
178
+ "id": 26,
179
+ "name": "贵州",
180
+ "abbr": "贵",
181
+ "code": "10126",
182
+ "spelling": "GZ"
183
+ },
184
+ {
185
+ "id": 27,
186
+ "name": "四川",
187
+ "abbr": "川",
188
+ "code": "10127",
189
+ "spelling": "SC"
190
+ },
191
+ {
192
+ "id": 28,
193
+ "name": "广东",
194
+ "abbr": "粤",
195
+ "code": "10128",
196
+ "spelling": "GD"
197
+ },
198
+ {
199
+ "id": 29,
200
+ "name": "云南",
201
+ "abbr": "云",
202
+ "code": "10129",
203
+ "spelling": "YN"
204
+ },
205
+ {
206
+ "id": 30,
207
+ "name": "广西",
208
+ "abbr": "桂",
209
+ "code": "10130",
210
+ "spelling": "GX"
211
+ },
212
+ {
213
+ "id": 31,
214
+ "name": "海南",
215
+ "abbr": "琼",
216
+ "code": "10131",
217
+ "spelling": "HAN"
218
+ },
219
+ {
220
+ "id": 32,
221
+ "name": "香港",
222
+ "abbr": "港",
223
+ "code": "10132",
224
+ "spelling": "XG"
225
+ },
226
+ {
227
+ "id": 33,
228
+ "name": "澳门",
229
+ "abbr": "澳",
230
+ "code": "10133",
231
+ "spelling": "AM"
232
+ },
233
+ {
234
+ "id": 34,
235
+ "name": "台湾",
236
+ "abbr": "台",
237
+ "code": "10134",
238
+ "spelling": "TW"
239
+ }
240
+ ]
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ module SmartWeather
4
+ VERSION = "0.0.1"
5
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'smart_weather/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "smart_weather"
8
+ spec.version = SmartWeather::VERSION
9
+ spec.authors = ["Spirit"]
10
+ spec.email = ["neverlandxy.naix@gmail.com"]
11
+ spec.summary = %q{中国气象网 SmartWeatherAPI Ruby SDK}
12
+ spec.description = %q{中国气象网 SmartWeatherAPI Ruby SDK}
13
+ spec.homepage = "https://github.com/awesome-api/smart_weather"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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_dependency "restclient_api_base", "~> 0.1"
22
+ spec.add_dependency "oj", "~> 2.10"
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'minitest/autorun'
4
+ require File.dirname(__FILE__) + '/../lib/smart_weather'
5
+
6
+ if Minitest.const_defined?('Test')
7
+ # We're on Minitest 5+. Nothing to do here.
8
+ else
9
+ # Minitest 4 doesn't have Minitest::Test yet.
10
+ Minitest::Test = MiniTest::Unit::TestCase
11
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/test_helper.rb'
4
+
5
+ class TestSmartWeather < Minitest::Test
6
+
7
+ def setup
8
+ @provinces = SmartWeather::Province.all
9
+ @cities = SmartWeather::City.all
10
+
11
+ SmartWeather.app_id = 'Your app id'
12
+ SmartWeather.private_key = 'Your private key'
13
+ end
14
+
15
+ def test_provinces_data
16
+ assert_equal true, @provinces.is_a?(Array)
17
+ assert_equal true, @provinces.first.is_a?(Hash)
18
+ assert_equal 1, @provinces.first[:id]
19
+ assert_equal '北京', @provinces.first[:name]
20
+ end
21
+
22
+ def test_cities_data
23
+ assert_equal true, @cities.is_a?(Array)
24
+ assert_equal true, @cities.first.is_a?(Hash)
25
+ assert_equal 1, @cities.first[:id]
26
+ assert_equal '101010100', @cities.first[:code]
27
+ end
28
+
29
+ def test_get_weather
30
+ assert_equal true, SmartWeather.get_observe(areaid: '101010100').is_a?(Hash)
31
+ assert_equal true, SmartWeather.get_forecast(areaid: '101010100').is_a?(Hash)
32
+ assert_equal true, SmartWeather.get_index(areaid: '101010100').is_a?(Hash)
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smart_weather
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Spirit
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: restclient_api_base
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oj
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.10'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: "中国气象网 SmartWeatherAPI Ruby SDK"
70
+ email:
71
+ - neverlandxy.naix@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/smart_weather.rb
82
+ - lib/smart_weather/data.rb
83
+ - lib/smart_weather/data/cities.json
84
+ - lib/smart_weather/data/provinces.json
85
+ - lib/smart_weather/version.rb
86
+ - smart_weather.gemspec
87
+ - test/test_helper.rb
88
+ - test/test_smart_weather.rb
89
+ homepage: https://github.com/awesome-api/smart_weather
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: "中国气象网 SmartWeatherAPI Ruby SDK"
113
+ test_files:
114
+ - test/test_helper.rb
115
+ - test/test_smart_weather.rb
116
+ has_rdoc: