myweatherforecast 0.5.2 → 0.5.5
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
- checksums.yaml.gz.sig +0 -0
- data/lib/myweatherforecast.rb +21 -9
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bc406aab9f5f598d784019fed895b64d1cfbc9e
|
4
|
+
data.tar.gz: bf9615a04c8281748d32a3d711d5d0dd2c0e495f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e97dc2f9c869961c409161f94c454a4dfd24e1047545e94c88464ec1f99cadd9e1fcf61b033f50cb74d9076a494848ea2898e49db39e7bed2ae790234ade0f6a
|
7
|
+
data.tar.gz: c1198cb17e718517caa6bf6e96791cced478c1a20e4378af9456c4653efb7e00e10e82c0f1a49a35745a380f631941e7e3b04f105c558e0e13b57f4238498f77
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/myweatherforecast.rb
CHANGED
@@ -17,11 +17,11 @@ class MyWeatherForecast
|
|
17
17
|
|
18
18
|
attr_reader :coordinates
|
19
19
|
|
20
|
-
def initialize(*location, api_key: nil, units: :auto, timeout: 3
|
20
|
+
def initialize(*location, api_key: nil, units: :auto, timeout: 3, \
|
21
|
+
symbols: true)
|
22
|
+
lat, lon = if location[0].is_a? Array then
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
location
|
24
|
+
location[0]
|
25
25
|
|
26
26
|
elsif location.any?
|
27
27
|
|
@@ -47,9 +47,15 @@ class MyWeatherForecast
|
|
47
47
|
|
48
48
|
autounits = @forecast['flags']['units']
|
49
49
|
|
50
|
-
@tlabel =
|
51
|
-
|
50
|
+
@tlabel = if symbols then
|
51
|
+
autounits == 'us' ? '°F' : '°C'
|
52
|
+
else
|
53
|
+
autounits == 'us' ? 'degrees Farenheit' : 'degrees Celcius'
|
54
|
+
end
|
52
55
|
|
56
|
+
@coordinates = [lat, lon]
|
57
|
+
@symbols = symbols
|
58
|
+
|
53
59
|
end
|
54
60
|
|
55
61
|
class Hourly
|
@@ -65,6 +71,9 @@ class MyWeatherForecast
|
|
65
71
|
else
|
66
72
|
[forecast.currently, forecast['hourly']['data']]
|
67
73
|
end
|
74
|
+
|
75
|
+
#@speed_label = 'kph'
|
76
|
+
@speed_label = 'mph' #if @forecast['flags']['units'][/^uk2$/]
|
68
77
|
|
69
78
|
end
|
70
79
|
|
@@ -106,8 +115,10 @@ class MyWeatherForecast
|
|
106
115
|
alias midday noon
|
107
116
|
|
108
117
|
def to_s
|
109
|
-
"%s: %d%s, %s" % [self.time.strftime("%-I%P"), @x.temperature.round, \
|
118
|
+
r = "%s: %d%s, %s" % [self.time.strftime("%-I%P"), @x.temperature.round, \
|
110
119
|
@tlabel, @x.summary]
|
120
|
+
r << ", %s" % [windspeed] if r[/windy|breezy/i]
|
121
|
+
r
|
111
122
|
end
|
112
123
|
|
113
124
|
def summary()
|
@@ -139,7 +150,7 @@ class MyWeatherForecast
|
|
139
150
|
end
|
140
151
|
|
141
152
|
def windspeed()
|
142
|
-
@x.windSpeed.round
|
153
|
+
"%s%s" % [@x.windSpeed.round, @speed_label]
|
143
154
|
end
|
144
155
|
|
145
156
|
private
|
@@ -197,7 +208,8 @@ class MyWeatherForecast
|
|
197
208
|
label = self.time.to_date == Time.now.to_date ? 'Today' : \
|
198
209
|
Date::ABBR_DAYNAMES[self.time.wday]
|
199
210
|
|
200
|
-
"%s: ▽%s ▲%s, %s" %
|
211
|
+
mask = @symbols ? "%s: ▽%s ▲%s, %s" : "%s: %s %s, %s"
|
212
|
+
mask % [label, tempmin, tempmax, @x.summary]
|
201
213
|
end
|
202
214
|
|
203
215
|
def sunrise()
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myweatherforecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
GwZIa3P1Ea+RT3dq6Es6+k/jkXNYth2ABedYgIgU0DgZpU/JrQ1DcvAA6VGUEwar
|
32
32
|
ztA769NWsU/h1g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-
|
34
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: forecast_io
|
metadata.gz.sig
CHANGED
Binary file
|