weatherbug 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,7 @@ module WeatherBug
12
12
  autoload :StationHint, 'weatherbug/station_hint'
13
13
  autoload :LiveObservation, 'weatherbug/live_observation'
14
14
  autoload :Forecast, 'weatherbug/forecast'
15
+ autoload :Link, 'weatherbug/link'
15
16
 
16
17
  API_URL = 'datafeed.weatherbug.com'
17
18
 
@@ -52,6 +53,20 @@ module WeatherBug
52
53
  WeatherBug::Station.from_document response.xpath('/aws:weather/aws:station').first
53
54
  end
54
55
 
56
+ # Get links for a certain zip code or postal code
57
+ def self.get_links(link_names = [], lookup_options = {})
58
+ HashMethods.valid_keys(lookup_options, [:zip_code, :postal_code])
59
+ HashMethods.valid_one_only(lookup_options, [:zip_code, :postal_code])
60
+ HashMethods.valid_needs(lookup_options, :zip_code, :postal_code) if lookup_options.has_key?(:postal_code)
61
+ params = HashMethods.convert_symbols(lookup_options)
62
+ params['LinkName'] = link_names.is_a?(Array) ? link_names.join(',') : link_names
63
+ response = make_request('GetLink', params)
64
+
65
+ response.xpath('/aws:weather/aws:Links/aws:Link').map do |link_data|
66
+ WeatherBug::Link.from_document link_data
67
+ end
68
+ end
69
+
55
70
  def self.live_observation(station, unit_type = :f)
56
71
  station_id = station.is_a?(WeatherBug::Station) ? station.station_id : station
57
72
  params = {'StationId' => station_id}
@@ -8,7 +8,7 @@ module WeatherBug
8
8
  :postal_code => 'PostalCode',
9
9
  :include_pws => 'IncludePWS',
10
10
  :latitude => 'Latitude',
11
- :longitude => 'Longitude'
11
+ :longitude => 'Longitude',
12
12
  }
13
13
 
14
14
  # Raise an argument error if we get invalid keys at all
@@ -0,0 +1,11 @@
1
+ module WeatherBug
2
+
3
+ class Link < TransformableData
4
+
5
+ register_transformer '@linkname', :name => :link_name
6
+ register_transformer '@zipcode', :name => :zip_code
7
+ register_transformer '@url', :name => :url
8
+
9
+ end
10
+
11
+ end
@@ -1,6 +1,6 @@
1
1
  module WeatherBug
2
2
 
3
- VERSION = [0, 0, 8]
3
+ VERSION = [0, 0, 9]
4
4
 
5
5
  def self.version
6
6
  VERSION.join('.')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weatherbug
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
4
+ hash: 13
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Crepezzi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-13 00:00:00 -05:00
18
+ date: 2011-04-22 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -57,6 +57,7 @@ extra_rdoc_files: []
57
57
  files:
58
58
  - lib/weatherbug/forecast.rb
59
59
  - lib/weatherbug/hash_methods.rb
60
+ - lib/weatherbug/link.rb
60
61
  - lib/weatherbug/live_observation.rb
61
62
  - lib/weatherbug/station.rb
62
63
  - lib/weatherbug/station_hint.rb
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  requirements: []
94
95
 
95
96
  rubyforge_project: weatherbug
96
- rubygems_version: 1.3.7
97
+ rubygems_version: 1.4.1
97
98
  signing_key:
98
99
  specification_version: 3
99
100
  summary: Ruby WeatherBug partner API