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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69fae341d1fbd583b46521bd9ff29ef0c47d11aa
4
- data.tar.gz: ff9cc72f7c0eeabcad96ebde01df5eb851fe1c54
3
+ metadata.gz: 7e64af5dbf4410b31535862801806d990bae5ef2
4
+ data.tar.gz: b0d84dcca67ea33e7e31666d69ddfca6a53da1f0
5
5
  SHA512:
6
- metadata.gz: b98b9e3196dfe652ed72b7e90ec5080d060acebe45e623365f5f1da74427b780f02ab92adcdfc362a38b3d41bdfe66246a35992a365ff3cb95c713f5951f1a38
7
- data.tar.gz: a17fbbe326d00483f6846c0b5ac60f21fb658c5506c36db29de353325ea64c81659ab64446e699daff66315c327ba71362bfc6cf3ace53877b6cd956fe85b580
6
+ metadata.gz: 70b71ad28f7e392f9688fdcd27f02ff84cc8fa5af6c2282e91fee9a4c9d939eb64803066c45a30a61c3f898b7c4ba1aa7667b240604635c57aa07f3c6acfeb38
7
+ data.tar.gz: e3baf88c6eb63ead56844ac52d544eaf75147cae28ddf9ea9323ab0aef57f010a6b3bf652da0c88b75d2ad926bcee82cb200894fb203107c5c17c484a6047c28
@@ -3,6 +3,6 @@
3
3
  require "bundler/setup"
4
4
  # require "httparty"
5
5
  # require "pry"
6
- require "weatherbot"
6
+ require_relative "../lib/weatherbot"
7
7
 
8
8
  Weatherbot::CLI.new.call
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
- puts "\n\nReport Time: #{@current.report_time}"
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
@@ -1,3 +1,3 @@
1
1
  module Weatherbot
2
- VERSION = "0.1.4.2"
2
+ VERSION = "0.1.4.3"
3
3
  end
@@ -2,7 +2,7 @@
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'httparty'
5
- require 'weatherbot'
5
+ # require 'weatherbot'
6
6
  require "version"
7
7
 
8
8
  Gem::Specification.new do |spec|
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.2
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-13 00:00:00.000000000 Z
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:
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file