travel_leisure 0.1.3 → 0.1.4
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/travel_leisure +1 -1
- data/lib/travel_leisure/cli.rb +66 -64
- data/lib/travel_leisure/version.rb +1 -1
- data/travel_leisure.gemspec +1 -1
- metadata +2 -4
- data/travel_leisure-0.1.0.gem +0 -0
- data/travel_leisure-0.1.1.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c25c2164b452ebc6fb6efd5032c1ab7c3fc180314f38b1939ca4c6e2ceaa01cd
|
|
4
|
+
data.tar.gz: f71dcf59ce796cbb2221f6972f4a6806c43094c247077fa65ee53b6a05bff983
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e32c52412687676d664774fd9b2bc3b997bc9f2219a3ae8727336ed7ab4b20f846d5ad7c4b0fb7581fdfc508c0bf64e70fb3b081d23e325a5aba37e20d8ad8a8
|
|
7
|
+
data.tar.gz: 34428a4e5000f97b7413fde44a10ab47d7f7b664fcdfd5d3887a736ca0a4f3b6605569d31beea1e7ab98a015bcf2aa292575dc1933f45f9c318912fe52ee3dec
|
data/bin/travel_leisure
CHANGED
data/lib/travel_leisure/cli.rb
CHANGED
|
@@ -1,67 +1,58 @@
|
|
|
1
1
|
# code handling CLI display logic and user input
|
|
2
|
-
class TravelLeisure::CLI
|
|
3
|
-
def call
|
|
4
|
-
TravelLeisure::Scraper.new.make_destinations
|
|
5
|
-
puts ""
|
|
6
|
-
puts ""
|
|
7
|
-
puts " ------------------------------------------------ ".blue
|
|
8
|
-
puts "| |".blue
|
|
9
|
-
puts "| Welcome to Command Line Travel Guides |".blue.bold
|
|
10
|
-
puts "| |".blue
|
|
11
|
-
puts " ------------------------------------------------ ".blue
|
|
12
|
-
puts ""
|
|
13
|
-
puts ""
|
|
2
|
+
class TravelLeisure::CLI
|
|
14
3
|
|
|
4
|
+
def start
|
|
5
|
+
greeting
|
|
6
|
+
TravelLeisure::Scraper.new.make_destinations
|
|
15
7
|
menu
|
|
16
8
|
end
|
|
17
9
|
|
|
18
|
-
def
|
|
10
|
+
def greeting
|
|
11
|
+
puts "\nWelcome to Command Line Travel Guides!".blue.bold
|
|
12
|
+
puts "Would you like to see our list of destinations?".yellow
|
|
13
|
+
puts "If so, please type 'Yes' or 'Y'!".yellow
|
|
14
|
+
end
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
def good_bye
|
|
17
|
+
puts "Thank you for checking out Command Line Travel Guides!".yellow.bold
|
|
18
|
+
exit!
|
|
19
|
+
end
|
|
22
20
|
|
|
21
|
+
def menu
|
|
23
22
|
input = gets.strip.downcase
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
puts ""
|
|
29
|
-
|
|
30
|
-
list_destinations
|
|
31
|
-
|
|
32
|
-
elsif input == "q"
|
|
33
|
-
exit
|
|
23
|
+
if input == "yes" || input == "y"
|
|
24
|
+
menu_helper
|
|
25
|
+
elsif input == "exit" || input == "e"
|
|
26
|
+
good_bye
|
|
34
27
|
else
|
|
35
|
-
puts ""
|
|
36
|
-
puts "
|
|
37
|
-
puts ""
|
|
38
|
-
menu
|
|
28
|
+
puts "Sorry! I didn't understand that input, please try again".red.bold
|
|
29
|
+
puts "Would you like to see our list?".yellow
|
|
30
|
+
puts "If so, please type 'Yes' or 'Y' or exit.".yellow
|
|
31
|
+
menu
|
|
39
32
|
end
|
|
33
|
+
end
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
def menu_helper
|
|
36
|
+
list_destinations
|
|
37
|
+
select_destination
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def list_destinations
|
|
41
|
+
TravelLeisure::Destination.all.each.with_index(1) do |destination, index|
|
|
42
|
+
puts "#{index}. #{destination.city}, #{destination.country}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def select_destination
|
|
46
|
+
puts "\nPlease enter the number of the travel guide you would like to access:".yellow.bold
|
|
42
47
|
input = gets.strip
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
destination = TravelLeisure::Destination.find(input.to_i)
|
|
49
|
+
if input == "exit" || input == "e"
|
|
50
|
+
good_bye
|
|
51
|
+
elsif input.to_i.between?(1,TravelLeisure::Destination.all.length)
|
|
47
52
|
print_destination(destination)
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
puts ""
|
|
52
|
-
puts "Would you like to see another travel guide? Enter Y or N".yellow.bold
|
|
53
|
-
|
|
54
|
-
input = gets.strip.downcase
|
|
55
|
-
if input == "y"
|
|
56
|
-
menu
|
|
57
|
-
elsif input == "n"
|
|
58
|
-
puts ""
|
|
59
|
-
puts "Thank you! Have a great day!".yellow.bold
|
|
60
|
-
exit
|
|
61
53
|
else
|
|
62
|
-
puts ""
|
|
63
|
-
|
|
64
|
-
menu
|
|
54
|
+
puts "Sorry! I didn't understand that input, please try again".red.bold
|
|
55
|
+
select_destination
|
|
65
56
|
end
|
|
66
57
|
end
|
|
67
58
|
|
|
@@ -75,29 +66,40 @@ class TravelLeisure::CLI #:: name space
|
|
|
75
66
|
puts "\nKnow Before Visiting: #{destination.know_before_visiting}".green.bold
|
|
76
67
|
puts "\nLanguage: #{destination.language}".green.bold
|
|
77
68
|
puts "\nCurrency: #{destination.currency}".green.bold
|
|
78
|
-
puts ""
|
|
79
|
-
puts "Would you like to read more on #{destination.city}? Enter Y or N".yellow.bold
|
|
80
|
-
|
|
69
|
+
puts "\nWould you like to read more on #{destination.city}? Please enter 'Y' or 'N'".yellow.bold
|
|
81
70
|
input = gets.strip.downcase
|
|
82
|
-
|
|
71
|
+
case input
|
|
72
|
+
when 'y' || 'yes'
|
|
83
73
|
puts ""
|
|
84
|
-
puts "More info:"
|
|
74
|
+
puts "More info:".yellow
|
|
85
75
|
puts ""
|
|
86
76
|
puts destination.description
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
77
|
+
alt_menu
|
|
78
|
+
when 'n' || 'no'
|
|
79
|
+
alt_menu
|
|
80
|
+
when 'exit'
|
|
81
|
+
good_bye
|
|
91
82
|
else
|
|
92
83
|
puts ""
|
|
93
|
-
puts "I
|
|
94
|
-
|
|
84
|
+
puts "Sorry, I didn't understand that input.".red.bold
|
|
85
|
+
alt_menu
|
|
95
86
|
end
|
|
96
87
|
end
|
|
97
88
|
|
|
98
|
-
def
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
def alt_menu
|
|
90
|
+
puts "\nWould you like to see another travel guide? Type 'Yes' or 'Y' ".yellow.bold
|
|
91
|
+
puts "\nWould you like to exit? Type 'E' or 'Exit' ".yellow.bold
|
|
92
|
+
input = gets.strip.downcase
|
|
93
|
+
if input == 'yes' || input == 'y'
|
|
94
|
+
menu_helper
|
|
95
|
+
elsif input == 'exit' || input == 'e'
|
|
96
|
+
good_bye
|
|
97
|
+
else
|
|
98
|
+
puts "Sorry, I didn't understand that input.".red.bold
|
|
99
|
+
alt_menu
|
|
101
100
|
end
|
|
102
101
|
end
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
end
|
|
103
105
|
end
|
data/travel_leisure.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: travel_leisure
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- corbinarnett
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-08
|
|
11
|
+
date: 2019-09-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -120,8 +120,6 @@ files:
|
|
|
120
120
|
- lib/travel_leisure/scraper.rb
|
|
121
121
|
- lib/travel_leisure/version.rb
|
|
122
122
|
- notes.md
|
|
123
|
-
- travel_leisure-0.1.0.gem
|
|
124
|
-
- travel_leisure-0.1.1.gem
|
|
125
123
|
- travel_leisure.gemspec
|
|
126
124
|
homepage: https://github.com/corbinarnett/travel-leisure-cli
|
|
127
125
|
licenses:
|
data/travel_leisure-0.1.0.gem
DELETED
|
Binary file
|
data/travel_leisure-0.1.1.gem
DELETED
|
Binary file
|