weatai 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f5b48d2f057100f318d6e55d2e30dda3610b8b9
4
+ data.tar.gz: 14372102e2a45d7d61ea3418634cb9f84a5d4596
5
+ SHA512:
6
+ metadata.gz: c705c968e1c35b58cadc6974601674a69fd703ea15bafe1589e20b1a804cfa94fe586b82ad1a2bc752e4ad6f4de48356e3ba5ac11737eecfac16e11f7f0f5252
7
+ data.tar.gz: ab5d3f185e8141892db1e5b86e103453da9d3b9d31b54c7615ffbf55b26fd364b5026467aa149444c598dc117030d0da9bb421a87eaa2568c16b39ceaeb4316b
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ coverage/
2
+ config/
3
+ cassettes/
4
+ *.gem
5
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,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_ID=O-A0003-001
12
+ -AUTH_KEY=CWB-88ABAD26-6BC8-497A-80E2-2A159654CBF6
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ gem 'http'
5
+ #gem 'yaml'/
6
+ #gem 'activesupport -v 4.2.6'/
7
+
8
+ gem 'activesupport'
9
+ gem 'minitest'
10
+ gem 'minitest-rg'
11
+ gem 'rake'
12
+ gem 'vcr'
13
+ gem 'webmock'
14
+ gem 'simplecov'
15
+
16
+ gem 'flog'
17
+ gem 'flay'
18
+ gem 'rubocop'
19
+
20
+
21
+
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (5.0.0.1)
5
+ concurrent-ruby (~> 1.0, >= 1.0.2)
6
+ i18n (~> 0.7)
7
+ minitest (~> 5.1)
8
+ tzinfo (~> 1.1)
9
+ addressable (2.4.0)
10
+ ast (2.3.0)
11
+ concurrent-ruby (1.0.2)
12
+ crack (0.4.3)
13
+ safe_yaml (~> 1.0.0)
14
+ docile (1.1.5)
15
+ domain_name (0.5.20160826)
16
+ unf (>= 0.0.5, < 1.0.0)
17
+ erubis (2.7.0)
18
+ flay (2.8.1)
19
+ erubis (~> 2.7.0)
20
+ path_expander (~> 1.0)
21
+ ruby_parser (~> 3.0)
22
+ sexp_processor (~> 4.0)
23
+ flog (4.4.0)
24
+ path_expander (~> 1.0)
25
+ ruby_parser (~> 3.1, > 3.1.0)
26
+ sexp_processor (~> 4.4)
27
+ hashdiff (0.3.0)
28
+ http (2.0.3)
29
+ addressable (~> 2.3)
30
+ http-cookie (~> 1.0)
31
+ http-form_data (~> 1.0.1)
32
+ http_parser.rb (~> 0.6.0)
33
+ http-cookie (1.0.3)
34
+ domain_name (~> 0.5)
35
+ http-form_data (1.0.1)
36
+ http_parser.rb (0.6.0)
37
+ i18n (0.7.0)
38
+ json (2.0.2)
39
+ minitest (5.9.1)
40
+ minitest-rg (5.2.0)
41
+ minitest (~> 5.0)
42
+ parser (2.3.1.4)
43
+ ast (~> 2.2)
44
+ path_expander (1.0.0)
45
+ powerpack (0.1.1)
46
+ rainbow (2.1.0)
47
+ rake (11.3.0)
48
+ rubocop (0.44.1)
49
+ parser (>= 2.3.1.1, < 3.0)
50
+ powerpack (~> 0.1)
51
+ rainbow (>= 1.99.1, < 3.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (~> 1.0, >= 1.0.1)
54
+ ruby-progressbar (1.8.1)
55
+ ruby_parser (3.8.3)
56
+ sexp_processor (~> 4.1)
57
+ safe_yaml (1.0.4)
58
+ sexp_processor (4.7.0)
59
+ simplecov (0.12.0)
60
+ docile (~> 1.1.0)
61
+ json (>= 1.8, < 3)
62
+ simplecov-html (~> 0.10.0)
63
+ simplecov-html (0.10.0)
64
+ thread_safe (0.3.5)
65
+ tzinfo (1.2.2)
66
+ thread_safe (~> 0.1)
67
+ unf (0.1.4)
68
+ unf_ext
69
+ unf_ext (0.0.7.2)
70
+ unf_ext (0.0.7.2-x64-mingw32)
71
+ unicode-display_width (1.1.1)
72
+ vcr (3.0.3)
73
+ webmock (2.1.0)
74
+ addressable (>= 2.3.6)
75
+ crack (>= 0.3.2)
76
+ hashdiff
77
+
78
+ PLATFORMS
79
+ ruby
80
+ x64-mingw32
81
+
82
+ DEPENDENCIES
83
+ activesupport
84
+ flay
85
+ flog
86
+ http
87
+ minitest
88
+ minitest-rg
89
+ rake
90
+ rubocop
91
+ simplecov
92
+ vcr
93
+ webmock
94
+
95
+ BUNDLED WITH
96
+ 1.13.6
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT LICENSE
2
+
3
+ Copyright (c) soainfinite888 <####@####.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # weatai Gem
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/weatai.svg)](https://badge.fury.io/rb/weatai)
4
+ [![Build Status](https://travis-ci.org/soainfinite888/weatai.svg?branch=master)](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_ID']` and `ENV['KEY']`
27
+ - or, provide them directly to weatai:
28
+
29
+ ```
30
+ weatai::Config = { dataid: ENV['DATA_ID'],
31
+                   key: ENV['KEY'] }
32
+ ```
33
+
34
+ See the following example code for more usage details:
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ desc 'run tests'
2
+ task :spec do
3
+ sh 'ruby spec/weatai_spec.rb'
4
+ end
5
+
6
+ namespace :quality do
7
+ desc 'run all quality checks'
8
+ task all: [:rubocop, :flog, :flay]
9
+
10
+ desc 'run quality:flog in lib'
11
+ task :flog do
12
+ sh 'flog lib/'
13
+ end
14
+
15
+ desc 'run quality:flay in lib'
16
+ task :flay do
17
+ sh 'flay lib/'
18
+ end
19
+
20
+ desc 'run quality:rubocop in lib'
21
+ task :rubocop do
22
+ sh 'rubocop lib/'
23
+ end
24
+ end
data/bin/weatai ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
4
+ require 'weatai'
5
+
6
+ dataid = ARGV[0] || ENV['DATA_ID']
7
+ unless dataid
8
+ puts 'USAGE: weatai [dataid]'
9
+ exit(1)
10
+ end
11
+
12
+ key = ENV['AUTH_KEY']
13
+ unless key
14
+ puts 'USAGE: weatai [key]'
15
+ exit(1)
16
+ end
17
+
18
+ weather = CWB::Weather.find(dataid: dataid)
19
+ raw_data = weather.instant_weather
20
+ puts raw_data
21
+ File.write('../spec/fixtures/data.yml', raw_data.to_yaml)