barometer 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/README.rdoc +8 -23
  2. data/TODO +4 -2
  3. data/VERSION.yml +1 -1
  4. data/barometer.gemspec +2 -2
  5. data/bin/barometer +2 -20
  6. data/lib/barometer.rb +0 -4
  7. data/lib/barometer/data/geo.rb +14 -11
  8. data/lib/barometer/weather_services/google.rb +1 -1
  9. data/lib/barometer/web_services/geocode.rb +4 -9
  10. data/lib/barometer/web_services/placemaker.rb +2 -0
  11. data/spec/barometer_spec.rb +0 -10
  12. data/spec/fakeweb_helper.rb +50 -30
  13. data/spec/fixtures/formats/weather_id/90210.xml +7 -1
  14. data/spec/fixtures/formats/weather_id/from_USGA0028.xml +3 -1
  15. data/spec/fixtures/formats/weather_id/ksfo.xml +1 -1
  16. data/spec/fixtures/formats/weather_id/manhattan.xml +7 -0
  17. data/spec/fixtures/formats/weather_id/new_york.xml +1 -1
  18. data/spec/fixtures/formats/weather_id/the_hills.xml +1 -0
  19. data/spec/fixtures/geocode/40_73.json +10 -142
  20. data/spec/fixtures/geocode/90210.json +9 -12
  21. data/spec/fixtures/geocode/T5B4M9.json +11 -8
  22. data/spec/fixtures/geocode/atlanta.json +1 -1
  23. data/spec/fixtures/geocode/calgary_ab.json +6 -6
  24. data/spec/fixtures/geocode/ksfo.json +14 -14
  25. data/spec/fixtures/geocode/newyork_ny.json +5 -5
  26. data/spec/fixtures/services/google/calgary_ab.xml +1 -1
  27. data/spec/fixtures/services/placemaker/w615702.xml +40 -39
  28. data/spec/fixtures/services/weather_dot_com/90210.xml +1 -1
  29. data/spec/fixtures/services/wunderground/current_calgary_ab.xml +9 -1
  30. data/spec/fixtures/services/wunderground/forecast_calgary_ab.xml +13 -1
  31. data/spec/fixtures/services/yahoo/90210.xml +3 -1
  32. data/spec/formats/coordinates_spec.rb +3 -11
  33. data/spec/formats/geocode_spec.rb +33 -41
  34. data/spec/formats/weather_id_spec.rb +0 -4
  35. data/spec/formats/woe_id_spec.rb +0 -4
  36. data/spec/query_spec.rb +4 -23
  37. data/spec/spec_helper.rb +0 -1
  38. data/spec/weather_services/weather_dot_com_spec.rb +32 -32
  39. data/spec/weather_services/wunderground_spec.rb +2 -2
  40. data/spec/weather_services/yahoo_spec.rb +10 -22
  41. data/spec/web_services/geocode_spec.rb +1 -11
  42. metadata +7 -19
  43. data/spec/fixtures/formats/weather_id/atlanta.xml +0 -1
  44. data/spec/fixtures/geocode/40_73.xml +0 -1
  45. data/spec/fixtures/geocode/90210.xml +0 -1
  46. data/spec/fixtures/geocode/T5B4M9.xml +0 -1
  47. data/spec/fixtures/geocode/atlanta.xml +0 -1
  48. data/spec/fixtures/geocode/calgary_ab.xml +0 -1
  49. data/spec/fixtures/geocode/ksfo.xml +0 -1
  50. data/spec/fixtures/geocode/newyork_ny.xml +0 -1
@@ -15,7 +15,7 @@ this.
15
15
 
16
16
  == version
17
17
 
