weatherfinder 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/License.txt +19 -0
  2. data/README +71 -0
  3. data/weatherfinder.gemspec +2 -2
  4. metadata +3 -1
data/License.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2009 Guilherme Nascimento
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,71 @@
1
+ Author:: Guilherme Nascimento
2
+ Copyright:: Copyright (c) 2009
3
+
4
+ == Overview
5
+
6
+ Weather Finder is a Ruby library to access Weather.com data (XOAP). The library uses Hpricot and MemCached and allows fetch current forecast data from anywhere location.
7
+
8
+ In order to use this library, you need to get a partner_id and license_key from Weather.com service at:
9
+ http://www.weather.com/services/xmloap.html
10
+
11
+ After signed up, you will receive an email with partner_id and license_key.
12
+
13
+ If you need read the complete terms and conditions about the use of the service, you can download the SDK from link below:
14
+ http://download.weather.com/web/xml/sdk.zip
15
+
16
+ In this .zip file, you can find too the graphical icons to represent the conditions associated with the current forecast.
17
+
18
+ == Quick Install
19
+
20
+ RubyGem:
21
+
22
+ sudo gem install weatherfinder
23
+
24
+ == Fetching current conditions
25
+
26
+ require "weatherfinder"
27
+
28
+ service = Weather::WeatherFinder.new
29
+
30
+ # Partner ID and License Key provided by Weather.com
31
+ service.partner_id = your partner id
32
+ service.license_key = your license key
33
+
34
+ # Fetching current forecast from Rio de Janeiro ;)
35
+ forecast = service.load_forecast("BRXX0201")
36
+
37
+ puts "Current Description: " + forecast.current.description
38
+ puts "Current Temperature: " + forecast.current.temp
39
+ puts "Current Icon: " + forecast.current.icon
40
+ puts "Current Wind Speed: " + forecast.current.wind.speed
41
+
42
+ == Fetching tomorrow's forecast:
43
+
44
+ puts "Tomorrow's High Temperature: " + forecast.tomorrow.high
45
+ puts "Tomorrow's Low Temperature: " + forecast.tomorrow.low
46
+ puts "Tomorrow's Sunrise: " + forecast.tomorrow.sunrise
47
+ puts "Tomorrow's Sunset: " + forecast.tomorrow.sunset
48
+ puts "Tomorrow's Wind Speed" + forecast.tomorrow.wind.speed
49
+
50
+ == Future Forecasts
51
+
52
+ Future forecasts can be accessed using day() method from Forecast class. This method accept an argument indicating the number of days that will be fetched. This functionality depends of the day that was defined at load_forecast() method.
53
+
54
+ puts "High Temperature 2 days from now: " + forecast.day(2).high
55
+ puts "High Temperature 2 days from now: " + forecast.day(2).low
56
+ puts "Sunrise 2 days from now: " + forecast.day(2).sunrise
57
+ puts "Sunset 2 days from now: " + forecast.day(2).sunset
58
+
59
+ == Cache
60
+
61
+ WeatherFinder uses Memcached[http://www.danga.com/memcached/] to support data caching. This functionality is very useful when a lot of requests are made by clients.
62
+
63
+ You need to install Ruby-MemCache[http://www.deveiate.org/code/Ruby-MemCache/] Gem:
64
+
65
+ sudo gem install Ruby-MemCache
66
+
67
+ After installation, you need to enable the cache:
68
+
69
+ service.enable_cache
70
+ service.cache.servers = "localhost:11211"
71
+ service.cache_expiry = 10
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{weatherfinder}
3
- s.version = "1.1"
3
+ s.version = "1.2"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Guilherme Nascimento"]
7
7
  s.date = %q{2009-02-20}
8
8
  s.description = %q{Weather Finder is a Ruby library to access Weather.com data (XOAP)}
9
9
  s.email = ["javaplayer@gmail.com"]
10
- s.files = ["weatherfinder.gemspec","lib/weatherfinder.rb", "lib/current.rb", "lib/day.rb", "lib/forecast.rb", "lib/future_estimate.rb", "lib/night.rb", "lib/wind.rb"]
10
+ s.files = ["weatherfinder.gemspec","lib/weatherfinder.rb", "lib/current.rb", "lib/day.rb", "lib/forecast.rb", "lib/future_estimate.rb", "lib/night.rb", "lib/wind.rb", "README", "License.txt"]
11
11
  s.require_paths = ["lib"]
12
12
  s.rubyforge_project = %q{weatherfinder}
13
13
  s.rubygems_version = %q{1.3.1}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weatherfinder
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.1"
4
+ version: "1.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Nascimento
@@ -31,6 +31,8 @@ files:
31
31
  - lib/future_estimate.rb
32
32
  - lib/night.rb
33
33
  - lib/wind.rb
34
+ - README
35
+ - License.txt
34
36
  has_rdoc: true
35
37
  homepage: http://weatherfinder.rubyforge.org/
36
38
  post_install_message: