weather_jp 1.0.3 → 1.0.4

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: f4992900d6163c74063fc1434e7ab0a08cc972c9
4
+ data.tar.gz: 592b2ac4cd43a52cde680f3416c59a73fd88b80f
5
+ SHA512:
6
+ metadata.gz: 37f838fd46bdeb49ec6980cdf67194d5711904acd656a2ba0bff179c63d8fc16579e6d8e7d4af53c9296df5af0fad50d2cb65f094fa694c361ff1fff672b2429
7
+ data.tar.gz: e328c8712472a997cc4a466e7d7d563964469ebec89f0c07fa56028c75923ea2addd881b25f757198cf1c974c492f55c3abe9f517d2f514b3e6797948117c3c8
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
3
+ - 2.0.0
4
4
  - 1.9.3
5
+ - 1.9.2
5
6
  notifications:
6
7
  email: false
7
-
data/HISTORY.md CHANGED
@@ -1,3 +1,12 @@
1
+ v 1.0.4
2
+
3
+ Bug fixes
4
+
5
+ * Rain probability and tempratures are returned as Fixnum. [Sho Hashimoto - @shokai]
6
+ * Can handle tempratures below zero. [Sho Hashimoto - @shokai]
7
+
8
+ ----
9
+
1
10
  v 1.0.0
2
11
 
3
12
  Add parse method to WeatherJp