18
- Version 0.7.1 is the current release of this gem. The gem is available from
18
+ Version 0.7.2 is the current release of this gem. The gem is available from
19
19
  gemcutter (barometer: http://gemcutter.org/gems/barometer).
20
20
  Older version are available through rubyforge (barometer) and github
21
21
  (attack-barometer).
@@ -34,25 +34,15 @@ Features to be added in the future:
34
34
 
35
35
  = dependencies
36
36
 
37
- == Google API key
37
+ == Google API key [UPDATED]
38
38
 
39
- In most cases you will need to have a free google geocode api key.
40
- Get one here: http://code.google.com/apis/maps/signup.html
41
- Then put it in the file '~/.barometer' by adding the lines:
42
-
43
- google:
44
- geocode: YOUR_KEY_HERE
45
-
46
- You will need this for:
47
- - using the Barometer gem (unless you use queries that are directly supported
48
- by the weather source API, ie yahoo will take a zip code directly and doesn't
49
- require any geocoding)
50
- - running the Barometer binary
51
- - running the Barometer Web Demo
39
+ As stated on the Google Geocoding API website
40
+ (http://code.google.com/apis/maps/documentation/geocoding/), Google no longer
41
+ requires an API key. Therefore Barometer no longer requires a Google API key.
52
42
 
53
43
  === other keys
54
44
 
55
- The same file can hold all your weather service API keys.
45
+ The '~/.barometer' file can hold all your weather service API keys.
56
46
 
57
47
  eg. weather.com
58
48
 
@@ -131,12 +121,8 @@ You can use barometer right out of the box, as it is configured to use one
131
121
  register-less (no API key required) international weather service
132
122
  (wunderground.com).
133
123
 
134
- For better results, signup for a google-map key and enhance your barometer
135
- with geo-coding.
136
-
137
124
  require 'barometer'
138
125
 
139
- Barometer.google_geocode_key = "THE_GOOGLE_API_KEY"
140
126
  barometer = Barometer.new("Paris")
141
127
  weather = barometer.measure
142
128
 
@@ -149,8 +135,8 @@ The available sources are:
149
135
  Wunderground.com (:wunderground) [default]
150
136
  Yahoo! Weather (:yahoo)
151
137
  Google Weather (:google)
152
- Weather.com (:weather_dot_com)
153
- WeatherBug.com (:weather_bug)
138
+ Weather.com (:weather_dot_com) [requires key]
139
+ WeatherBug.com (:weather_bug) [requires key]
154
140
 
155
141
  == source configuration
156
142
 
@@ -179,7 +165,6 @@ Weather services, one with keys.
179
165
 
180
166
  require 'barometer'
181
167
 
182
- Barometer.google_geocode_key = "THE_GOOGLE_API_KEY"
183
168
  # use yahoo and google, if they both fail, use wunderground
184
169
  Barometer.config = { 1 => [:yahoo, :google], 2 => :wunderground }
185
170
 
data/TODO CHANGED
@@ -1,16 +1,18 @@
1
1
  == now
2
+ - use Yahoo placemaker for geocoding (as exclusive, or as priority for supported conversions)
3
+ - remove use of google api key
4
+
5
+ == very soon
2
6
 
3
7
  - google geocoding terms of service indicate that "a map must be shown" ... what to do?
4
8
  - driver: hamweather
5
9
  - driver: meter
6
10
  - improve code based on metrics
7
- - ability to use Placemaker for geocoding (instead of Google)
8
11
  - use Geomojo to convert coords to woe_id (when no yahoo key)
9
12
  - remove use of HTTParty, use Net:HTTP and Nokogiri instead
10
13
 
11
14
  == soon
12
15
 
13
- - style the demo app results
14
16
  - refactor: data-zone
15
17
  - methods to use service_specific icons/images
16
18
 
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 7
4
- :patch: 1
4
+ :patch: 2
5
5
  :build:
@@ -2,14 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{barometer}
5
- s.version = "0.7.1"
5
+ s.version = "0.7.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.rubygems_version = %q{1.3.5}
9
9
 
10
10
  s.authors = ["Mark G"]
11
11
  s.email = %q{barometer@attackcorp.com}
12
- s.date = %q{2011-06-01}
12
+ s.date = %q{2011-06-02}
13
13
 
14
14
  s.summary = %q{A multi API consuming weather forecasting superstar.}
15
15
  s.description = %q{A multi API consuming weather forecasting superstar.}
@@ -53,7 +53,7 @@ require 'yaml'
53
53
 
54
54
  # file where API keys are stored
55
55
  KEY_FILE = File.expand_path(File.join('~', '.barometer'))
56
- BAROMETER_VERSION = '0.7.1'
56
+ BAROMETER_VERSION = '0.7.2'
57
57
 
58
58
  class App
59
59
 
@@ -449,17 +449,6 @@ def pretty_output(barometer)
449
449
  end
450
450
  end
451
451
 
452
- def geocode_google_key_message
453
- puts
454
- puts "MISSING KEYS !!!"
455
- puts "Please update the key_file '#{KEY_FILE}' with your google api key"
456
- puts "Get it here: http://code.google.com/apis/maps/signup.html"
457
- puts "Then, add this line to the file:"
458
- puts "google:"
459
- puts " geocode: YOUR_KEY_KERE"
460
- puts
461
- end
462
-
463
452
  def weather_key_message
464
453
  puts
465
454
  puts "MISSING KEYS !!!"
@@ -488,16 +477,9 @@ if File.exists?(KEY_FILE)
488
477
  keys = YAML.load_file(KEY_FILE)
489
478
  if keys["yahoo"] && keys["yahoo"]["app_id"]
490
479
  Barometer.yahoo_placemaker_app_id = keys["yahoo"]["app_id"]
491
- end
492
- if keys["google"] && keys["google"]["geocode"]
493
- Barometer.google_geocode_key = keys["google"]["geocode"]
494
- else
495
- geocode_google_key_message
496
- exit
497
480
  end
498
481
  else
499
- File.open(KEY_FILE, 'w') {|f| f << "google: geocode: YOUR_KEY_KERE" }
500
- geocode_google_key_message
482
+ File.open(KEY_FILE, 'w') {|f| f << "yahoo: app_id: YOUR_KEY_KERE" }
501
483
  exit
502
484
  end
503
485
 
@@ -15,10 +15,6 @@ module Barometer
15
15
  def self.debug!; @@debug_mode = true; end;
16
16
  def self.debug?; @@debug_mode; end;
17
17
 
18
- @@google_geocode_key = nil
19
- def self.google_geocode_key; @@google_geocode_key; end;
20
- def self.google_geocode_key=(google_key); @@google_geocode_key = google_key; end;
21
-
22
18
  @@yahoo_placemaker_app_id = nil
23
19
  def self.yahoo_placemaker_app_id; @@yahoo_placemaker_app_id; end;
24
20
  def self.yahoo_placemaker_app_id=(yahoo_key); @@yahoo_placemaker_app_id = yahoo_key; end;
@@ -36,20 +36,23 @@ module Barometer
36
36
  end
37
37
  end
38
38
  if placemark && placemark["AddressDetails"] && placemark["AddressDetails"]["Country"]
39
- if placemark["AddressDetails"]["Country"]["AdministrativeArea"]
40
- if placemark["AddressDetails"]["Country"]["AdministrativeArea"]["SubAdministrativeArea"]
41
- locality = placemark["AddressDetails"]["Country"]["AdministrativeArea"]["SubAdministrativeArea"]["Locality"]
39
+ country = placemark["AddressDetails"]["Country"]
40
+ if country["AdministrativeArea"]
41
+ ad_area = country["AdministrativeArea"]
42
+ if ad_area["SubAdministrativeArea"]
43
+ @locality = ad_area["SubAdministrativeArea"]["Locality"]["LocalityName"]
44
+ elsif ad_area["DependentLocality"] && ad_area["DependentLocality"]["DependentLocalityName"]
45
+ @locality = ad_area["DependentLocality"]["DependentLocalityName"]
46
+ elsif ad_area["Locality"] && ad_area["Locality"]["LocalityName"]
47
+ @locality = ad_area["Locality"]["LocalityName"]
42
48
  else
43
- locality = placemark["AddressDetails"]["Country"]["AdministrativeArea"]["Locality"]
49
+ @locality = ""
44
50
  end
45
- if locality
46
- @locality = locality["LocalityName"]
47
- end
48
- @region = placemark["AddressDetails"]["Country"]["AdministrativeArea"]["AdministrativeAreaName"]
51
+ @region = ad_area["AdministrativeAreaName"]
49
52
  end
50
- @country = placemark["AddressDetails"]["Country"]["CountryName"]
51
- @country_code = placemark["AddressDetails"]["Country"]["CountryNameCode"]
52
- @address = placemark["AddressDetails"]["Country"]["AddressLine"]
53
+ @country = country["CountryName"]
54
+ @country_code = country["CountryNameCode"]
55
+ @address = country["AddressLine"]
53
56
  end
54
57
  end
55
58
 
@@ -131,7 +131,7 @@ module Barometer
131
131
  return unless query
132
132
  puts "fetch google: #{query.q}" if Barometer::debug?
133
133
  self.get(
134
- "http://google.com/ig/api",
134
+ "http://www.google.com/ig/api",
135
135
  :query => {:weather => query.q, :hl => (metric ? "en-GB" : "en-US")},
136
136
  :format => :xml,
137
137
  :timeout => Barometer.timeout
@@ -9,24 +9,19 @@ module Barometer
9
9
  def self.fetch(query)
10
10
  raise ArgumentError unless _is_a_query?(query)
11
11
  puts "geocoding: #{query.q}" if Barometer::debug?
12
- return nil unless _has_geocode_key?
13
12
  location = self.get(
14
13
  "http://maps.google.com/maps/geo",
15
14
  :query => {
16
- :gl => query.country_code, :key => Barometer.google_geocode_key,
17
- :output => "json", :q => query.q, :sensor => "false"
15
+ :gl => query.country_code,
16
+ :output => "json",
17
+ :q => query.q,
18
+ :sensor => "false"
18
19
  },
19
20
  :format => :json, :timeout => Barometer.timeout
20
21
  )
21
22
  location = location['kml']['Response'] if (location && location['kml'])
22
23
  location ? (geo = Data::Geo.new(location)) : nil
23
24
  end
24
-
25
- private
26
-
27
- def self._has_geocode_key?
28
- !Barometer.google_geocode_key.nil?
29
- end
30
25
 
31
26
  end
32
27
  end
@@ -5,6 +5,8 @@ module Barometer
5
5
  # Yahoo! Placemaker is a geoparsing web service,
6
6
  # this uses Placemaker to obtain a WOEID, as only Yahoo knows them
7
7
  #
8
+ # accepts: city name, coords, postal code, NOT zip code, NOT icao
9
+ #
8
10
  class WebService::Placemaker < WebService
9
11
 
10
12
  # get the woe_id for a given query
@@ -4,7 +4,6 @@ describe "Barometer" do
4
4
 
5
5
  before(:each) do
6
6
  @config_hash = { 1 => [:wunderground] }
7
- @google_key = KEY
8
7
  @yahoo_key = YAHOO_KEY
9
8
  end
10
9
 
@@ -22,14 +21,6 @@ describe "Barometer" do
22
21
  Barometer.source(:wunderground).should == Barometer::WeatherService::Wunderground
23
22
  end
24
23
 
25
- it "sets the Graticule Google geocoding API key" do
26
- Barometer.respond_to?("google_geocode_key").should be_true
27
- Barometer.google_geocode_key = nil
28
- Barometer.google_geocode_key.should be_nil
29
- Barometer.google_geocode_key = @google_key
30
- Barometer.google_geocode_key.should == @google_key
31
- end
32
-
33
24
  it "sets the Placemaker Yahoo! app ID" do
34
25
  Barometer.respond_to?("yahoo_placemaker_app_id").should be_true
35
26
  Barometer.yahoo_placemaker_app_id = nil
@@ -103,7 +94,6 @@ describe "Barometer" do
103
94
  describe "when measuring" do
104
95
 
105
96
  before(:each) do
106
- Barometer.google_geocode_key = @google_key
107
97
  query_term = "Calgary,AB"
108
98
  @barometer = Barometer::Base.new(query_term)
109
99
  @time = Time.now
@@ -4,7 +4,6 @@ FakeWeb.allow_net_connect = false
4
4
  #
5
5
  # Set random test keys
6
6
  #
7
- KEY = "ABC123"
8
7
  WEATHER_PARTNER_KEY = "1234"
9
8
  WEATHER_LICENSE_KEY = "12345"
10
9
  WEATHERBUG_CODE = "A9999"
@@ -14,66 +13,79 @@ YAHOO_KEY = "YAHOO"
14
13
  # for geocoding
15
14
  #
16
15
  geo_url = "http://maps.google.com/maps/geo?"
16
+
17
+ # http://maps.google.com/maps/geo?gl=US&sensor=false&q=90210&output=json
17
18
  FakeWeb.register_uri(:get,
18
- "#{geo_url}gl=US&key=#{KEY}&sensor=false&q=90210&output=json",
19
+ "#{geo_url}gl=US&sensor=false&q=90210&output=json",
19
20
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/90210.json')
20
21
  )
21
-
22
+ # http://maps.google.com/maps/geo?gl=&q=40.756054%2C-73.986951&output=json&sensor=false
22
23
  FakeWeb.register_uri(:get,
23
- "#{geo_url}gl=&q=#{CGI.escape("40.756054,-73.986951")}&output=json&key=#{KEY}&sensor=false",
24
+ "#{geo_url}gl=&q=#{CGI.escape("40.756054,-73.986951")}&output=json&sensor=false",
24
25
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/40_73.json')
25
26
  )
26
-
27
+ # http://maps.google.com/maps/geo?gl=&q=New%20York%2C%20NY&output=json&sensor=false
27
28
  FakeWeb.register_uri(:get,
28
- "#{geo_url}gl=&q=New%20York%2C%20NY&output=json&key=#{KEY}&sensor=false",
29
+ "#{geo_url}gl=&q=New%20York%2C%20NY&output=json&sensor=false",
29
30
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/newyork_ny.json')
30
31
  )
32
+ # http://maps.google.com/maps/geo?gl=CA&output=json&q=T5B%204M9&sensor=false
31
33
  FakeWeb.register_uri(:get,
32
- "#{geo_url}gl=CA&key=#{KEY}&output=json&q=T5B%204M9&sensor=false",
34
+ "#{geo_url}gl=CA&output=json&q=T5B%204M9&sensor=false",
33
35
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/T5B4M9.json')
34
36
  )
37
+ # http://maps.google.com/maps/geo?gl=US&q=KSFO&output=json&sensor=false
35
38
  FakeWeb.register_uri(:get,
36
- "#{geo_url}gl=US&q=KSFO&output=json&key=#{KEY}&sensor=false",
39
+ "#{geo_url}gl=US&q=KSFO&output=json&sensor=false",
37
40
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/ksfo.json')
38
41
  )
42
+ # http://maps.google.com/maps/geo?gl=&q=Atlanta%2C%20GA%2C%20US&output=json&sensor=false
39
43
  FakeWeb.register_uri(:get,
40
- "#{geo_url}gl=&q=Atlanta%2C%20GA%2C%20US&output=json&key=#{KEY}&sensor=false",
44
+ "#{geo_url}gl=&q=Atlanta%2C%20GA%2C%20US&output=json&sensor=false",
41
45
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/atlanta.json')
42
46
  )
47
+ # http://maps.google.com/maps/geo?gl=&q=Calgary%2CAB&sensor=false&output=json
43
48
  FakeWeb.register_uri(:get,
44
- "#{geo_url}output=xml&q=Atlanta%2C%20GA%2C%20US&gl=US&key=#{KEY}",
45
- :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/atlanta.xml')
46
- )
47
- FakeWeb.register_uri(:get,
48
- "#{geo_url}gl=&key=#{KEY}&q=Calgary%2CAB&sensor=false&output=json",
49
+ "#{geo_url}gl=&q=Calgary%2CAB&sensor=false&output=json",
49
50
  :body => File.read(File.dirname(__FILE__) + '/fixtures/geocode/calgary_ab.json')
50
51
  )
51
52
  #
52
53
  # for weather.com searches
53
54
  #
55
+ # http://xoap.weather.com:80/search/search?where=Beverly%20Hills%2C%20CA%2C%20USA
54
56
  FakeWeb.register_uri(:get,
55
57
  "http://xoap.weather.com:80/search/search?where=Beverly%20Hills%2C%20CA%2C%20USA",
56
- :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/90210.xml')
58
+ :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/the_hills.xml')
57
59
  )
60
+ # http://xoap.weather.com:80/search/search?where=New%20York%2C%20NY
58
61
  FakeWeb.register_uri(:get,
59
62
  "http://xoap.weather.com:80/search/search?where=New%20York%2C%20NY",
60
63
  :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/new_york.xml')
61
64
  )
65
+ # http://xoap.weather.com:80/search/search?where=Manhattan%2C%20NY%2C%20USA
66
+ FakeWeb.register_uri(:get,
67
+ "http://xoap.weather.com:80/search/search?where=Manhattan%2C%20NY%2C%20USA",
68
+ :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/manhattan.xml')
69
+ )
70
+ # http://xoap.weather.com:80/search/search?where=New%20York%2C%20NY%2C%20USA
62
71
  FakeWeb.register_uri(:get,
63
72
  "http://xoap.weather.com:80/search/search?where=New%20York%2C%20NY%2C%20USA",
64
73
  :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/new_york.xml')
65
74
  )
75
+ # http://xoap.weather.com:80/search/search?where=90210
66
76
  FakeWeb.register_uri(:get,
67
77
  "http://xoap.weather.com:80/search/search?where=90210",
68
78
  :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/90210.xml')
69
79
  )
80
+ # http://xoap.weather.com:80/search/search?where=San%20Francisco%2C%20CA%2C%20USA
70
81
  FakeWeb.register_uri(:get,
71
- "http://xoap.weather.com:80/search/search?where=Millbrae%2C%20CA%2C%20USA",
82
+ "http://xoap.weather.com:80/search/search?where=San%20Francisco%2C%20CA%2C%20USA",
72
83
  :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/ksfo.xml')
73
84
  )
74
85
  #
75
86
  # for yahoo.com searches
76
87
  #
88
+ # http://weather.yahooapis.com:80/forecastrss?p=USGA0028
77
89
  FakeWeb.register_uri(:get,
78
90
  "http://weather.yahooapis.com:80/forecastrss?p=USGA0028",
79
91
  :body => File.read(File.dirname(__FILE__) + '/fixtures/formats/weather_id/from_USGA0028.xml')
@@ -81,27 +93,29 @@ FakeWeb.register_uri(:get,
81
93
  #
82
94
  # for Google weather
83
95
  #
96
+ # http://www.google.com/ig/api?weather=Calgary%2CAB&hl=en-GB
84
97
  FakeWeb.register_uri(:get,
85
- "http://google.com/ig/api?weather=#{CGI.escape('Calgary,AB')}&hl=en-GB",
98
+ "http://www.google.com/ig/api?weather=#{CGI.escape('Calgary,AB')}&hl=en-GB",
86
99
  :body => File.read(File.dirname(__FILE__) + '/fixtures/services/google/calgary_ab.xml')
87
100
  )
88
101
  #
89
102
  # for WeatherBug weather
90
103
  #
91
- bug_url_current = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getLiveWeatherRSS.aspx?"
92
- FakeWeb.register_uri(:get,
93
- "#{bug_url_current}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
94
- :body => File.read(File.dirname(__FILE__) + '/fixtures/services/weather_bug/90210_current.xml')
95
- )
104
+ bug_url_current = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getLiveWeatherRSS.aspx?"
105
+ FakeWeb.register_uri(:get,
106
+ "#{bug_url_current}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
107
+ :body => File.read(File.dirname(__FILE__) + '/fixtures/services/weather_bug/90210_current.xml')
108
+ )
96
109
 
97
- bug_url_future = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getForecastRSS.aspx?"
98
- FakeWeb.register_uri(:get,
99
- "#{bug_url_future}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
100
- :body => File.read(File.dirname(__FILE__) + '/fixtures/services/weather_bug/90210_forecast.xml')
101
- )
110
+ bug_url_future = "http://#{WEATHERBUG_CODE}.api.wxbug.net:80/getForecastRSS.aspx?"
111
+ FakeWeb.register_uri(:get,
112
+ "#{bug_url_future}ACode=#{WEATHERBUG_CODE}&OutputType=1&UnitType=1&zipCode=90210",
113
+ :body => File.read(File.dirname(__FILE__) + '/fixtures/services/weather_bug/90210_forecast.xml')
114
+ )
102
115
  #
103
116
  # for weather.com weather
104
117
  #
118
+ # http://xoap.weather.com:80/weather/local/90210?dayf=5&unit=m&link=xoap&par=PKEY&prod=xoap&key=LKEY&cc=*
105
119
  weather_com_url = "http://xoap.weather.com:80/weather/local/"
106
120
  FakeWeb.register_uri(:get,
107
121
  "#{weather_com_url}90210?dayf=5&unit=m&link=xoap&par=#{WEATHER_PARTNER_KEY}&prod=xoap&key=#{WEATHER_LICENSE_KEY}&cc=*",
@@ -110,6 +124,7 @@ FakeWeb.register_uri(:get,
110
124
  #
111
125
  # for yahoo weather
112
126
  #
127
+ # http://weather.yahooapis.com:80/forecastrss?u=c&p=90210
113
128
  FakeWeb.register_uri(:get,
114
129
  "http://weather.yahooapis.com:80/forecastrss?u=c&p=90210",
115
130
  :body => File.read(File.dirname(__FILE__) + '/fixtures/services/yahoo/90210.xml')
@@ -118,12 +133,14 @@ FakeWeb.register_uri(:get,
118
133
  #
119
134
  # For wunderground weather
120
135
  #
136
+ # http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=51.045%2C-114.0572222
121
137
  FakeWeb.register_uri(:get,
122
- "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=51.055149%2C-114.062438",
138
+ "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=51.045%2C-114.0572222",
123
139
  :body => File.read(File.dirname(__FILE__) + '/fixtures/services/wunderground/current_calgary_ab.xml')
124
- )
140
+ )
141
+ # http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=51.045%2C-114.0572222
125
142
  FakeWeb.register_uri(:get,
126
- "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=51.055149%2C-114.062438",
143
+ "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=51.045%2C-114.0572222",
127
144
  :body => File.read(File.dirname(__FILE__) + '/fixtures/services/wunderground/forecast_calgary_ab.xml')
128
145
  )
129
146
  FakeWeb.register_uri(:get,
@@ -138,6 +155,9 @@ FakeWeb.register_uri(:get,
138
155
  #
139
156
  # For Placemaker
140
157
  #
158
+ # curl -d "documentType=text%2Fhtml&outputType=xml&documentContent=<html><body><div class=\"geo\"><span class=\"latitude\">40.756054</span><span class=\"longitude\">-73.986951</span></div></body></html>" http://wherein.yahooapis.com/v1/document
159
+ # curl -d "documentType=text%2Fhtml&outputType=xml&documentContent=Chicago" http://wherein.yahooapis.com/v1/document
160
+ #
141
161
  FakeWeb.register_uri(:post,
142
162
  "http://wherein.yahooapis.com/v1/document",
143
163
  [