weatherbug 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/weatherbug.rb +15 -0
- data/lib/weatherbug/hash_methods.rb +1 -1
- data/lib/weatherbug/link.rb +11 -0
- data/lib/weatherbug/version.rb +1 -1
- metadata +7 -6
data/lib/weatherbug.rb
CHANGED
@@ -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}
|
data/lib/weatherbug/version.rb
CHANGED
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 13
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
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.
|
97
|
+
rubygems_version: 1.4.1
|
97
98
|
signing_key:
|
98
99
|
specification_version: 3
|
99
100
|
summary: Ruby WeatherBug partner API
|