weather_fetcher 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/weather_fetcher/fetcher.rb +1 -1
- data/lib/weather_fetcher/providers/html_based/world_weather_online.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 270dcf5030313ef8855cb98e01873a13a110004c
|
4
|
+
data.tar.gz: d4a32c91a82362b69e1e318f39e34730f392c8ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8f33ac89ec4949b7041f8df0cfe9f0f7ff9591ebc8195664c6ad150f130b30afea4d6c81d5436f8630f4e46219349ff3d96d11c5406f7b0aeb54ce88c9a21da
|
7
|
+
data.tar.gz: f47cc17506b562bb5cf8d4afc1ead3f69e64a27319bca37e83d29e085a9d4805c52316ac2c52b77809d3ef4dcb1e6ecb2b203e7559b7d90f68984fd715cedc0f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -15,7 +15,7 @@ module WeatherFetcher
|
|
15
15
|
|
16
16
|
# This provider required API key
|
17
17
|
def self.api=(_api)
|
18
|
-
@@api = _api
|
18
|
+
@@api = _api unless _api.to_s == ""
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.api
|
@@ -23,6 +23,18 @@ module WeatherFetcher
|
|
23
23
|
@@api
|
24
24
|
end
|
25
25
|
|
26
|
+
# Create an instance, definitions can be set here
|
27
|
+
def initialize(*args)
|
28
|
+
super(*args)
|
29
|
+
|
30
|
+
# set api key if exists
|
31
|
+
self.defs.each do |d|
|
32
|
+
if d and d[:classes] and d[:classes][self.class.provider_name] and d[:classes][self.class.provider_name][:key]
|
33
|
+
self.class.api = d[:classes][self.class.provider_name][:key]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
26
38
|
# Url for current provider
|
27
39
|
def url(p)
|
28
40
|
"http://api.worldweatheronline.com/free/v1/weather.ashx?q=#{p[:coords][:lat]},#{p[:coords][:lon]}&format=json&num_of_days=5&key=#{@@api}"
|