weatherbot 0.1.4.2 → 0.1.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 +4 -4
- data/bin/weatherbot +1 -1
- data/lib/api.rb +10 -12
- data/lib/cli.rb +30 -2
- data/lib/version.rb +1 -1
- data/weatherbot.gemspec +1 -1
- metadata +2 -16
- data/weatherbot-0.1.1.gem +0 -0
- data/weatherbot-0.1.2.gem +0 -0
- data/weatherbot-0.1.3.1.gem +0 -0
- data/weatherbot-0.1.3.2.gem +0 -0
- data/weatherbot-0.1.3.3.gem +0 -0
- data/weatherbot-0.1.3.4.gem +0 -0
- data/weatherbot-0.1.3.5.gem +0 -0
- data/weatherbot-0.1.3.6.gem +0 -0
- data/weatherbot-0.1.3.7.gem +0 -0
- data/weatherbot-0.1.3.8.gem +0 -0
- data/weatherbot-0.1.3.9.gem +0 -0
- data/weatherbot-0.1.3.gem +0 -0
- data/weatherbot-0.1.4.0.gem +0 -0
- data/weatherbot-0.1.4.1.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e64af5dbf4410b31535862801806d990bae5ef2
|
|
4
|
+
data.tar.gz: b0d84dcca67ea33e7e31666d69ddfca6a53da1f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70b71ad28f7e392f9688fdcd27f02ff84cc8fa5af6c2282e91fee9a4c9d939eb64803066c45a30a61c3f898b7c4ba1aa7667b240604635c57aa07f3c6acfeb38
|
|
7
|
+
data.tar.gz: e3baf88c6eb63ead56844ac52d544eaf75147cae28ddf9ea9323ab0aef57f010a6b3bf652da0c88b75d2ad926bcee82cb200894fb203107c5c17c484a6047c28
|
data/bin/weatherbot
CHANGED
data/lib/api.rb
CHANGED
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
class Weatherbot::API < Helper
|
|
3
3
|
attr_accessor :location, :response_code, :coordinates, :country, :location_name, :temp_avg, :temp_celsius, :condition, :cloudiness, :humidity, :wind_speed, :wind_direction, :report_time, :google_maps, :google_maps_link, :sunrise, :sunset, :hr24_dt, :hr48_dt, :hr72_dt, :temp24, :temp48, :temp72, :condition24, :condition48, :condition72, :cloudiness24, :cloudiness48, :cloudiness72, :humidity24, :humidity48, :humidity72, :wind_speed24, :wind_speed48, :wind_speed72, :wind_direction24, :wind_direction48, :wind_direction72
|
|
4
4
|
|
|
5
|
+
@@locations = []
|
|
6
|
+
|
|
5
7
|
def initialize
|
|
6
8
|
@location = location
|
|
9
|
+
@@locations << self
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.locations
|
|
13
|
+
@@locations
|
|
7
14
|
end
|
|
8
15
|
|
|
9
16
|
# Takes user input to enter into URL query & gets current weather conditions in imperial units
|
|
@@ -45,19 +52,10 @@ class Weatherbot::API < Helper
|
|
|
45
52
|
@current.country = nil
|
|
46
53
|
end
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
puts "Location: #{@current.location_name}, #{@current.country}"
|
|
50
|
-
puts "Coordinates: #{@current.coordinates}"
|
|
51
|
-
puts "Google Maps: #{@current.google_maps}"
|
|
52
|
-
puts "\nTemperature: #{@current.temp_avg}ºF / #{@current.temp_celsius}ºC"
|
|
53
|
-
puts "Condition: #{@current.condition.capitalize}"
|
|
54
|
-
puts "Cloudiness: #{@current.cloudiness}%"
|
|
55
|
-
puts "\nHumidity: #{@current.humidity}%"
|
|
56
|
-
puts "Wind Speed: #{@current.wind_speed} mph"
|
|
57
|
-
puts "Wind Direction: #{@current.wind_direction}"
|
|
58
|
-
puts "\nSunrise: #{@current.sunrise}"
|
|
59
|
-
puts "Sunset: #{@current.sunset}"
|
|
55
|
+
|
|
60
56
|
end
|
|
57
|
+
|
|
58
|
+
@current
|
|
61
59
|
end
|
|
62
60
|
|
|
63
61
|
|
data/lib/cli.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
class Weatherbot::CLI
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
def call
|
|
6
7
|
puts "
|
|
7
8
|
__ __ ___ ___ __ __ __
|
|
@@ -38,6 +39,7 @@ class Weatherbot::CLI
|
|
|
38
39
|
puts "\n-------------------------------\n"
|
|
39
40
|
puts "\nPlease enter a specific location in the format: <location>, <country> to check the current weather conditions for that location. You can also search by <location>, <state/region>, <country> to find the correct specific location.
|
|
40
41
|
\nType 'map' to open the most relevant result in your OS default browser.
|
|
42
|
+
\nType 'list' to see a list of previous locations.
|
|
41
43
|
\n*NOTE: This will open your web browser to the most likely location coordinates in Google Maps.*
|
|
42
44
|
\nYou can also type 'forecast' to display the 3 day forecast of the most recent search. To quit, type 'exit'.\n"
|
|
43
45
|
puts "\n-------------------------------\n"
|
|
@@ -49,14 +51,19 @@ class Weatherbot::CLI
|
|
|
49
51
|
puts "\n\n\nSee you again soon!\n\n\n"
|
|
50
52
|
exit
|
|
51
53
|
end
|
|
52
|
-
|
|
54
|
+
# Check if user wants to enter invalid input before location
|
|
53
55
|
if input === "forecast" || input === "map"
|
|
54
56
|
puts "\n\n\nYou need to input a location first!\n\n\n"
|
|
55
57
|
menu
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
# Display current weather
|
|
59
|
-
Weatherbot::API.current_weather(input)
|
|
61
|
+
weather = Weatherbot::API.current_weather(input)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
display_weather(weather)
|
|
66
|
+
|
|
60
67
|
new_input = gets.chomp.downcase
|
|
61
68
|
|
|
62
69
|
# Check for specific input commands
|
|
@@ -68,6 +75,8 @@ class Weatherbot::CLI
|
|
|
68
75
|
if new_input === "forecast"
|
|
69
76
|
Weatherbot::API.forecast(input)
|
|
70
77
|
menu
|
|
78
|
+
elsif new_input === "list"
|
|
79
|
+
display_previous
|
|
71
80
|
elsif new_input === "map"
|
|
72
81
|
Weatherbot::API.open_link
|
|
73
82
|
menu
|
|
@@ -80,5 +89,24 @@ class Weatherbot::CLI
|
|
|
80
89
|
|
|
81
90
|
end
|
|
82
91
|
|
|
92
|
+
def display_weather(weather)
|
|
93
|
+
puts "\n\nReport Time: #{weather.report_time}"
|
|
94
|
+
puts "Location: #{weather.location_name}, #{weather.country}"
|
|
95
|
+
puts "Coordinates: #{weather.coordinates}"
|
|
96
|
+
puts "Google Maps: #{weather.google_maps}"
|
|
97
|
+
puts "\nTemperature: #{weather.temp_avg}ºF / #{weather.temp_celsius}ºC"
|
|
98
|
+
puts "Condition: #{weather.condition.capitalize}"
|
|
99
|
+
puts "Cloudiness: #{weather.cloudiness}%"
|
|
100
|
+
puts "\nHumidity: #{weather.humidity}%"
|
|
101
|
+
puts "Wind Speed: #{weather.wind_speed} mph"
|
|
102
|
+
puts "Wind Direction: #{weather.wind_direction}"
|
|
103
|
+
puts "\nSunrise: #{weather.sunrise}"
|
|
104
|
+
puts "Sunset: #{weather.sunset}"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def display_previous
|
|
108
|
+
Weatherbot::API.locations.map { |entry| puts entry.location_name }
|
|
109
|
+
end
|
|
110
|
+
|
|
83
111
|
|
|
84
112
|
end
|
data/lib/version.rb
CHANGED
data/weatherbot.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: weatherbot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.4.
|
|
4
|
+
version: 0.1.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Janusz Szubert
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-10-
|
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -92,20 +92,6 @@ files:
|
|
|
92
92
|
- lib/version.rb
|
|
93
93
|
- lib/weatherbot.rb
|
|
94
94
|
- spec.md
|
|
95
|
-
- weatherbot-0.1.1.gem
|
|
96
|
-
- weatherbot-0.1.2.gem
|
|
97
|
-
- weatherbot-0.1.3.1.gem
|
|
98
|
-
- weatherbot-0.1.3.2.gem
|
|
99
|
-
- weatherbot-0.1.3.3.gem
|
|
100
|
-
- weatherbot-0.1.3.4.gem
|
|
101
|
-
- weatherbot-0.1.3.5.gem
|
|
102
|
-
- weatherbot-0.1.3.6.gem
|
|
103
|
-
- weatherbot-0.1.3.7.gem
|
|
104
|
-
- weatherbot-0.1.3.8.gem
|
|
105
|
-
- weatherbot-0.1.3.9.gem
|
|
106
|
-
- weatherbot-0.1.3.gem
|
|
107
|
-
- weatherbot-0.1.4.0.gem
|
|
108
|
-
- weatherbot-0.1.4.1.gem
|
|
109
95
|
- weatherbot.gemspec
|
|
110
96
|
homepage: https://github.com/TheInvalidNonce/weatherbot-cli-app
|
|
111
97
|
licenses:
|
data/weatherbot-0.1.1.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.2.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.1.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.2.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.3.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.4.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.5.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.6.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.7.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.8.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.9.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.3.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.4.0.gem
DELETED
|
Binary file
|
data/weatherbot-0.1.4.1.gem
DELETED
|
Binary file
|