weather-underground 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ === 1.1.0 2011-03-04
2
+
3
+ * 3 major enhancements:
4
+ * Access Current Observation data
5
+ * Access Forecast data
6
+ * Access Alers data
7
+
8
+ === 1.0.1 ...
9
+ * fix it so that rakefile correctly understands readme
10
+
1
11
  === 1.0.0 2010-03-13
2
12
 
3
13
  * 1 major enhancement:
@@ -4,9 +4,7 @@
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- Modules for interacting with Weather Underground website. Right now
8
- the focus is on the data upload for their personal weather station
9
- reporting interface.
7
+ Modules for interacting with Weather Underground website.
10
8
 
11
9
  == FEATURES/PROBLEMS:
12
10
 
@@ -14,6 +12,22 @@ This currently uses the standard upload interface, it doesn't yet use
14
12
  the real time interface.
15
13
 
16
14
  == SYNOPSIS:
15
+
16
+ w = WeatherUnderground::Base.new
17
+ w.Alerts( '90210' )
18
+ w.CurrentObservations( '90210' )
19
+ w.SimpleForecast( '90210' )
20
+ w.TextForecast( '90210' )
21
+
22
+ The location for your query can be any of the following:
23
+ * zipcode (US or Canadian)
24
+ * city state; city, state
25
+ * city
26
+ * state
27
+ * country
28
+ * airport code (3-letter or 4-letter)
29
+ * lat,lon
30
+
17
31
 
18
32
  w = WeatherUndergound::Uploader(station_id, password)
19
33
  w.update(:tempf => 72.1, :humidity => 40, :dewptf => 46.67)
@@ -26,6 +40,9 @@ sudo gem install weather-underground
26
40
 
27
41
  == LICENSE:
28
42
 
43
+ Use of the API Subject to Terms and Conditions as specified on
44
+ http://wiki.wunderground.com/index.php/API_-_XML#API_Terms_Of_Service
45
+
29
46
  (The MIT License)
30
47
 
31
48
  Copyright (c) 2010 Sean Dague
@@ -47,4 +64,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
47
64
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
48
65
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49
66
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
50
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -14,8 +14,12 @@ Hoe.plugin :website
14
14
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
15
15
  $hoe = Hoe.spec 'weather-underground' do
16
16
  self.developer 'Sean Dague', 'sean@dague.net'
17
+ self.developer 'Jeff McFadden', 'jeff.mcfadden@gmail.com'
17
18
  self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
18
19
  self.rubyforge_name = 'sdaguegems' # self.name # TODO this is default value
20
+ self.extra_rdoc_files = ["README.rdoc"]
21
+ self.readme_file = "README.rdoc"
22
+ self.extra_deps = [['temperature', '>= 1.0.0'], 'rest-client', 'happymapper']
19
23
  # self.extra_deps = [['activesupport','>= 2.0.2']]
20
24
 
21
25
  end
@@ -1,8 +1,14 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
+ require "weather-underground/utils"
5
+ require "weather-underground/base"
6
+ require "weather-underground/alerts"
7
+ require "weather-underground/current_observation"
8
+ require "weather-underground/forecast"
9
+ require "weather-underground/geo_lookup"
4
10
  require "weather-underground/uploader"
5
11
 
6
12
  module WeatherUnderground
7
- VERSION = '1.0.0'
13
+ VERSION = '1.1.0'
8
14
  end
@@ -1,16 +1,30 @@
1
1
  module WeatherUnderground
2
-
2
+ # This is an uploader for the weather underground personal weather
3
+ # station service, as found at http://wunderground.com. This
4
+ # makes it easier to build custom software to upload to the
5
+ # service allowing greater flexibility in the number of different
6
+ # weather sensors you can use.
7
+ #
8
+ # It is build from the documentation provided at
9
+ # http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol
3
10
  class Uploader
4
11
  require "uri"
5
12
  require "open-uri"
6
13
 
14
+ # This is the base url for uploading
7
15
  BaseURL = "http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php"
8
16
 
17
+ # Create an uploader object. Station is your registered
18
+ # station id from wunderground, password is the password you
19
+ # created for it.
9
20
  def initialize(station, passwd)
10
21
  @station = station
11
22
  @passwd = passwd
12
23
  end
13
-
24
+
25
+ # Build the url to use for the upload. You probably don't
26
+ # want to call this directly, though there is no harm in doing
27
+ # so.
14
28
  def url(params = {})
15
29
  base = "#{BaseURL}?ID=#{@station}&PASSWORD=#{@passwd}"
