weatai 0.1.2 → 0.1.3

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.
data/spec/weatai_spec.rb CHANGED
@@ -1,96 +1,40 @@
1
- require_relative 'spec_helper.rb'
2
- require 'yaml'
3
-
4
- describe 'CWB specifications' do
5
-
6
- VCR.configure do |c|
7
- c.cassette_library_dir = 'cassettes'
8
- c.hook_into :webmock
9
-
10
- # c.filter_sensitive_data('<KEY>') { CREDENTIALS[:key] }
11
- end
12
-
13
- before do
14
- VCR.insert_cassette 'all_record', record: :new_episodes
15
- # @cwb_api = CWB::CWBApi.config
16
-
17
- end
18
-
19
- after do
20
- VCR.eject_cassette
21
- end
22
-
23
- # test 01
24
- it 'should be able to get raw info' do
25
- # CWB::CWBApi.config
26
- CWB::CWBApi.raw_info('O-A0003-001').wont_be_empty
27
- end
28
- =begin
29
- #test 02
30
- it 'should be able to download the data file in hash format)' do
31
- CWB_RESPONSE.kind_of?(Hash).must_equal true
32
-
33
- end
34
-
35
- # test 03
36
- it 'should be able to get instant_weather in hash format' do
37
- testWeather = CWB::Weather.new(
38
- @cwb_api
39
- )
40
- testWeather.instant_weather.kind_of?(Hash).must_equal true
41
- end
42
-
43
- #test 04
44
- it 'should get name of every Weather Stations' do
45
- testWeather = CWB::Weather.new(
46
- @cwb_api
47
- )
48
- instant_weather = testWeather.instant_weather
49
- WeatherStations.each do |name|
50
- CWB_RESPONSE.has_key?(name).must_equal true
51
- end
52
-
53
- end
54
-
55
-
56
- # test 05
57
- it 'should get temperature of every Weather Stations' do
58
- testWeather = CWB::Weather.new(
59
- @cwb_api
60
- )
61
- instant_weather = testWeather.instant_weather
62
- puts instant_weather["烏坵"]
63
- WeatherStations.each do |name|
64
- instant_weather[name].has_key?('TEMP').must_equal true
65
-
66
- end
67
-
68
- WeatherStations.each do |name|
69
- instant_weather[name]['TEMP'].wont_be_empty
70
- end
71
-
72
- end
73
-
74
-
75
- # test 06
76
- it 'should get time of every Weather Stations' do
77
- testWeather = CWB::Weather.new(
78
- @cwb_api
79
- )
80
- instant_weather = testWeather.instant_weather
81
- WeatherStations.each do |name|
82
- instant_weather[name].has_key?('time').must_equal true
83
- end
84
-
85
- WeatherStations.each do |name|
86
- instant_weather[name]['time'].wont_be_empty
87
- end
88
-
89
- end
90
- =end
91
-
92
-
93
-
94
-
95
-
96
- end
1
+ require_relative 'spec_helper.rb'
2
+ require 'yaml'
3
+
4
+ describe 'CWB specifications' do
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = 'cassettes'
8
+ c.hook_into :webmock
9
+
10
+ # c.filter_sensitive_data('<KEY>') { CREDENTIALS[:key] }
11
+ end
12
+
13
+ before do
14
+ VCR.insert_cassette 'all_record', record: :new_episodes
15
+ # @cwb_api = CWB::CWBApi.config
16
+
17
+ end
18
+
19
+ after do
20
+ VCR.eject_cassette
21
+ end
22
+
23
+ # test 01
24
+ it 'should be able to get raw info' do
25
+ CWB::CWBApi.raw_info1('O-A0003-001').wont_be_empty
26
+ end
27
+
28
+ # test 02
29
+ it 'should be able to get instant_weather in hash format' do
30
+ CWB::INSTANT.instant.kind_of?(Hash).must_equal true
31
+ end
32
+
33
+ #test 03
34
+ it 'should get name of every Weather Stations' do
35
+ test_instant_weather = CWB::INSTANT.instant
36
+ WeatherStations.each do |name|
37
+ test_instant_weather.has_key?(name).must_equal true
38
+ end
39
+ end
40
+ end
data/weatai.gemspec CHANGED
@@ -9,14 +9,14 @@ Gem::Specification.new do |s|
9
9
  s.summary = 'Get weather content from central weather bureau(Taiwan);'
10
10
  s.description = 'Extracts temperature and humidity for different city'
11
11
  s.authors = ['soainfinite888']
