rateless_bot 0.4.2 → 0.4.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1afd0f0f226de0939b6d63f901740003e936a9d5
4
- data.tar.gz: c9d644125b2eea0c6b5d97291a7f6fbabc0aa0e7
3
+ metadata.gz: 947154256dead747995dbd6f3c3f00594e3a77ae
4
+ data.tar.gz: 31e22f6d1d104048f663063f8947d36514f4fada
5
5
  SHA512:
6
- metadata.gz: 3dc300b8625b19a2176affabbc6d1e852b67dd89107708c25c6bdcc6b99edd38224a8cc1f3f0478a9cab17872a335d83bc1e01cd77c024f683e579ab6c26326f
7
- data.tar.gz: 0cd08b179156cea5d69a63dc66ea70774560e58a4c8c8a9db00be25b3abbddd961fc03f6ebb5dae39636458fb8f116ea1eb90c947e8805db89007f4b92ea4ed7
6
+ metadata.gz: 374d74681954857c597f590ee0ae1479d59da1ce9118ab595567452ba8104f4781880a936209254bd68ef7e50eb4619d55cc8b1bd0ce78043b5cb2a8918a1b64
7
+ data.tar.gz: 9e0ac4530ecf6861def1576f171b72c4314fecfa4efbf4dd80b0067d79edd58396b17304dc317e6da899b78bcfaae1da9aabc8ac6df393a94964b9d8372d5088
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rateless_bot (0.4.1)
4
+ rateless_bot (0.4.2)
5
5
  cinch (= 2.3.2)
6
6
  countries (= 1.2.5)
7
7
  lastfm (= 1.27.1)
@@ -32,7 +32,7 @@ private
32
32
  elsif current_weather['cod'] != 200 # number is not a string; report bug
33
33
  return "Error: response code #{current_weather['cod']}"
34
34
  end
35
-
35
+ p current_weather
36
36
  city = current_weather['name']
37
37
  country = ISO3166::Country.new(current_weather['sys']['country']).name
38
38
  humidity = current_weather['main']['humidity']
@@ -41,13 +41,23 @@ private
41
41
  wind_speed_mps = current_weather['wind']['speed']
42
42
  wind_speed_mph = (wind_speed_mps * 0.000621371 * 60**2).round(2)
43
43
  wind_direction_degrees = current_weather['wind']['deg']
44
- cardinal_wind_direction = degrees_to_cardinal(wind_direction_degrees)
44
+
45
+ if !wind_direction_degrees.nil?
46
+ cardinal_wind_direction = degrees_to_cardinal(wind_direction_degrees)
47
+ end
48
+
45
49
  weather_description = current_weather['weather'][0]['description']
46
50
 
47
51
  s = "Weather for #{city} (#{country}): "
48
52
  s += "#{temp_celsius}°C (#{temp_fahrenheit}°F); #{humidity}% humidity; "
49
- s += "#{wind_speed_mps}m/s (#{wind_speed_mph}mph) winds "
50
- s += "blowing #{cardinal_wind_direction} (#{wind_direction_degrees}°); "
53
+ s += "#{wind_speed_mps}m/s (#{wind_speed_mph}mph) winds"
54
+
55
+ if wind_direction_degrees.nil?
56
+ s += '; '
57
+ else
58
+ s += " blowing #{cardinal_wind_direction} (#{wind_direction_degrees}°); "
59
+ end
60
+
51
61
  s += "#{weather_description}"
52
62
  end
53
63
 
@@ -1,3 +1,3 @@
1
1
  module RatelessBot
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rateless_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Heuken