google-weather 0.2.0 → 0.3.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.
- data/.gitignore +2 -0
- data/Gemfile +9 -0
- data/Rakefile +0 -22
- data/bin/weather +32 -10
- data/google-weather.gemspec +1 -2
- data/lib/google_weather.rb +42 -13
- data/lib/google_weather/version.rb +3 -0
- data/test/fixtures/coords.xml +1 -0
- data/test/fixtures/london.xml +1 -0
- data/test/google_weather_test.rb +177 -76
- data/test/test_helper.rb +4 -0
- metadata +15 -29
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -1,15 +1,6 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
Rake::RDocTask.new do |rdoc|
|
6
|
-
rdoc.rdoc_dir = 'rdoc'
|
7
|
-
rdoc.title = 'google-weather'
|
8
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
9
|
-
rdoc.rdoc_files.include('README*')
|
10
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
11
|
-
end
|
12
|
-
|
13
4
|
require 'rake/testtask'
|
14
5
|
Rake::TestTask.new(:test) do |test|
|
15
6
|
test.libs << 'lib' << 'test'
|
@@ -17,17 +8,4 @@ Rake::TestTask.new(:test) do |test|
|
|
17
8
|
test.verbose = false
|
18
9
|
end
|
19
10
|
|
20
|
-
begin
|
21
|
-
require 'rcov/rcovtask'
|
22
|
-
Rcov::RcovTask.new do |test|
|
23
|
-
test.libs << 'test'
|
24
|
-
test.pattern = 'test/**/*_test.rb'
|
25
|
-
test.verbose = true
|
26
|
-
end
|
27
|
-
rescue LoadError
|
28
|
-
task :rcov do
|
29
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
11
|
task :default => :test
|
data/bin/weather
CHANGED
@@ -1,16 +1,38 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
require 'rubygems'
|
3
3
|
require File.dirname(__FILE__) + '/../lib/google_weather'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
path = Pathname(ENV["HOME"]).join('.weather')
|
6
|
+
|
7
|
+
if path.exist? && ARGV.size == 0
|
8
|
+
param = path.read
|
9
|
+
else
|
10
|
+
if ARGV.size == 0
|
11
|
+
puts 'Weather [Powered by Google]'
|
12
|
+
puts 'USAGE: weather [zip code or city]'
|
13
|
+
puts 'EXAMPLES:'
|
14
|
+
puts ' weather 46544'
|
15
|
+
puts ' weather "mishawaka, in"'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
param = ARGV[0]
|
12
20
|
end
|
13
21
|
|
14
|
-
weather = GoogleWeather.new(
|
22
|
+
weather = GoogleWeather.new(param)
|
15
23
|
current = weather.current_conditions
|
16
|
-
puts
|
24
|
+
puts
|
25
|
+
puts "#{weather.forecast_information.city}"
|
26
|
+
puts "#{current.temp_f}° #{current.condition}"
|
27
|
+
puts "#{current.wind_condition}"
|
28
|
+
puts "#{current.humidity}"
|
29
|
+
puts
|
30
|
+
|
31
|
+
weather.forecast_conditions.each do |condition|
|
32
|
+
puts "#{condition.day_of_week}"
|
33
|
+
puts " #{condition.condition}"
|
34
|
+
puts " High: #{condition.high}°"
|
35
|
+
puts " Low: #{condition.low}°"
|
36
|
+
end
|
37
|
+
|
38
|
+
puts
|
data/google-weather.gemspec
CHANGED
@@ -14,8 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.required_rubygems_version = ">= 1.3.6"
|
15
15
|
s.rubyforge_project = "google-weather"
|
16
16
|
|
17
|
-
s.
|
18
|
-
s.add_dependency "httparty", "0.5.2"
|
17
|
+
s.add_dependency "httparty", "~> 0.5.0"
|
19
18
|
|
20
19
|
s.files = `git ls-files`.split("\n")
|
21
20
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
data/lib/google_weather.rb
CHANGED
@@ -1,31 +1,60 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gem 'httparty'
|
3
1
|
require 'httparty'
|
4
2
|
require File.dirname(__FILE__) + '/google_weather/data'
|
5
3
|
|
6
|
-
class GoogleWeather
|
4
|
+
class GoogleWeather
|
7
5
|
include HTTParty
|
8
6
|
base_uri "www.google.com"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
Path = "/ig/api"
|
8
|
+
|
9
|
+
attr_reader :param
|
10
|
+
|
11
|
+
def initialize(value, options={})
|
12
|
+
@param = prep_param(value)
|
13
|
+
@options = options
|
14
|
+
end
|
15
|
+
|
16
|
+
def locale
|
17
|
+
@options[:locale] || :en
|
14
18
|
end
|
15
|
-
|
19
|
+
|
16
20
|
def weather
|
17
|
-
@weather ||= self.class.get(
|
21
|
+
@weather ||= self.class.get(Path, weather_options)['xml_api_reply']['weather']
|
18
22
|
end
|
19
|
-
|
23
|
+
|
20
24
|
def forecast_information
|
21
25
|
@forecast_information ||= ForecastInformation.new(weather['forecast_information'])
|
22
26
|
end
|
23
|
-
|
27
|
+
|
24
28
|
def current_conditions
|
25
29
|
@current_conditions ||= CurrentConditions.new(weather['current_conditions'])
|
26
30
|
end
|
27
|
-
|
31
|
+
|
28
32
|
def forecast_conditions
|
29
33
|
@forecast_conditions ||= weather['forecast_conditions'].map { |cond| ForecastCondition.new(cond) }
|
30
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def weather_options
|
39
|
+
opts = {
|
40
|
+
:query => {
|
41
|
+
:weather => param,
|
42
|
+
:hl => locale,
|
43
|
+
:oe => 'utf-8'
|
44
|
+
},
|
45
|
+
:format => :xml,
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def prep_param(value)
|
50
|
+
if value.kind_of?(Array)
|
51
|
+
value = value.inject([]) do |result, element|
|
52
|
+
result << (element * 1e6).to_i
|
53
|
+
result
|
54
|
+
end
|
55
|
+
value = ",,,#{value[0]},#{value[1]}"
|
56
|
+
else
|
57
|
+
value
|
58
|
+
end
|
59
|
+
end
|
31
60
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0"?><xml_api_reply version="1"><weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" ><forecast_information><city data=""/><postal_code data=""/><latitude_e6 data="32221700"/><longitude_e6 data="110925800"/><forecast_date data="2012-04-21"/><current_date_time data="2012-04-21 17:00:00 +0000"/><unit_system data="US"/></forecast_information><current_conditions><condition data="Mostly Cloudy"/><temp_f data="66"/><temp_c data="19"/><humidity data="Humidity: 69%"/><icon data="/ig/images/weather/mostly_cloudy.gif"/><wind_condition data="Wind: SE at 2 mph"/></current_conditions><forecast_conditions><day_of_week data="Sat"/><low data="54"/><high data="84"/><icon data="/ig/images/weather/sunny.gif"/><condition data="Clear"/></forecast_conditions><forecast_conditions><day_of_week data="Sun"/><low data="55"/><high data="88"/><icon data="/ig/images/weather/sunny.gif"/><condition data="Clear"/></forecast_conditions><forecast_conditions><day_of_week data="Mon"/><low data="61"/><high data="95"/><icon data="/ig/images/weather/mostly_sunny.gif"/><condition data="Mostly Sunny"/></forecast_conditions><forecast_conditions><day_of_week data="Tue"/><low data="50"/><high data="73"/><icon data="/ig/images/weather/chance_of_rain.gif"/><condition data="Chance of Rain"/></forecast_conditions></weather></xml_api_reply>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0"?><xml_api_reply version="1"><weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" ><forecast_information><city data="london,uk"/><postal_code data="london,uk"/><latitude_e6 data=""/><longitude_e6 data=""/><forecast_date data="2012-04-21"/><current_date_time data="1970-01-01 00:00:00 +0000"/><unit_system data="US"/></forecast_information><current_conditions><condition data="Clear"/><temp_f data="43"/><temp_c data="6"/><humidity data="Humidity: 81%"/><icon data="/ig/images/weather/sunny.gif"/><wind_condition data="Wind: SW at 10 mph"/></current_conditions><forecast_conditions><day_of_week data="Sat"/><low data="43"/><high data="55"/><icon data="/ig/images/weather/chance_of_storm.gif"/><condition data="Chance of Storm"/></forecast_conditions><forecast_conditions><day_of_week data="Sun"/><low data="43"/><high data="57"/><icon data="/ig/images/weather/chance_of_storm.gif"/><condition data="Chance of Storm"/></forecast_conditions><forecast_conditions><day_of_week data="Mon"/><low data="46"/><high data="55"/><icon data="/ig/images/weather/chance_of_rain.gif"/><condition data="Chance of Rain"/></forecast_conditions><forecast_conditions><day_of_week data="Tue"/><low data="45"/><high data="55"/><icon data="/ig/images/weather/fog.gif"/><condition data="Fog"/></forecast_conditions></weather></xml_api_reply>
|
data/test/google_weather_test.rb
CHANGED
@@ -2,13 +2,31 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class GoogleWeatherTest < Test::Unit::TestCase
|
4
4
|
context "Initialization" do
|
5
|
-
should "require a
|
5
|
+
should "require a value" do
|
6
6
|
lambda { GoogleWeather.new }.should raise_error
|
7
|
-
|
8
|
-
|
7
|
+
end
|
8
|
+
|
9
|
+
should "set param" do
|
10
|
+
GoogleWeather.new(46544).param.should == 46544
|
11
|
+
end
|
12
|
+
|
13
|
+
should "work with string" do
|
14
|
+
GoogleWeather.new('Mishawaka, IN').param.should == 'Mishawaka, IN'
|
15
|
+
end
|
16
|
+
|
17
|
+
should "convert lat, lng array into string of e6 formatted lat,lng values" do
|
18
|
+
GoogleWeather.new([32.24959602450668,-110.8394506158091]).param.should == ',,,32249596,-110839450'
|
19
|
+
end
|
20
|
+
|
21
|
+
should "set en locale by default" do
|
22
|
+
GoogleWeather.new(46544).locale.should == :en
|
23
|
+
end
|
24
|
+
|
25
|
+
should "set specified locale if it's passed" do
|
26
|
+
GoogleWeather.new('Vologda', :locale => :ru).locale.should == :ru
|
9
27
|
end
|
10
28
|
end
|
11
|
-
|
29
|
+
|
12
30
|
context "Data" do
|
13
31
|
setup do
|
14
32
|
@data = GoogleWeather::Data.new({'foo' => {'data' => 'bar'}})
|
@@ -17,50 +35,133 @@ class GoogleWeatherTest < Test::Unit::TestCase
|
|
17
35
|
should "use method missing to get value for existing keys" do
|
18
36
|
@data.foo.should == 'bar'
|
19
37
|
end
|
20
|
-
|
38
|
+
|
21
39
|
should "return nil for missing keys" do
|
22
40
|
@data.foobar.should be(nil)
|
23
41
|
end
|
24
42
|
end
|
25
|
-
|
26
|
-
|
43
|
+
|
27
44
|
context "Fetching" do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
information
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
45
|
+
context "with a zip code" do
|
46
|
+
setup do
|
47
|
+
FakeWeb.register_uri(:get, "http://www.google.com/ig/api?weather=46544&hl=en&oe=utf-8", :body => fixture_file("fixtures/46544.xml"))
|
48
|
+
@weather = GoogleWeather.new(46544)
|
49
|
+
end
|
50
|
+
|
51
|
+
should "have forecast information" do
|
52
|
+
information = @weather.forecast_information
|
53
|
+
information.city.should == 'Mishawaka, IN'
|
54
|
+
information.postal_code.should == '46544'
|
55
|
+
information.unit_system.should == 'US'
|
56
|
+
information.forecast_date.should == '2009-03-24'
|
57
|
+
information.current_date_time.should == '2009-03-25 04:16:27 +0000'
|
58
|
+
end
|
59
|
+
|
60
|
+
should "have current conditions" do
|
61
|
+
conditions = @weather.current_conditions
|
62
|
+
conditions.humidity.should == 'Humidity: 48%'
|
63
|
+
conditions.icon.should == '/images/weather/cloudy.gif'
|
64
|
+
conditions.temp_c.should == '17'
|
65
|
+
conditions.temp_f.should == '62'
|
66
|
+
conditions.condition.should == 'Overcast'
|
67
|
+
conditions.wind_condition.should == 'Wind: SE at 11 mph'
|
68
|
+
end
|
69
|
+
|
70
|
+
should "have forecast conditions" do
|
71
|
+
conditions = @weather.forecast_conditions
|
72
|
+
conditions[0].low.should == '45'
|
73
|
+
conditions[0].high.should == '67'
|
74
|
+
conditions[0].icon.should == '/images/weather/mostly_sunny.gif'
|
75
|
+
conditions[0].condition.should == 'Partly Sunny'
|
76
|
+
conditions[0].day_of_week.should == 'Tue'
|
77
|
+
conditions[1].low.should == '34'
|
78
|
+
conditions[1].high.should == '52'
|
79
|
+
conditions[1].icon.should == '/images/weather/mostly_sunny.gif'
|
80
|
+
conditions[1].condition.should == 'Mostly Sunny'
|
81
|
+
conditions[1].day_of_week.should == 'Wed'
|
82
|
+
end
|
40
83
|
end
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
84
|
+
|
85
|
+
context "with a string" do
|
86
|
+
setup do
|
87
|
+
FakeWeb.register_uri(:get, "http://www.google.com/ig/api?hl=en&oe=utf-8&weather=London%2CUK", :body => fixture_file("fixtures/london.xml"))
|
88
|
+
@weather = GoogleWeather.new('London,UK')
|
89
|
+
end
|
90
|
+
|
91
|
+
should "have forecast information" do
|
92
|
+
information = @weather.forecast_information
|
93
|
+
information.city.should == 'london,uk'
|
94
|
+
information.postal_code.should == 'london,uk'
|
95
|
+
information.unit_system.should == 'US'
|
96
|
+
information.forecast_date.should == '2012-04-21'
|
97
|
+
information.current_date_time.should == '1970-01-01 00:00:00 +0000'
|
98
|
+
end
|
99
|
+
|
100
|
+
should "have current conditions" do
|
101
|
+
conditions = @weather.current_conditions
|
102
|
+
conditions.humidity.should == 'Humidity: 81%'
|
103
|
+
conditions.icon.should == '/ig/images/weather/sunny.gif'
|
104
|
+
conditions.temp_c.should == '6'
|
105
|
+
conditions.temp_f.should == '43'
|
106
|
+
conditions.condition.should == 'Clear'
|
107
|
+
conditions.wind_condition.should == 'Wind: SW at 10 mph'
|
108
|
+
end
|
109
|
+
|
110
|
+
should "have forecast conditions" do
|
111
|
+
conditions = @weather.forecast_conditions
|
112
|
+
conditions[0].low.should == '43'
|
113
|
+
conditions[0].high.should == '55'
|
114
|
+
conditions[0].icon.should == '/ig/images/weather/chance_of_storm.gif'
|
115
|
+
conditions[0].condition.should == 'Chance of Storm'
|
116
|
+
conditions[0].day_of_week.should == 'Sat'
|
117
|
+
conditions[1].low.should == '43'
|
118
|
+
conditions[1].high.should == '57'
|
119
|
+
conditions[1].icon.should == '/ig/images/weather/chance_of_storm.gif'
|
120
|
+
conditions[1].condition.should == 'Chance of Storm'
|
121
|
+
conditions[1].day_of_week.should == 'Sun'
|
122
|
+
end
|
50
123
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
124
|
+
|
125
|
+
context "with latitude, longitude array" do
|
126
|
+
setup do
|
127
|
+
FakeWeb.register_uri(:get, "http://www.google.com/ig/api?hl=en&oe=utf-8&weather=%2C%2C%2C32221700%2C110925800", :body => fixture_file("fixtures/coords.xml"))
|
128
|
+
@weather = GoogleWeather.new(',,,32221700,110925800')
|
129
|
+
end
|
130
|
+
|
131
|
+
should "have forecast information" do
|
132
|
+
information = @weather.forecast_information
|
133
|
+
information.city.should == ''
|
134
|
+
information.postal_code.should == ''
|
135
|
+
information.latitude_e6.should == '32221700'
|
136
|
+
information.longitude_e6.should == '110925800'
|
137
|
+
information.unit_system.should == 'US'
|
138
|
+
information.forecast_date.should == '2012-04-21'
|
139
|
+
information.current_date_time.should == '2012-04-21 17:00:00 +0000'
|
140
|
+
end
|
141
|
+
|
142
|
+
should "have current conditions" do
|
143
|
+
conditions = @weather.current_conditions
|
144
|
+
conditions.humidity.should == 'Humidity: 69%'
|
145
|
+
conditions.icon.should == '/ig/images/weather/mostly_cloudy.gif'
|
146
|
+
conditions.temp_c.should == '19'
|
147
|
+
conditions.temp_f.should == '66'
|
148
|
+
conditions.condition.should == 'Mostly Cloudy'
|
149
|
+
conditions.wind_condition.should == 'Wind: SE at 2 mph'
|
150
|
+
end
|
151
|
+
|
152
|
+
should "have forecast conditions" do
|
153
|
+
conditions = @weather.forecast_conditions
|
154
|
+
conditions[0].low.should == '54'
|
155
|
+
conditions[0].high.should == '84'
|
156
|
+
conditions[0].icon.should == '/ig/images/weather/sunny.gif'
|
157
|
+
conditions[0].condition.should == 'Clear'
|
158
|
+
conditions[0].day_of_week.should == 'Sat'
|
159
|
+
conditions[1].low.should == '55'
|
160
|
+
conditions[1].high.should == '88'
|
161
|
+
conditions[1].icon.should == '/ig/images/weather/sunny.gif'
|
162
|
+
conditions[1].condition.should == 'Clear'
|
163
|
+
conditions[1].day_of_week.should == 'Sun'
|
164
|
+
end
|
64
165
|
end
|
65
166
|
end
|
66
167
|
end
|
@@ -71,59 +172,59 @@ Example hash that comes back from Google
|
|
71
172
|
|
72
173
|
{
|
73
174
|
"xml_api_reply"=> {
|
74
|
-
"version"=>"1",
|
175
|
+
"version"=>"1",
|
75
176
|
"weather"=> {
|
76
|
-
"mobile_row"=>"0",
|
77
|
-
"mobile_zipped"=>"1",
|
78
|
-
"module_id"=>"0",
|
177
|
+
"mobile_row"=>"0",
|
178
|
+
"mobile_zipped"=>"1",
|
179
|
+
"module_id"=>"0",
|
79
180
|
"forecast_information"=>{
|
80
|
-
"city"=>{"data"=>"Mishawaka, IN"},
|
81
|
-
"postal_code"=>{"data"=>"46544"},
|
82
|
-
"longitude_e6"=>{"data"=>""},
|
83
|
-
"current_date_time"=>{"data"=>"2009-03-25 04:16:27 +0000"},
|
84
|
-
"latitude_e6"=>{"data"=>""},
|
85
|
-
"forecast_date"=>{"data"=>"2009-03-24"},
|
181
|
+
"city"=>{"data"=>"Mishawaka, IN"},
|
182
|
+
"postal_code"=>{"data"=>"46544"},
|
183
|
+
"longitude_e6"=>{"data"=>""},
|
184
|
+
"current_date_time"=>{"data"=>"2009-03-25 04:16:27 +0000"},
|
185
|
+
"latitude_e6"=>{"data"=>""},
|
186
|
+
"forecast_date"=>{"data"=>"2009-03-24"},
|
86
187
|
"unit_system"=>{"data"=>"US"}
|
87
|
-
},
|
188
|
+
},
|
88
189
|
"current_conditions"=> {
|
89
190
|
"humidity"=>{"data"=>"Humidity: 48%"},
|
90
|
-
"icon"=>{"data"=>"/images/weather/cloudy.gif"},
|
91
|
-
"condition"=>{"data"=>"Overcast"},
|
92
|
-
"temp_c"=>{"data"=>"17"},
|
93
|
-
"wind_condition"=>{"data"=>"Wind: SE at 11 mph"},
|
191
|
+
"icon"=>{"data"=>"/images/weather/cloudy.gif"},
|
192
|
+
"condition"=>{"data"=>"Overcast"},
|
193
|
+
"temp_c"=>{"data"=>"17"},
|
194
|
+
"wind_condition"=>{"data"=>"Wind: SE at 11 mph"},
|
94
195
|
"temp_f"=>{"data"=>"62"}
|
95
|
-
},
|
96
|
-
"tab_id"=>"0",
|
196
|
+
},
|
197
|
+
"tab_id"=>"0",
|
97
198
|
"forecast_conditions"=>[
|
98
199
|
{
|
99
|
-
"high"=>{"data"=>"67"},
|
200
|
+
"high"=>{"data"=>"67"},
|
100
201
|
"day_of_week"=>{"data"=>"Tue"},
|
101
|
-
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
102
|
-
"condition"=>{"data"=>"Partly Sunny"},
|
202
|
+
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
203
|
+
"condition"=>{"data"=>"Partly Sunny"},
|
103
204
|
"low"=>{"data"=>"45"}
|
104
|
-
},
|
205
|
+
},
|
105
206
|
{
|
106
|
-
"high"=>{"data"=>"52"},
|
107
|
-
"day_of_week"=>{"data"=>"Wed"},
|
108
|
-
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
109
|
-
"condition"=>{"data"=>"Mostly Sunny"},
|
207
|
+
"high"=>{"data"=>"52"},
|
208
|
+
"day_of_week"=>{"data"=>"Wed"},
|
209
|
+
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
210
|
+
"condition"=>{"data"=>"Mostly Sunny"},
|
110
211
|
"low"=>{"data"=>"34"}
|
111
212
|
},
|
112
213
|
{
|
113
|
-
"high"=>{"data"=>"54"},
|
114
|
-
"day_of_week"=>{"data"=>"Thu"},
|
115
|
-
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
116
|
-
"condition"=>{"data"=>"Mostly Sunny"},
|
214
|
+
"high"=>{"data"=>"54"},
|
215
|
+
"day_of_week"=>{"data"=>"Thu"},
|
216
|
+
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
217
|
+
"condition"=>{"data"=>"Mostly Sunny"},
|
117
218
|
"low"=>{"data"=>"36"}
|
118
|
-
},
|
219
|
+
},
|
119
220
|
{
|
120
|
-
"high"=>{"data"=>"56"},
|
121
|
-
"day_of_week"=>{"data"=>"Fri"},
|
122
|
-
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
123
|
-
"condition"=>{"data"=>"Mostly Sunny"},
|
221
|
+
"high"=>{"data"=>"56"},
|
222
|
+
"day_of_week"=>{"data"=>"Fri"},
|
223
|
+
"icon"=>{"data"=>"/images/weather/mostly_sunny.gif"},
|
224
|
+
"condition"=>{"data"=>"Mostly Sunny"},
|
124
225
|
"low"=>{"data"=>"38"}
|
125
226
|
}
|
126
227
|
]
|
127
228
|
}
|
128
229
|
}
|
129
|
-
}
|
230
|
+
}
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'pathname'
|
1
2
|
require 'rubygems'
|
2
3
|
require 'test/unit'
|
3
4
|
require 'shoulda'
|
@@ -11,4 +12,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
11
12
|
require 'google_weather'
|
12
13
|
|
13
14
|
class Test::Unit::TestCase
|
15
|
+
def fixture_file(path)
|
16
|
+
Pathname(__FILE__).dirname.join(*path.split('/')).read
|
17
|
+
end
|
14
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-weather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Nunemaker
|
@@ -15,41 +15,24 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-04-21 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
21
|
+
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
|
-
- -
|
26
|
+
- - ~>
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
28
|
+
hash: 11
|
30
29
|
segments:
|
31
|
-
- 1
|
32
30
|
- 0
|
31
|
+
- 5
|
33
32
|
- 0
|
34
|
-
version:
|
35
|
-
type: :development
|
33
|
+
version: 0.5.0
|
36
34
|
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
35
|
name: httparty
|
39
|
-
prerelease: false
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - "="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 15
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 5
|
49
|
-
- 2
|
50
|
-
version: 0.5.2
|
51
|
-
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
36
|
description: stupid simple fetching of the weather using google's api
|
54
37
|
email:
|
55
38
|
- nunemaker@gmail.com
|
@@ -62,6 +45,7 @@ extra_rdoc_files:
|
|
62
45
|
- LICENSE
|
63
46
|
files:
|
64
47
|
- .gitignore
|
48
|
+
- Gemfile
|
65
49
|
- LICENSE
|
66
50
|
- README.rdoc
|
67
51
|
- Rakefile
|
@@ -70,10 +54,12 @@ files:
|
|
70
54
|
- google-weather.gemspec
|
71
55
|
- lib/google_weather.rb
|
72
56
|
- lib/google_weather/data.rb
|
57
|
+
- lib/google_weather/version.rb
|
73
58
|
- test/fixtures/46544.xml
|
59
|
+
- test/fixtures/coords.xml
|
60
|
+
- test/fixtures/london.xml
|
74
61
|
- test/google_weather_test.rb
|
75
62
|
- test/test_helper.rb
|
76
|
-
has_rdoc: true
|
77
63
|
homepage: http://github.com/jnunemaker/google-weather
|
78
64
|
licenses: []
|
79
65
|
|
@@ -106,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
92
|
requirements: []
|
107
93
|
|
108
94
|
rubyforge_project: google-weather
|
109
|
-
rubygems_version: 1.
|
95
|
+
rubygems_version: 1.8.10
|
110
96
|
signing_key:
|
111
97
|
specification_version: 3
|
112
98
|
summary: stupid simple fetching of the weather using google's api
|