12
- s.email = ['wer321011@gmail.com']
12
+ s.email = ['lisa5432126@gmail.com']
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- spec/*`.split("\n")
16
16
  s.executables << 'weatai'
17
17
 
18
18
  s.add_runtime_dependency 'http', '~> 2.0'
19
- s.add_runtime_dependency 'activesupport', '~> 5.0'
19
+ s.add_runtime_dependency 'activesupport', '~>4.2', '>= 4.2.6'
20
20
 
21
21
  s.add_development_dependency 'minitest', '~> 5.9'
22
22
  s.add_development_dependency 'minitest-rg', '~> 5.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weatai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - soainfinite888
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -30,14 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '4.2'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 4.2.6
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '5.0'
43
+ version: '4.2'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 4.2.6
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: minitest
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +172,7 @@ dependencies:
166
172
  version: '0.42'
167
173
  description: Extracts temperature and humidity for different city
168
174
  email:
169
- - wer321011@gmail.com
175
+ - lisa5432126@gmail.com
170
176
  executables:
171
177
  - weatai
172
178
  extensions: []
@@ -185,10 +191,12 @@ files:
185
191
  - lib/weatai.rb
186
192
  - lib/weatai/cwb.rb
187
193
  - lib/weatai/cwb_api.rb
194
+ - lib/weatai/cwb_psi.rb
195
+ - lib/weatai/cwb_rain.rb
196
+ - lib/weatai/instant.rb
188
197
  - lib/weatai/version.rb
189
198
  - spec/fixtures/data.yml
190
199
  - spec/spec_helper.rb
191
- - spec/test.rb
192
200
  - spec/weatai_spec.rb
193
201
  - weatai.gemspec
194
202
  homepage: https://github.com/soainfinite888/weatai
@@ -218,5 +226,4 @@ summary: Get weather content from central weather bureau(Taiwan);
218
226
  test_files:
219
227
  - spec/fixtures/data.yml
220
228
  - spec/spec_helper.rb
221
- - spec/test.rb
222
229
  - spec/weatai_spec.rb
data/spec/test.rb DELETED
@@ -1,92 +0,0 @@
1
- require 'active_support/all'
2
- require 'active_support/core_ext/hash'
3
- require 'yaml'
4
- require 'http'
5
-
6
-
7
- require_relative '../lib/cwb.rb'
8
- require_relative '../lib/cwb_api.rb'
9
-
10
- CWB_RESPONSE = YAML.load(File.read('./fixtures/data.yml'))
11
- CREDENTIALS = YAML.load(File.read('../config/credentials.yml'))
12
- WeatherStations = ['基隆','淡水','板橋','竹子湖','鞍部','新竹','臺中','澎湖',
13
- '日月潭','阿里山','玉山','嘉義','高雄','恆春','宜蘭','蘇澳',
14
- '花蓮','成功','臺東','大武','蘭嶼','彭佳嶼','東吉島','永康',
15
- '金門(合)','拉拉山','武陵','太魯閣','新店','臺北','彰師大',
16
- '臺南','合歡山莊','吉貝','東沙','金門','馬祖','麥寮','新屋',
17
- '古坑','九宮碼頭']
18
- WeatherStationsAmount = 41
19
-
20
- @cwb_api = CWB::CWBApi.new(
21
- data_id: CREDENTIALS[:key],
22
- )
23
-
24
- testCWBApi = CWB::Weather.new(
25
- @cwb_api
26
- )
27
-
28
-
29
-
30
- =begin
31
-
32
- #require_relative '../lib/cwb.rb'
33
- CWB_RESPONSE = YAML.load(File.read('./fixtures/data.yml'))
34
- #CREDENTIALS ssssssssss= YAML.load(File.read('config/credentials.yml'))
35
- #CWB_RESPONSE = YAML.load(File.read('./fixtures/data.yml'))
36
- #RESULTS = YAML.load(File.read('spec/fixtures/results.yml'))
37
-
38
- WeatherStations = ['基隆','淡水','板橋','竹子湖','鞍部','新竹','臺中','澎湖',
39
- '日月潭','阿里山','玉山','嘉義','高雄','恆春','宜蘭','蘇澳',
40
- '花蓮','成功','臺東','大武','蘭嶼','彭佳嶼','東吉島','永康',
41
- '金門(合)','拉拉山','武陵','太魯閣','新店','臺北','彰師大',
42
- '臺南','合歡山莊','吉貝','東沙','金門','馬祖','麥寮','新屋',
43
- '古坑','九宮碼頭']
44
-
45
- WeatherStationsAmount = 41
46
-
47
- WeatherStations.each do |name|
48
- puts CWB_RESPONSE[name]['TEMP']
49
- end
50
-
51
-
52
- WeatherStations.each do |name|
53
- puts name
54
- end
55
-
56
-
57
-
58
-
59
- while WeatherStationsAmount > 0
60
- puts WeatherStations[WeatherStationsAmount-1]
61
- WeatherStationsAmount = WeatherStationsAmount - 1
62
- end
63
-
64
-
65
-
66
- puts CWB_RESPONSE["基隆"]has_key?'TEMP'
67
-
68
-
69
-
70
-
71
- if CWB_RESPONSE.kind_of?(Hash)
72
- puts "hash"
73
- else
74
- puts "not hash"
75
-
76
- end
77
-
78
- puts CWB_RESPONSE.has_key?'基隆'
79
-
80
-
81
-
82
-
83
-
84
- if CWB_RESPONSE == false
85
- puts "空的"
86
- else
87
- puts "有東西"
88
- end
89
-
90
-
91
- =end
92
-