data/README.md CHANGED
@@ -1,7 +1,4 @@
1
- [![Build Status](https://secure.travis-ci.org/taiki45/weather_jp.png)](http://travis-ci.org/taiki45/weather_jp)
2
-
3
- ## About
4
-
1
+ # weather_jp [![Build Status](https://secure.travis-ci.org/taiki45/weather_jp.png)](http://travis-ci.org/taiki45/weather_jp)
5
2
  Japan weather info API wrapper.
6
3
 
7
4
  Fetch Japan weather info as Ruby object easily.
@@ -18,7 +15,7 @@ Add this line to your application's Gemfile:
18
15
 
19
16
  And then execute:
20
17
 
21
- $ bundle
18
+ $ bundle install
22
19
 
23
20
  Or install it yourself as:
24
21
 
@@ -92,7 +89,7 @@ http://rubydoc.info/gems/weather_jp/
92
89
 
93
90
  ## Author
94
91
 
95
- [@taiki45](https://twitter.com/taiki45)
92
+ [@taiki45](http://taiki45.github.io/)
96
93
 
97
94
  ## Contributing
98
95
 
@@ -1,3 +1,3 @@
1
1
  module WeatherJp
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
data/lib/weather_jp.rb CHANGED
@@ -180,9 +180,12 @@ module WeatherJp
180
180
  h = Hash.new
181
181
  h[:day] = i.slice(/(.*?):\s+(.*?)\./, 1)
182
182
  h[:forecast] = i.slice(/(.*?):\s+(.*?)\./, 2)
183
- h[:max_temp] = i.slice(/(最高).*?(\d+)/u, 2)
184
- h[:min_temp] = i.slice(/(最低).*?(\d+)/u, 2)
183
+ h[:max_temp] = i.slice(/(最高).*?(-?\d+)/u, 2)
184
+ h[:min_temp] = i.slice(/(最低).*?(-?\d+)/u, 2)
185
185
  h[:rain] = i.slice(/(降水確率).*?(\d+)/u, 2)
186
+ [:max_temp, :min_temp, :rain].each do |j|
187
+ h[j] = h[j].to_i if h[j]
188
+ end
186
189
  if h[:day].match /の天気/u
187
190
  h[:day] = h[:day].slice /(.*)の天気/u, 1
188
191
  end
data/spec/wrapper_spec.rb CHANGED
@@ -4,17 +4,19 @@ require 'spec_helper'
4
4
  describe "Wrapper" do
5
5
  describe ".set_weathers" do
6
6
  it "should make vaild data" do
7
- expect = [{:day=>"今日", :forecast=>"晴のち雨", :max_temp=>"29", :min_temp=>"24", :rain=>"80"},
8
- {:day=>"明日", :forecast=>"雨のち晴", :max_temp=>"30", :min_temp=>"22", :rain=>"60"},
9
- {:day=>"火曜日", :forecast=>"曇時々晴", :max_temp=>"27", :min_temp=>"22", :rain=>"30"},
10
- {:day=>"水曜日", :forecast=>"曇時々雨", :max_temp=>"25", :min_temp=>"20", :rain=>"50"},
11
- {:day=>"木曜日", :forecast=>"曇り", :max_temp=>"28", :min_temp=>"20", :rain=>"40"}
7
+ expect = [{:day=>"今日", :forecast=>"晴のち雨", :max_temp=>29, :min_temp=>24, :rain=>80},
8
+ {:day=>"明日", :forecast=>"雨のち晴", :max_temp=>30, :min_temp=>22, :rain=>60},
9
+ {:day=>"火曜日", :forecast=>"曇時々晴", :max_temp=>27, :min_temp=>22, :rain=>30},
10
+ {:day=>"水曜日", :forecast=>"曇時々雨", :max_temp=>25, :min_temp=>20, :rain=>50},
11
+ {:day=>"木曜日", :forecast=>"曇り", :max_temp=>28, :min_temp=>20, :rain=>40},
12
+ {:day=>"金曜日", :forecast=>"曇り", :max_temp=>-3, :min_temp=>-20, :rain=>40}
12
13
  ]
13
14
  dummy_data = ["今日: 晴のち雨. 最低: 24°C. 最高: 29°C. 降水確率: 80",
14
15
  "明日: 雨のち晴. 最低: 22°C. 最高: 30°C. 降水確率: 60",
15
16
  "火曜日: 曇時々晴. 最低: 22°C. 最高: 27°C. 降水確率: 30",
16
17
  "水曜日: 曇時々雨. 最低: 20°C. 最高: 25°C. 降水確率: 50",
17
- "木曜日: 曇り. 最低: 20°C. 最高: 28°C. 降水確率: 40"
18
+ "木曜日: 曇り. 最低: 20°C. 最高: 28°C. 降水確率: 40",
19
+ "金曜日: 曇り. 最低: -20°C. 最高: -3°C. 降水確率: 40"
18
20
  ]
19
21
  WeatherJp::Wrapper.set_weathers(dummy_data).should == expect
20
22
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
5
- prerelease:
4
+ version: 1.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Taiki ONO
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-08 00:00:00.000000000 Z
11
+ date: 2013-05-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nokogiri
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,49 +27,43 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.9.2
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.9.2
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec-core
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Fetch Japan weather info as Ruby object easily.
@@ -103,33 +94,26 @@ files:
103
94
  - weather_jp.gemspec
104
95
  homepage: http://taiki45.github.com/weather_jp
105
96
  licenses: []
97
+ metadata: {}
106
98
  post_install_message:
107
99
  rdoc_options: []
108
100
  require_paths:
109
101
  - lib
110
102
  required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
103
  requirements:
113
- - - ! '>='
104
+ - - '>='
114
105
  - !ruby/object:Gem::Version
115
106
  version: '0'
116
- segments:
117
- - 0
118
- hash: -4408068253640136415
119
107
  required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
108
  requirements:
122
- - - ! '>='
109
+ - - '>='
123
110
  - !ruby/object:Gem::Version
124
111
  version: '0'
125
- segments:
126
- - 0
127
- hash: -4408068253640136415
128
112
  requirements: []
129
113
  rubyforge_project:
130
- rubygems_version: 1.8.23
114
+ rubygems_version: 2.0.0
131
115
  signing_key:
132
- specification_version: 3
116
+ specification_version: 4
133
117
  summary: Japan weather info API wrapper.
134
118
  test_files:
135
119
  - spec/day_weather_spec.rb