weatherfor 0.2.1 → 0.2.2
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/.rubocop.yml +0 -4
- data/README.md +5 -8
- data/lib/weatherfor.rb +4 -4
- data/lib/weatherfor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a3a7da1e14cacc4b0a0e2650017fa6fc252e98e5b14e5e5eece2327ca0a1650
|
4
|
+
data.tar.gz: 77cac703ed39dd4b07dfc6e77c7a4ef22eed49794bbb57620682a54d503a1975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfeaf90ece59194dc2e30ab5cb7204d58c790eff94afcb3b9a883fce8123a6977005fb826c3f01bac8765670d345962b81d9b080925ed052f5055df79bf08107
|
7
|
+
data.tar.gz: e1130670918e4f173748e5de0feaa372db9788005db92111482d88452c6a437a3d80b1f35eebba33c4259cf437f258082279ed91ba41b03068162192211291fd
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Weatherfor
|
2
2
|
|
3
|
+
[](https://github.com/k41n3w/weatherfor/actions/workflows/gem-push.yml)
|
4
|
+
|
3
5
|
Welcome to Weatherfor gem!
|
4
6
|
|
5
7
|
The purpose of this Gem is to make API requests to OpenWeatherAPI to query meteorological data to process the average temperature for the next five days.
|
@@ -36,15 +38,10 @@ Methodo to consult average temperature in days:
|
|
36
38
|
req.weather_in_days
|
37
39
|
```
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
```
|
41
|
+
This will bring a message like that:
|
42
|
+
|
43
|
+
34°C e nublado em <cidade> em 12/12. Média para os próximos dias: 32°C em 13/12, 25°C em 14/12, 29°C em 15/12, 33°C em 16/12 e 28°C em 16/12.
|
43
44
|
|
44
|
-
Method to consult the city request data:
|
45
|
-
```ruby
|
46
|
-
req.list
|
47
|
-
```
|
48
45
|
## Development
|
49
46
|
|
50
47
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/weatherfor.rb
CHANGED
@@ -32,7 +32,7 @@ module Weatherfor
|
|
32
32
|
|
33
33
|
def avg_temp_in_days
|
34
34
|
@arr = []
|
35
|
-
|
35
|
+
obj['list'].group_by { |item| Time.at(item['dt']).strftime('%m-%d-%Y') }.each do |date, data|
|
36
36
|
avg_temp = data.sum { |info| info['main']['temp'] }
|
37
37
|
avg_temp /= data.count
|
38
38
|
@arr << { avg_temp: avg_temp, date: date }
|
@@ -40,15 +40,15 @@ module Weatherfor
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def today_avg_temp
|
43
|
-
|
43
|
+
obj['list'][0]['main']['temp'].round
|
44
44
|
end
|
45
45
|
|
46
46
|
def city_name
|
47
|
-
|
47
|
+
obj['city']['name']
|
48
48
|
end
|
49
49
|
|
50
50
|
def current_temp_desc
|
51
|
-
|
51
|
+
obj['list'][0]['weather'][0]['description']
|
52
52
|
end
|
53
53
|
|
54
54
|
def current_date
|
data/lib/weatherfor/version.rb
CHANGED