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.
- checksums.yaml +4 -4
- data/.travis.yml +15 -12
- data/Gemfile.lock +1 -1
- data/README.md +36 -34
- data/bin/weatai +6 -7
- data/cassettes/all_record.yml +78205 -30153
- data/config/credentials.yml.example +4 -1
- data/lib/weatai/cwb.rb +7 -14
- data/lib/weatai/cwb_api.rb +27 -6
- data/lib/weatai/cwb_psi.rb +32 -0
- data/lib/weatai/cwb_rain.rb +37 -0
- data/lib/weatai/instant.rb +50 -0
- data/lib/weatai/version.rb +3 -3
- data/spec/fixtures/data.yml +123 -123
- data/spec/spec_helper.rb +13 -8
- data/spec/weatai_spec.rb +40 -96
- data/weatai.gemspec +2 -2
- metadata +14 -7
- data/spec/test.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ea59eca779227e54ebbc5e15338a56b3a6d28c6
|
4
|
+
data.tar.gz: 49a1c61b67442fd7f6b5f6616b6cf355824a40b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172cd46e400685628ef734bd3e2bac8e4fd1c70a3586e68976e7e07ab1c88cd2c50a77f959646c483caafae3b556f1ef16f3f17c90495a4d1645d84d6d487f29
|
7
|
+
data.tar.gz: 04e2ac1d685e126620ab9d5250820e14ccbb69ef927b69e669ddf89788668cff29e830a228602839234e892148dac902f2bc0491f4b7083c87c504d165fafcdd
|
data/.travis.yml
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.3.1
|
4
|
-
- 2.2
|
5
|
-
- 2.1
|
6
|
-
branches:
|
7
|
-
only:
|
8
|
-
- master
|
9
|
-
script: bundle exec rake spec
|
10
|
-
env:
|
11
|
-
-
|
12
|
-
-
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.3.1
|
4
|
+
- 2.2
|
5
|
+
- 2.1
|
6
|
+
branches:
|
7
|
+
only:
|
8
|
+
- master
|
9
|
+
script: bundle exec rake spec
|
10
|
+
env:
|
11
|
+
-DATA_ID1=O-A0003-001
|
12
|
+
-DATA_ID2=O-A0002-001
|
13
|
+
-AUTH_KEY=CWB-88ABAD26-6BC8-497A-80E2-2A159654CBF6
|
14
|
+
-FORMAT=xml
|
15
|
+
-TOKEN=YxZhGGgNtUyzW7oi6EPpKQ
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,34 +1,36 @@
|
|
1
|
-
# weatai Gem
|
2
|
-
|
3
|
-
[](https://badge.fury.io/rb/weatai)
|
4
|
-
[](https://travis-ci.org/ISS-SOA/weatai)
|
5
|
-
|
6
|
-
weatai is a gem that specializes in getting data from Central Weather Bureau(Taiwan).
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
If you are working on a project, add this to your Gemfile: `gem 'weatai'`
|
11
|
-
|
12
|
-
For ad hoc installation from command line:
|
13
|
-
|
14
|
-
```$ gem install weatai```
|
15
|
-
|
16
|
-
## Setup Central Weather Bureau(Taiwan) Credentials
|
17
|
-
|
18
|
-
Please setup your Central Weather Bureau credentials by creating an account on Central Weather Bureau Website: http://www.cwb.gov.tw – creating an CWB member account
|
19
|
-
and go to :http://opendata.cwb.gov.tw - login by CWB member account and get credentials (資料使用說明->取得驗證碼)
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
Require weatai gem in your code: `require 'weatai'`
|
24
|
-
|
25
|
-
Supply your CWB credentials to our library in one of two ways:
|
26
|
-
- Setup environment variables: `ENV['
|
27
|
-
-
|
28
|
-
|
29
|
-
```
|
30
|
-
weatai::Config = {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
# weatai Gem
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/weatai)
|
4
|
+
[](https://travis-ci.org/ISS-SOA/weatai)
|
5
|
+
|
6
|
+
weatai is a gem that specializes in getting data from Central Weather Bureau(Taiwan).
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
If you are working on a project, add this to your Gemfile: `gem 'weatai'`
|
11
|
+
|
12
|
+
For ad hoc installation from command line:
|
13
|
+
|
14
|
+
```$ gem install weatai```
|
15
|
+
|
16
|
+
## Setup Central Weather Bureau(Taiwan) Credentials
|
17
|
+
|
18
|
+
Please setup your Central Weather Bureau credentials by creating an account on Central Weather Bureau Website: http://www.cwb.gov.tw – creating an CWB member account
|
19
|
+
and go to :http://opendata.cwb.gov.tw - login by CWB member account and get credentials (資料使用說明->取得驗證碼)
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Require weatai gem in your code: `require 'weatai'`
|
24
|
+
|
25
|
+
Supply your CWB credentials to our library in one of two ways:
|
26
|
+
- Setup environment variables: `ENV['DATA_ID1']` , `ENV['DATA_ID2']`,`ENV['AUTH_KEY']`,`ENV['FORMAT']`,`ENV['TOKEN']`
|
27
|
+
- Or, provide them directly to weatai:
|
28
|
+
|
29
|
+
```
|
30
|
+
weatai::Config = { dataid1: ENV['DATA_ID1'],
|
31
|
+
dataid2: ENV['DATA_ID2'],
|
32
|
+
key: ENV['AUTH_KEY'],
|
33
|
+
format: ENV['FORMAT'],
|
34
|
+
token: ENV['TOKEN']}
|
35
|
+
```
|
36
|
+
|
data/bin/weatai
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
|
4
4
|
require 'weatai'
|
5
5
|
|
6
|
-
|
7
|
-
unless
|
8
|
-
puts 'USAGE: weatai [
|
6
|
+
dataid1 = ARGV[0] || ENV['DATA_ID1']
|
7
|
+
unless dataid1
|
8
|
+
puts 'USAGE: weatai [dataid1]'
|
9
9
|
exit(1)
|
10
10
|
end
|
11
11
|
|
@@ -15,7 +15,6 @@ unless key
|
|
15
15
|
exit(1)
|
16
16
|
end
|
17
17
|
|
18
|
-
weather = CWB::
|
19
|
-
|
20
|
-
|
21
|
-
File.write('data.yml', raw_data.to_yaml)
|
18
|
+
weather = CWB::INSTANT.instant
|
19
|
+
puts weather.to_yaml
|
20
|
+
File.write('data.yml', weather.to_yaml)
|