16
30
  base += "&dateutc=#{URI.escape(Time.now.utc.strftime("%Y-%m-%d %H:%M:%S"))}"
@@ -22,9 +36,17 @@ module WeatherUnderground
22
36
  return base
23
37
  end
24
38
 
39
+ # Update with data. Data is of the form of :name => value for
40
+ # the parameters shown here:
41
+ # http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol.
42
+ #
43
+ # The required parameters are automatically filled in by the
44
+ # module, just provide the data that you want to upload.
45
+ #
46
+ # w.update(:temp => 67.5, :humidity => 40)
25
47
  def update(data = {})
26
48
  open(url(data)) do |f|
27
- # we should really do something with the response
49
+ # TODO: check the response
28
50
 
29
51
  end
30
52
  end
metadata CHANGED
@@ -1,53 +1,120 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather-underground
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 0
10
+ version: 1.1.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Sean Dague
14
+ - Jeff McFadden
8
15
  autorequire:
9
16
  bindir: bin
10
17
  cert_chain: []
11
18
 
12
- date: 2010-03-13 23:00:00 -05:00
19
+ date: 2011-03-05 00:00:00 -05:00
13
20
  default_executable:
14
21
  dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: temperature
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 23
31
+ segments:
32
+ - 1
33
+ - 0
34
+ - 0
35
+ version: 1.0.0
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: rest-client
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 3
47
+ segments:
48
+ - 0
49
+ version: "0"
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: happymapper
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ type: :runtime
65
+ version_requirements: *id003
15
66
  - !ruby/object:Gem::Dependency
16
67
  name: rubyforge
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
20
71
  requirements:
21
72
  - - ">="
22
73
  - !ruby/object:Gem::Version
74
+ hash: 9
75
+ segments:
76
+ - 2
77
+ - 0
78
+ - 3
23
79
  version: 2.0.3
24
- version:
80
+ type: :development
81
+ version_requirements: *id004
25
82
  - !ruby/object:Gem::Dependency
26
83
  name: gemcutter
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
30
87
  requirements:
31
88
  - - ">="
32
89
  - !ruby/object:Gem::Version
90
+ hash: 19
91
+ segments:
92
+ - 0
93
+ - 3
94
+ - 0
33
95
  version: 0.3.0
34
- version:
96
+ type: :development
97
+ version_requirements: *id005
35
98
  - !ruby/object:Gem::Dependency
36
99
  name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
100
+ prerelease: false
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
40
103
  requirements:
41
104
  - - ">="
42
105
  - !ruby/object:Gem::Version
106
+ hash: 27
107
+ segments:
108
+ - 2
109
+ - 5
110
+ - 0
43
111
  version: 2.5.0
44
- version:
45
- description: |-
46
- Modules for interacting with Weather Underground website. Right now
47
- the focus is on the data upload for their personal weather station
48
- reporting interface.
112
+ type: :development
113
+ version_requirements: *id006
114
+ description: Modules for interacting with Weather Underground website.
49
115
  email:
50
116
  - sean@dague.net
117
+ - jeff.mcfadden@gmail.com
51
118
  executables: []
52
119
 
53
120
  extensions: []
@@ -56,6 +123,7 @@ extra_rdoc_files:
56
123
  - History.txt
57
124
  - Manifest.txt
58
125
  - PostInstall.txt
126
+ - README.rdoc
59
127
  files:
60
128
  - History.txt
61
129
  - Manifest.txt
@@ -82,24 +150,30 @@ rdoc_options:
82
150
  require_paths:
83
151
  - lib
84
152
  required_ruby_version: !ruby/object:Gem::Requirement
153
+ none: false
85
154
  requirements:
86
155
  - - ">="
87
156
  - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
88
160
  version: "0"
89
- version:
90
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
+ none: false
91
163
  requirements:
92
164
  - - ">="
93
165
  - !ruby/object:Gem::Version
166
+ hash: 3
167
+ segments:
168
+ - 0
94
169
  version: "0"
95
- version:
96
170
  requirements: []
97
171
 
98
172
  rubyforge_project: sdaguegems
99
- rubygems_version: 1.3.5
173
+ rubygems_version: 1.3.7
100
174
  signing_key:
101
175
  specification_version: 3
102
- summary: Modules for interacting with Weather Underground website
176
+ summary: Modules for interacting with Weather Underground website.
103
177
  test_files:
104
178
  - test/test_uploader.rb
105
179
  - test/test_weather-underground.rb