weather_fetcher 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -16,6 +16,7 @@ module WeatherFetcher
16
16
  processed = process(body)
17
17
  @post_process = Time.now
18
18
  store_time_costs(processed)
19
+ store_city_definition(processed, p)
19
20
 
20
21
  return processed
21
22
  end
@@ -44,6 +44,7 @@ module WeatherFetcher
44
44
  processed = WeatherData.factory(processed)
45
45
  @post_process = Time.now
46
46
  store_time_costs(processed)
47
+ store_city_definition(processed, p)
47
48
 
48
49
  return processed
49
50
  end
@@ -69,11 +69,12 @@ module WeatherFetcher
69
69
  return nil unless can_fetch?
70
70
 
71
71
  @pre_download = Time.now
72
- body = fetch_url(url)
72
+ body = fetch_url(url(d))
73
73
  @pre_process = Time.now
74
74
  processed = process(body)
75
75
  @post_process = Time.now
76
76
  store_time_costs(processed)
77
+ store_city_definition(processed, d)
77
78
 
78
79
  return processed
79
80
  end
@@ -108,5 +109,12 @@ module WeatherFetcher
108
109
  end
109
110
  end
110
111
 
112
+ def store_city_definition(_processed, _city_def)
113
+ return unless _processed.kind_of?(Array)
114
+ _processed.each do |p|
115
+ p.city_hash = _city_def
116
+ end
117
+ end
118
+
111
119
  end
112
120
  end
@@ -37,6 +37,15 @@ module WeatherFetcher
37
37
  @next_fetch_time = @fetch_time + _interval
38
38
  end
39
39
 
40
+ def is_metar?
41
+ self.provider == WeatherFetcher::MetarProvider.provider_name
42
+ end
43
+
44
+ def city
45
+ return nil? if @city_hash.nil?
46
+ @city_hash[:name]
47
+ end
48
+
40
49
  attr_reader :time_created, :time_from, :time_to, :fetch_time, :next_fetch_time,
41
50
  :temperature, :wind, :pressure, :wind_kmh, :snow, :rain,
42
51
  :rain_metar, :snow_metar,
@@ -44,5 +53,9 @@ module WeatherFetcher
44
53
  :provider,
45
54
  :metar_string
46
55
 
56
+ attr_accessor :city_hash
57
+
58
+
59
+
47
60
  end
48
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather_fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-15 00:00:00.000000000Z
12
+ date: 2012-09-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simple_metar_parser
16
- requirement: &24600500 !ruby/object:Gem::Requirement
16
+ requirement: &28276020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *24600500
24
+ version_requirements: *28276020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &24591560 !ruby/object:Gem::Requirement
27
+ requirement: &28272160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.3.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *24591560
35
+ version_requirements: *28272160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &24591080 !ruby/object:Gem::Requirement
38
+ requirement: &28271680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *24591080
46
+ version_requirements: *28271680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &24590580 !ruby/object:Gem::Requirement
49
+ requirement: &28271200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *24590580
57
+ version_requirements: *28271200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &24590060 !ruby/object:Gem::Requirement
60
+ requirement: &28270720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *24590060
68
+ version_requirements: *28270720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdoc
71
- requirement: &24589560 !ruby/object:Gem::Requirement
71
+ requirement: &28270220 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *24589560
79
+ version_requirements: *28270220
80
80
  description: Fetch weather from various Polish websites and via other gems. At the
81
81
  moment it is only polish portal Onet.pl but more providers will come soon.
82
82
  email: bobikx@poczta.fm
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -2317311865113955722
129
+ hash: -2375302931478023427
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements: