wwo 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wwo.rb +12 -3
- data/lib/wwo/version.rb +1 -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: 70fa3eddb446689e3a6876bb42ef1b9c970d03ef
|
4
|
+
data.tar.gz: 860cf5e6b71dcd1d0c7f1643366383beaf5f1553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b4d9b2d4a56782e86ea11d69502ac2bd4cb0416fa5bfe1599c3f2e4bc5b8a63e7dd6217433eee82016ed46b17d75e95e01d8e4a82e5b69c80a1b809f521b7a9
|
7
|
+
data.tar.gz: b0608c47c517ca4791ddf23f952bba597995582bc94c2d148141280d63230ab24071fc92342549c5c992d74dffe11ceecced12fc86d096771487204d8ebd6782
|
data/lib/wwo.rb
CHANGED
@@ -46,7 +46,7 @@ module Wwo
|
|
46
46
|
api_response = get(uri)
|
47
47
|
|
48
48
|
if api_response.success?
|
49
|
-
return Hashie::Mash.new(MultiJson.load(api_response.body))
|
49
|
+
return parse_response(Hashie::Mash.new(MultiJson.load(api_response.body)))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -64,7 +64,7 @@ module Wwo
|
|
64
64
|
api_response = get(uri)
|
65
65
|
|
66
66
|
if api_response.success?
|
67
|
-
return Hashie::Mash.new(MultiJson.load(api_response.body))
|
67
|
+
return parse_response(Hashie::Mash.new(MultiJson.load(api_response.body)))
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -85,8 +85,17 @@ module Wwo
|
|
85
85
|
|
86
86
|
def get(path, params = {})
|
87
87
|
params = Wwo.default_params.merge(params || {})
|
88
|
-
|
89
88
|
connection.get(path, params)
|
90
89
|
end
|
90
|
+
|
91
|
+
# Munges the repsonse into one like what we would expect from Forecast.io
|
92
|
+
#
|
93
|
+
def parse_response(response)
|
94
|
+
data = { daily: { data: [ { icon: '', 'temperatureMax' => 0, 'temperatureMin' => 0 } ] } }
|
95
|
+
data[:daily][:data][0][:icon] = response.data.weather.first.hourly.first.weatherIconUrl.first.value
|
96
|
+
data[:daily][:data][0]['temperatureMax'] = response.data.weather.first.maxtempC
|
97
|
+
data[:daily][:data][0]['temperatureMin'] = response.data.weather.first.mintempC
|
98
|
+
data
|
99
|
+
end
|
91
100
|
end
|
92
101
|
end
|
data/lib/wwo/version.rb
CHANGED