easy_weather 1.0.0 → 1.0.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/.gitignore +12 -0
- data/lib/easy_weather/version.rb +1 -1
- data/lib/easy_weather/weather.rb +12 -12
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afc8caa0258342ad30f9fbe0cec0d004ba1e40d23884814b7884bd7fa78409a0
|
4
|
+
data.tar.gz: 2a790cd66d2a9d43bbb635abe56a2a74309d55c35401086d7f5ac65db16da795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '04468f04eb407e618dcfd6f6ec46f8422fefe4db7bb5dcde84bde5e8eb0b31385cf747a98082b1d92fdf8682ffc19564ccf1746dde0009a4911928b716b157a4'
|
7
|
+
data.tar.gz: 5013a67e8bc600f16ad938d70dfdf8ad5160d5af03b38b6cb55ff4d53f6669164337d7ac19d76ec8bb2aea8d5ac4db11874840f18a60ec8ff54581567b961545
|
data/.gitignore
ADDED
data/lib/easy_weather/version.rb
CHANGED
data/lib/easy_weather/weather.rb
CHANGED
@@ -3,42 +3,42 @@ require 'httparty'
|
|
3
3
|
|
4
4
|
class Weather
|
5
5
|
attr_accessor :data, :forecast
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(city)
|
8
|
-
@data =
|
9
|
-
@forecast =
|
8
|
+
@data = get_general_data(city)
|
9
|
+
@forecast = get_forecast_data(5, city)
|
10
10
|
end
|
11
11
|
|
12
12
|
def forecast_data
|
13
|
-
|
13
|
+
forecast["list"].each_with_index do |day, index|
|
14
14
|
puts "Day #{index + 1}\n"
|
15
15
|
puts "Temperature: #{day["main"]["temp"]} centigrades\n"
|
16
16
|
puts "Weather: #{day["weather"][0]["description"]}\n"
|
17
17
|
end
|
18
|
-
"
|
18
|
+
"Take your precautions for the week!"
|
19
19
|
end
|
20
20
|
|
21
21
|
def astronomy_data
|
22
22
|
data_hash =
|
23
|
-
{ sunrise:
|
24
|
-
sunset:
|
23
|
+
{ sunrise: data["sys"]["sunrise"],
|
24
|
+
sunset: data["sys"]["sunset"]
|
25
25
|
}
|
26
26
|
"Sunrice: #{data_hash[:sunrise]} UTC, sunset: #{data_hash[:sunset]} UTC"
|
27
27
|
end
|
28
28
|
|
29
29
|
def temperature
|
30
|
-
"#{
|
30
|
+
"#{data["main"]["temp"]} centigrades"
|
31
31
|
end
|
32
32
|
|
33
33
|
def wind
|
34
|
-
"#{
|
34
|
+
"#{data["wind"]["speed"]} meters/sec"
|
35
35
|
end
|
36
36
|
|
37
37
|
def atmosphere_data
|
38
38
|
data_hash =
|
39
|
-
{ humidity:
|
40
|
-
pressure:
|
41
|
-
visibility:
|
39
|
+
{ humidity: data["main"]["humidity"],
|
40
|
+
pressure: data["main"]["pressure"],
|
41
|
+
visibility: data["visibility"]
|
42
42
|
}
|
43
43
|
"Humidy: #{data_hash[:humidity]}%, pressure: #{data_hash[:pressure]}hPa, visibility: #{data_hash[:visibility]} meters"
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_weather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Tinoco
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -31,6 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".gitignore"
|
34
35
|
- ".rspec"
|
35
36
|
- ".rubocop.yml"
|
36
37
|
- CODE_OF_CONDUCT.md
|