myweatherforecast 0.5.8 → 1.0.4
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/myweatherforecast.rb +50 -8
- metadata +54 -31
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8142fa7d9e5a57ddff1cdc0f427df84f988d7e39da32f396aefc67541b58f50
|
4
|
+
data.tar.gz: c8df2087409619441ac6525612a308b6ce1d0980e0e4b16695c7aa3bef4d433a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f0e34e382a7f40da971091163e30794061969798cac4db08db095759c184e6654840743878a2858650877295b09cc135a61c475c2f562199a7871e0e5040c3d
|
7
|
+
data.tar.gz: 2ef8e4a635a276fa1bd43ad11d59ad76e0a7342fdfcaa28a30390245bb207fd977ba9a7c55cad2933d63c6977d19363d916ecc21a2157d6a60ce9dc75f800be3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/myweatherforecast.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
require 'json'
|
6
6
|
require 'time'
|
7
7
|
require 'geocoder'
|
8
|
-
require 'forecast_io'
|
9
8
|
require 'open-uri'
|
10
|
-
|
9
|
+
require 'emoji2020'
|
10
|
+
require 'forecast_io'
|
11
11
|
|
12
12
|
|
13
13
|
# This gem is a wrapper of the forecast_io gem
|
@@ -94,7 +94,7 @@ class MyWeatherForecast
|
|
94
94
|
|
95
95
|
current_hour = Time.at(@hourly_data[0]['time']).hour + advance
|
96
96
|
|
97
|
-
case current_hour
|
97
|
+
name = case current_hour
|
98
98
|
when 12..17
|
99
99
|
:afternoon
|
100
100
|
when 0..5
|
@@ -107,10 +107,33 @@ class MyWeatherForecast
|
|
107
107
|
:night
|
108
108
|
end
|
109
109
|
|
110
|
+
method(name).call
|
111
|
+
|
110
112
|
end
|
111
113
|
|
112
|
-
def afternoon() period(12, 17) end
|
114
|
+
def afternoon() period(12, 17) end
|
115
|
+
def detail() period(0, 23) end
|
113
116
|
def early_hours() period(0, 5) end
|
117
|
+
|
118
|
+
def emoji()
|
119
|
+
|
120
|
+
h = {
|
121
|
+
'clear-day' => :sun,
|
122
|
+
'clear-night' => :night_with_stars,
|
123
|
+
'rain' => :cloud_with_rain,
|
124
|
+
'snow' => :cloud_with_snow,
|
125
|
+
'sleet' => :cloud_with_rain,
|
126
|
+
'wind' => :leaf_fluttering_in_wind,
|
127
|
+
'fog' => :fog,
|
128
|
+
'cloudy' => :cloud,
|
129
|
+
'partly-cloudy-day' => :sun_behind_cloud,
|
130
|
+
'partly-cloudy-night' => :cloud
|
131
|
+
}
|
132
|
+
|
133
|
+
Emoji2020.new(h[icon()]).to_s
|
134
|
+
|
135
|
+
end
|
136
|
+
|
114
137
|
def evening() period(17, night_time.hour+1) end
|
115
138
|
def morning() period(6, 12) end
|
116
139
|
def night() period(night_time.hour, 23) end
|
@@ -222,13 +245,16 @@ class MyWeatherForecast
|
|
222
245
|
|
223
246
|
end
|
224
247
|
|
248
|
+
def day()
|
249
|
+
Date::ABBR_DAYNAMES[self.time.wday]
|
250
|
+
end
|
251
|
+
|
225
252
|
def to_s
|
226
253
|
|
227
|
-
label = self.time.to_date == Time.now.to_date ? 'Today' :
|
228
|
-
Date::ABBR_DAYNAMES[self.time.wday]
|
229
|
-
|
254
|
+
label = self.time.to_date == Time.now.to_date ? 'Today' : day()
|
230
255
|
mask = @symbols ? "%s: ▽%s ▲%s, %s" : "%s: %s %s, %s"
|
231
256
|
mask % [label, tempmin, tempmax, @x.summary]
|
257
|
+
|
232
258
|
end
|
233
259
|
|
234
260
|
def sunrise()
|
@@ -310,6 +336,22 @@ class MyWeatherForecast
|
|
310
336
|
alias wed wednesday
|
311
337
|
alias thu thursday
|
312
338
|
alias fri friday
|
339
|
+
|
340
|
+
def next_3days()
|
341
|
+
|
342
|
+
days().take(4)[1..-1].map do |x|
|
343
|
+
"%s: %s - %s %s" % [x.time.strftime("%a"), x.tempmin, x.tempmax, x.summary]
|
344
|
+
end.join("\n")
|
345
|
+
|
346
|
+
end
|
347
|
+
|
348
|
+
def next_5days()
|
349
|
+
|
350
|
+
days().take(6)[1..-1].map do |x|
|
351
|
+
"%s: %s %s" % [x.time.strftime("%a"), x.tempmax, x.summary]
|
352
|
+
end.join("\n")
|
353
|
+
|
354
|
+
end
|
313
355
|
|
314
356
|
private
|
315
357
|
|
@@ -323,4 +365,4 @@ class MyWeatherForecast
|
|
323
365
|
Daily.new(@forecast, @tlabel, d)
|
324
366
|
end
|
325
367
|
|
326
|
-
end
|
368
|
+
end
|
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.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwNDI2MDkw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o/Qy0ruxCnNtCvXsVEx6P1TVLaZBxkU/i/H3TgNrOsqgRHz
|
30
|
+
8S428Xg3PTTYkMf27+sLMO8uXmEYeCjrbdEyUBiCtmPht776T2nepwOJNwqgb8x8
|
31
|
+
qSMtqEYZxY3x+4Dd9CNf2xQujQ26Q4qyZnzYIuZQb9aHMgAiww3rst8Kxc83pggI
|
32
|
+
It47yWd2GhjXd7fv/9MZ0Uhfov+ExsqSr9H0HDjf8KCL+Y9OzNAW7ixpQpXK0pQJ
|
33
|
+
i54CNZiaGNwJnBVp9USO7cA5jCKN1Iouaj/Vbie5XXhiGnOZ/cyfna/K/fX10/lh
|
34
|
+
JL0NiXQMvY3FTEjgq7BZxit1Q7dE07TH54CD/f5EMNm9v/f5BKVPDF+pfAUrZnKy
|
35
|
+
T8ZItjfCqcG6MNMdmPqplYAqpSJzVB9ucdkrz8Ia5Lf1waJw6Dd0m1zHWYSofIH8
|
36
|
+
HuG3HnRIMQNQE2s1PFtxmX2w
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: forecast_io
|
@@ -42,7 +46,7 @@ dependencies:
|
|
42
46
|
version: '2.0'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.0.
|
49
|
+
version: 2.0.2
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,29 +56,49 @@ dependencies:
|
|
52
56
|
version: '2.0'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.0.
|
59
|
+
version: 2.0.2
|
56
60
|
- !ruby/object:Gem::Dependency
|
57
61
|
name: geocoder
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
64
|
- - "~>"
|
61
65
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
66
|
+
version: '1.6'
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1.
|
69
|
+
version: 1.6.3
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
requirements:
|
70
74
|
- - "~>"
|
71
75
|
- !ruby/object:Gem::Version
|
72
|
-
version: '1.
|
76
|
+
version: '1.6'
|
73
77
|
- - ">="
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
79
|
+
version: 1.6.3
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: emoji2020
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0.2'
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.1
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.2'
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.2.1
|
76
100
|
description:
|
77
|
-
email: james@
|
101
|
+
email: james@jamesrobertson.eu
|
78
102
|
executables: []
|
79
103
|
extensions: []
|
80
104
|
extra_rdoc_files: []
|
@@ -99,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
123
|
- !ruby/object:Gem::Version
|
100
124
|
version: '0'
|
101
125
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.4.8
|
126
|
+
rubygems_version: 3.0.3
|
104
127
|
signing_key:
|
105
128
|
specification_version: 4
|
106
129
|
summary: This gem is a wrapper of the forecast_io gem.
|
metadata.gz.sig
CHANGED
Binary file
|