weather_hacker 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,7 @@ class WeatherHacker
18
18
  city_id = city_id_by_zipcode(zipcode) or return
19
19
  query = { :city => city_id }.merge(opts)
20
20
  hash = get WEATHER_URL, :query => query
21
- forecast = get_forecast(hash, opts)
21
+ forecast = get_forecast(hash, opts) or return
22
22
 
23
23
  weather = forecast["telop"]
24
24
  max = forecast["temperature"]["max"]
@@ -47,7 +47,7 @@ class WeatherHacker
47
47
  def get_forecast(hash, opts)
48
48
  days = ['today', 'tomorrow', 'dayaftertomorrow']
49
49
  day_num = 0
50
- day_num = days.find_index(opts['day']) unless opts['day'].nil?
50
+ day_num = days.find_index(opts[:day]) unless opts[:day].nil?
51
51
  hash['forecasts'][day_num]
52
52
  end
53
53
 
@@ -1,3 +1,3 @@
1
1
  class WeatherHacker
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -37,6 +37,19 @@ describe "WeatherHacker::Client" do
37
37
  end
38
38
  end
39
39
 
40
+ describe "#get_forecast" do
41
+ hash = { 'forecasts' => ['today', 'tomorrow', 'dayaftertomorrow'] }
42
+ it "should return forecasts today" do
43
+ get_forecast = @client.send(:get_forecast, hash, {})
44
+ get_forecast.should == 'today'
45
+ end
46
+ ['today', 'tomorrow', 'dayaftertomorrow'].each {|day|
47
+ it "should return forecasts #{day}" do
48
+ @client.send(:get_forecast, hash, {:day => day}).should == day
49
+ end
50
+ }
51
+ end
52
+
40
53
  shared_examples_for "having area table" do
41
54
  it "should have area table" do
42
55
  @client.send(:id_by_city).keys.size.should_not == 0
metadata CHANGED
@@ -1,97 +1,110 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather_hacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Ryo NAKAMURA
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-05-11 00:00:00.000000000 Z
12
+ date: 2013-05-13 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 0.9.2
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.9.2
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: httparty
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: awesome_print
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: simplecov
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: simplecov-vim
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  description: Library for Livedoor Weather Web Service
@@ -122,26 +135,33 @@ files:
122
135
  - weather_hacker.gemspec
123
136
  homepage: http://r7kamura.github.com/weather_hacker/
124
137
  licenses: []
125
- metadata: {}
126
138
  post_install_message:
127
139
  rdoc_options: []
128
140
  require_paths:
129
141
  - lib
130
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
+ none: false
131
144
  requirements:
132
- - - '>='
145
+ - - ! '>='
133
146
  - !ruby/object:Gem::Version
134
147
  version: '0'
148
+ segments:
149
+ - 0
150
+ hash: 4192011002620080448
135
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
+ none: false
136
153
  requirements:
137
- - - '>='
154
+ - - ! '>='
138
155
  - !ruby/object:Gem::Version
139
156
  version: '0'
157
+ segments:
158
+ - 0
159
+ hash: 4192011002620080448
140
160
  requirements: []
141
161
  rubyforge_project:
142
- rubygems_version: 2.0.0
162
+ rubygems_version: 1.8.23
143
163
  signing_key:
144
- specification_version: 4
164
+ specification_version: 3
145
165
  summary: Weather Forecaster via Livedoor Weather Web Service
146
166
  test_files:
147
167
  - spec/fixtures/id_by_city.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 1fda08dc8d56cf2c30b93319960bee84a46913e3
4
- data.tar.gz: a1540b074c12bdd2b81acc8495d4388a28b6b14f
5
- SHA512:
6
- metadata.gz: a1775d1e8922cb4883ab2b96747f009ffdf3025b74da890d362a0897854290fe825b942875f3c8e336f0cec88e20698c6a6cfb30cc9080ab25774891a1a34d59
7
- data.tar.gz: 0a631c08a76ddcc95c43aebbae9567f672bcffac22bfe703cb133a1b53cda6982c046c48733574608943f8f718f6a62b227898c109cb3e14ffccb98fdeb565a1