weather_fetcher 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "rspec", "~> 2.3.0"
5
+ gem "bundler", "~> 1.0.0"
6
+ gem "jeweler", "~> 1.6.4"
7
+ gem "rcov", ">= 0"
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ jeweler (1.6.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rake (0.9.2.2)
11
+ rcov (0.9.11)
12
+ rspec (2.3.0)
13
+ rspec-core (~> 2.3.0)
14
+ rspec-expectations (~> 2.3.0)
15
+ rspec-mocks (~> 2.3.0)
16
+ rspec-core (2.3.1)
17
+ rspec-expectations (2.3.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.3.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 1.0.0)
26
+ jeweler (~> 1.6.4)
27
+ rcov
28
+ rspec (~> 2.3.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.rdoc ADDED
@@ -0,0 +1,36 @@
1
+ = weather_fetcher
2
+
3
+ Fetch weather from various Polish websites and via other gems
4
+
5
+ == How to use
6
+
7
+ It is very early gem. More feature coming soon.
8
+
9
+ The simplest way to use is:
10
+
11
+ weathers = WeatherFetcher::Provider::OnetPl.new(defs).fetch
12
+
13
+ Where _defs_ is something like this:
14
+
15
+ - :url: 'http://pogoda.onet.pl/0,846,38,,,inowroclaw,miasto.html'
16
+ :city: 'Inowrocław'
17
+ :country: 'Poland'
18
+ :coord:
19
+ :lat: 52.799264
20
+ :lon: 18.259935
21
+
22
+ == Contributing to weather_fetcher
23
+
24
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
25
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
26
+ * Fork the project
27
+ * Start a feature/bugfix branch
28
+ * Commit and push until you are happy with your contribution
29
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
30
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
31
+
32
+ == Copyright
33
+
34
+ Copyright (c) 2011 Aleksander Kwiatkowski. See LICENSE.txt for
35
+ further details.
36
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "weather_fetcher"
18
+ gem.homepage = "http://github.com/akwiatkowski/weather_fetcher"
19
+ gem.license = "LGPLv3"
20
+ gem.summary = %Q{Fetch weather from various Polish websites and via other gems}
21
+ gem.description = %Q{Fetch weather from various Polish websites and via other gems. At the moment it is only polish portal Onet.pl but more providers will come soon.}
22
+ gem.email = "bobikx@poczta.fm"
23
+ gem.authors = ["Aleksander Kwiatkowski"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "weather_fetcher #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,23 @@
1
+ require 'net/http'
2
+
3
+ # All ugly providers who parse even uglier html code and rip off data
4
+ module WeatherFetcher
5
+ class HtmlBased < Provider
6
+
7
+ TYPE = :html_based
8
+
9
+ # Get processed weather for one definition
10
+ def fetch_and_process_single(d)
11
+ url = d[:url]
12
+ body = fetch_url(url)
13
+ processed = process(body)
14
+ return processed
15
+ end
16
+
17
+ # Download url
18
+ def fetch_url(url)
19
+ return Net::HTTP.get(URI.parse(url))
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,163 @@
1
+ #encoding: utf-8
2
+
3
+ module WeatherFetcher
4
+ class Provider::OnetPl < HtmlBased
5
+
6
+ def self.provider_name
7
+ "Onet.pl"
8
+ end
9
+
10
+ def process(string)
11
+ @weathers += _process_details(string)
12
+ @weathers += _process_daily(string)
13
+ end
14
+
15
+ # Process response body and rip out weather data, details
16
+ def _process_details(body_raw)
17
+
18
+ body_tmp = body_raw.downcase
19
+ # if body_tmp =~ /szczeg..owa(.*)Prognoza/
20
+ # body = $1
21
+ # else
22
+ # return []
23
+ # end
24
+ body = body_tmp
25
+
26
+ temperatures = body.scan(/<b\s*title=\"temperatura\">([^<]*)<\/b>/)
27
+ pressures = body.scan(/\>(\d*)\s*hpa\s*\</)
28
+ winds = body.scan(/(\d*)\s*km\/h/)
29
+ snows = body.scan(/nieg:<\/td><td class=\"[^"]*\">\s*([0-9.]*)\s*mm</)
30
+ rains = body.scan(/eszcz:<\/td><td class=\"[^"]*\">\s*([0-9.]*)\s*mm</)
31
+
32
+ # time now
33
+ time_now = body.scan(/<span class="ar2b gold">teraz <\/span><span class="ar2 gold">(\d*)-(\d*)<\/span>/)
34
+ # time soon
35
+ time_soon = body.scan(/<span class="ar2b gold">wkr.tce <\/span><span class="ar2 gold">(\d*)-(\d*)<\/span>/)
36
+
37
+ unix_time_today = Time.mktime(
38
+ Time.now.year,
39
+ Time.now.month,
40
+ Time.now.day,
41
+ 0, 0, 0, 0)
42
+
43
+ unix_time_now_from = unix_time_today + 3600 * time_now[0][0].to_i
44
+ unix_time_now_to = unix_time_today + 3600 * time_now[0][1].to_i
45
+ if time_now[0][1].to_i < time_now[0][0].to_i
46
+ # next day
47
+ unix_time_now_to += 24 * 3600
48
+ end
49
+
50
+ unix_time_soon_from = unix_time_today + 3600 * time_soon[0][0].to_i
51
+ unix_time_soon_to = unix_time_today + 3600 * time_soon[0][1].to_i
52
+ if time_soon[0][1].to_i < time_soon[0][0].to_i
53
+ # next day
54
+ unix_time_soon_to += 24 * 3600
55
+ end
56
+ if time_now[0][0].to_i > time_soon[0][0].to_i
57
+ # time soon is whole new day
58
+ unix_time_soon_from += 24 * 3600
59
+ unix_time_soon_to += 24 * 3600
60
+ end
61
+
62
+ data = [
63
+ {
64
+ :time_created => Time.now,
65
+ :time_from => unix_time_now_from,
66
+ :time_to => unix_time_now_to,
67
+ :temperature => temperatures[0][0].to_f,
68
+ :pressure => pressures[0][0].to_f,
69
+ :wind_kmh => winds[0][0].to_f,
70
+ :wind => winds[0][0].to_f / 3.6,
71
+ :snow => snows[0][0].to_f,
72
+ :rain => rains[0][0].to_f,
73
+ :provider => self.class.provider_name
74
+ },
75
+ {
76
+ :time_created => Time.now,
77
+ :time_from => unix_time_soon_from,
78
+ :time_to => unix_time_soon_to,
79
+ :temperature => temperatures[1][0].to_f,
80
+ :pressure => pressures[1][0].to_f,
81
+ :wind_kmh => winds[1][0].to_f,
82
+ :wind => winds[1][0].to_f / 3.6,
83
+ :snow => snows[1][0].to_f,
84
+ :rain => rains[1][0].to_f,
85
+ :provider => self.class.provider_name
86
+ }
87
+ ]
88
+
89
+ return data
90
+ end
91
+
92
+ # Process response body and rip out weather data, daily
93
+ def _process_daily(body_raw)
94
+
95
+ body_tmp = body_raw.downcase
96
+ body = body_tmp
97
+
98
+ #times = time_now = body.scan(/<span class=\"ar2 gold\">([0-9.]+)<\/span>/)
99
+ times = body.scan(/<span class=\"ar2 gold\">(\d{1,2})\.(\d{1,2})\.(\d{4})<\/span>/)
100
+ times = times.collect { |t|
101
+ t_from = Time.mktime(
102
+ t[2].to_i,
103
+ t[1].to_i,
104
+ t[0].to_i,
105
+ 0, 0, 0, 0)
106
+
107
+ { :time_from => t_from, :time_to => t_from + 24*3600 }
108
+ }
109
+ #puts times.size
110
+ #puts times.inspect
111
+
112
+ temperatures = body.scan(/<span title=\"temperatura w dzie.\">([-.0-9]+)<\/span>\s*<span title=\"temperatura w nocy\"[^>]*>([-.0-9]+)<\/span>/)
113
+ temperatures = temperatures.collect { |t|
114
+ { :temperature_night => t[1].to_f, :temperature_day => t[0].to_f, :temperature => (t[0].to_f + t[1].to_f)/2.0 }
115
+ }
116
+ #puts temperatures.size
117
+ #puts temperatures.inspect
118
+ #exit!
119
+
120
+ #pressures = body.scan(/>(\d+)\s*hpa</)
121
+ pressures = body.scan(/(\d+)\s*hpa/)
122
+ pressures = pressures.collect { |t| t[0].to_i }
123
+ # puts pressures.inspect
124
+
125
+ # wind speed in m/s
126
+ winds = body.scan(/(\d+)\s*km\/h/)
127
+ winds = winds.collect { |t| t[0].to_f / 3.6 }
128
+ # puts winds.inspect
129
+
130
+ snows = body.scan(/nieg:<\/td><td class="[^"]*">([0-9.]*)\s*mm</)
131
+ snows = snows.collect { |t| t[0].to_f }
132
+ # puts snows.inspect
133
+
134
+ rains = body.scan(/eszcz:<\/td><td class=\"[^"]*\">\s*([0-9.]*)\s*mm</)
135
+ rains = rains.collect { |t| t[0].to_f }
136
+ # puts rains.inspect
137
+
138
+
139
+ data = Array.new
140
+ # temperatures array because some last times is for detailed weather prediction
141
+ # not for days
142
+ (0...(temperatures.size)).each do |i|
143
+ h = {
144
+ :time_created => Time.now,
145
+ :time_from => times[i][:time_from],
146
+ :time_to => times[i][:time_to],
147
+ :temperature => temperatures[i][:temperature],
148
+ :pressure => pressures[i],
149
+ :wind_kmh => winds[i] * 3.6,
150
+ :wind => winds[i],
151
+ :snow => snows[i],
152
+ :rain => rains[i],
153
+ :provider => self.class.provider_name,
154
+ :weather_provider_id => id
155
+ }
156
+ data << h
157
+ end
158
+
159
+ return data
160
+ end
161
+
162
+ end
163
+ end
@@ -0,0 +1,64 @@
1
+ # Base class for ordinary weather provider
2
+ module WeatherFetcher
3
+ class Provider
4
+ # kind of provider: standard, html (self web based), gem (other gem)
5
+ TYPE = :standard
6
+
7
+ # Create an instance, definitions can be set here
8
+ def initialize(_defs = Array.new)
9
+ @weathers = Array.new
10
+ self.defs= _defs
11
+ end
12
+
13
+ attr_reader :weathers
14
+
15
+ # Definitions, format like below
16
+ #- :url: 'http://pogoda.onet.pl/0,846,38,,,inowroclaw,miasto.html'
17
+ # :city: 'Inowrocław'
18
+ # :country: 'Poland'
19
+ # :coord:
20
+ # :lat: 52.799264
21
+ # :lon: 18.259935
22
+
23
+ attr_reader :defs
24
+
25
+ def defs=(_defs)
26
+ if _defs.kind_of? Hash
27
+ @defs = [_defs]
28
+ elsif _defs.kind_of? Array
29
+ @defs = _defs
30
+ else
31
+ raise 'Wrong definitions type'
32
+ end
33
+ end
34
+
35
+ # Name of provider
36
+ def provider_name
37
+ self.class.provider_name
38
+ end
39
+
40
+ # Name of provider, should be overrode
41
+ def self.provider_name
42
+ raise 'Not implemented'
43
+ end
44
+
45
+ # Fetch everything from definitions (defs)
46
+ def fetch
47
+ a = Array.new
48
+ defs.each do |d|
49
+ a += fetch_and_process_single(d)
50
+ end
51
+ return a
52
+ end
53
+
54
+ # Fetch single definition
55
+ def fetch_and_process_single(d)
56
+ url = d[:url]
57
+ body = fetch_url(url)
58
+ processed = process(body)
59
+ return processed
60
+ end
61
+
62
+
63
+ end
64
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'providers/provider'
4
+ require 'providers/html_based'
5
+
6
+ require 'providers/onet_pl'
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'weather_fetcher/providers'
4
+
5
+ module WeatherFetcher
6
+ end
@@ -0,0 +1,6 @@
1
+ - :url: 'http://pogoda.onet.pl/0,846,38,,,inowroclaw,miasto.html'
2
+ :city: 'Inowrocław'
3
+ :country: 'Poland'
4
+ :coord:
5
+ :lat: 52.799264
6
+ :lon: 18.259935
@@ -0,0 +1,15 @@
1
+ describe "WeatherFetcher::Provider::OnetPl" do
2
+ before :each do
3
+ @defs = load_fixture('onet_pl')
4
+ @defs.size.should > 0
5
+ end
6
+
7
+ it "simple fetch" do
8
+ f = WeatherFetcher::Provider::OnetPl.new(@defs)
9
+ weathers = f.fetch
10
+ weathers.should == f.weathers
11
+
12
+ puts weathers.to_yaml
13
+
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'weather_fetcher'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
13
+
14
+ def load_fixture(f)
15
+ return YAML::load(File.open(File.join(Dir.pwd, 'spec', 'fixtures', "#{f}.yml")))
16
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "WeatherFetcher" do
4
+ it "simple stuff" do
5
+ WeatherFetcher.class.should == Module
6
+ end
7
+
8
+ it "should accept only Array or Hash definitions" do
9
+ lambda { WeatherFetcher::Provider.new("ble") }.should raise_error
10
+ lambda { WeatherFetcher::Provider.new(1) }.should raise_error
11
+ lambda { WeatherFetcher::Provider.new() }.should_not raise_error
12
+ lambda { WeatherFetcher::Provider.new([]) }.should_not raise_error
13
+ lambda { WeatherFetcher::Provider.new({}) }.should_not raise_error
14
+ end
15
+
16
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: weather_fetcher
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Aleksander Kwiatkowski
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-25 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 2
29
+ - 3
30
+ - 0
31
+ version: 2.3.0
32
+ version_requirements: *id001
33
+ name: rspec
34
+ prerelease: false
35
+ type: :development
36
+ - !ruby/object:Gem::Dependency
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 23
43
+ segments:
44
+ - 1
45
+ - 0
46
+ - 0
47
+ version: 1.0.0
48
+ version_requirements: *id002
49
+ name: bundler
50
+ prerelease: false
51
+ type: :development
52
+ - !ruby/object:Gem::Dependency
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 7
59
+ segments:
60
+ - 1
61
+ - 6
62
+ - 4
63
+ version: 1.6.4
64
+ version_requirements: *id003
65
+ name: jeweler
66
+ prerelease: false
67
+ type: :development
68
+ - !ruby/object:Gem::Dependency
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ version_requirements: *id004
79
+ name: rcov
80
+ prerelease: false
81
+ type: :development
82
+ description: Fetch weather from various Polish websites and via other gems. At the moment it is only polish portal Onet.pl but more providers will come soon.
83
+ email: bobikx@poczta.fm
84
+ executables: []
85
+
86
+ extensions: []
87
+
88
+ extra_rdoc_files:
89
+ - LICENSE.txt
90
+ - README.rdoc
91
+ files:
92
+ - .document
93
+ - .rspec
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - LICENSE.txt
97
+ - README.rdoc
98
+ - Rakefile
99
+ - VERSION
100
+ - lib/weather_fetcher.rb
101
+ - lib/weather_fetcher/providers.rb
102
+ - lib/weather_fetcher/providers/html_based.rb
103
+ - lib/weather_fetcher/providers/onet_pl.rb
104
+ - lib/weather_fetcher/providers/provider.rb
105
+ - spec/fixtures/onet_pl.yml
106
+ - spec/providers/onet_pl_spec.rb
107
+ - spec/spec_helper.rb
108
+ - spec/weather_fetcher_spec.rb
109
+ homepage: http://github.com/akwiatkowski/weather_fetcher
110
+ licenses:
111
+ - LGPLv3
112
+ post_install_message:
113
+ rdoc_options: []
114
+
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
125
+ version: "0"
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ hash: 3
132
+ segments:
133
+ - 0
134
+ version: "0"
135
+ requirements: []
136
+
137
+ rubyforge_project:
138
+ rubygems_version: 1.8.10
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: Fetch weather from various Polish websites and via other gems
142
+ test_files: []
143
+