Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: akwiatkowski/weather_fetcher
base: f3ce8017e7
...
head fork: akwiatkowski/weather_fetcher
compare: cd137fefc2
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
2  VERSION
@@ -1 +1 @@
-0.0.10
+0.0.11
View
11 lib/weather_fetcher/providers/html_based/world_weather_online.rb
@@ -96,13 +96,18 @@ def process(string)
# Process json node to Hash for AR
def process_node(node)
+ # http://www.worldweatheronline.com/marine-weather-api.aspx
return {
:temperature => node["temp_C"].to_i,
:wind => node["windspeedKmph"].to_f / 3.6,
- :pressure => node["pressure"].to_f / 3.6,
- :rain => node["precipMM"].to_f / 3.6,
+ :pressure => node["pressure"].to_f,
+ :rain => node["precipMM"].to_f,
:snow => nil,
- :provider => self.class.provider_name
+ :provider => self.class.provider_name,
+
+ :cloud_cover => node["cloudcover"].to_f,
+ :humidity => node["humidity"].to_f,
+ :visibility => node["visibility"].to_f,
}
end
View
1  lib/weather_fetcher/weather_data.rb
@@ -40,6 +40,7 @@ def next_within!(_interval)
attr_reader :time_created, :time_from, :time_to, :fetch_time, :next_fetch_time,
:temperature, :wind, :pressure, :wind_kmh, :snow, :rain,
:rain_metar, :snow_metar,
+ :cloud_cover, :humidity, :visibility, # available in WorldWeatherOnline
:provider,
:metar_string
View
19 spec/fetcher_problematic_spec.rb
@@ -30,4 +30,23 @@
_res = _p.weathers
_res.should be_kind_of(Array)
end
+
+ it "should fetch Bydgoszcz using WeatherFetcher::Provider::WorldWeatherOnline" do
+ _d = { :name=>"Bydgoszcz", :country=>"Poland", :metar=>"EPBY", :coords=>{ :lat=>53.0968, :lon=>17.9777 }, :classes=>{ "OnetPl"=>{ :url=>"http://pogoda.onet.pl/prognoza-pogody/dzis/europa,polska,bydgoszcz,9315.html" }, "WpPl"=>{ :url=>"http://pogoda.wp.pl/miasto,bydgoszcz,mid,1201023,mi.html" }, "InteriaPl"=>{ :url=>"http://pogoda.interia.pl/miasta?id=11666" } } }
+ _p = WeatherFetcher::Provider::WorldWeatherOnline.new(_d)
+ _p.fetch
+ _res = _p.weathers
+ _res.should be_kind_of(Array)
+
+ _res.each do |wd|
+ # TODO why pressure is nil?
+ unless wd.pressure.nil?
+ wd.pressure.should > 900.0
+ wd.pressure.should < 1100.0
+ end
+ # puts wd.cloud_cover, wd.humidity, wd.visibility
+ end
+
+ # puts _res.inspect
+ end
end
View
2  weather_fetcher.gemspec
@@ -5,7 +5,7 @@
Gem::Specification.new do |s|
s.name = "weather_fetcher"
- s.version = "0.0.10"
+ s.version = "0.0.11"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Aleksander Kwiatkowski"]

No commit comments for this range

Something went wrong with that request. Please try again.