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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccd6af8353bc118f82009b9b6446e05b394a8fa4d325e1e6571e708e5fc37d21
4
- data.tar.gz: f09ab6b42946663954a8ba263f21f9896b54e6637d76c3ab8321ad1b77ef2c2c
3
+ metadata.gz: c25c2164b452ebc6fb6efd5032c1ab7c3fc180314f38b1939ca4c6e2ceaa01cd
4
+ data.tar.gz: f71dcf59ce796cbb2221f6972f4a6806c43094c247077fa65ee53b6a05bff983
5
5
  SHA512:
6
- metadata.gz: d36915fd5bf9fad9c8181012118c1756bf8e7bd3439c6ad44cb182493e551b6cf642372c513a8040ecf34f034c053622b90da1f6917012b4c768b0702f6fff06
7
- data.tar.gz: 9fdf05d6048dd080dbbbdc078ddd17cb524fce80c795c25861357df8ca24fb51ec81be2ea9e9184d7c66fd8019b3754b473590b4d70e70c34e34db23451cf06c
6
+ metadata.gz: e32c52412687676d664774fd9b2bc3b997bc9f2219a3ae8727336ed7ab4b20f846d5ad7c4b0fb7581fdfc508c0bf64e70fb3b081d23e325a5aba37e20d8ad8a8
7
+ data.tar.gz: 34428a4e5000f97b7413fde44a10ab47d7f7b664fcdfd5d3887a736ca0a4f3b6605569d31beea1e7ab98a015bcf2aa292575dc1933f45f9c318912fe52ee3dec
@@ -3,4 +3,4 @@
3
3
  require "bundler/setup"
4
4
  require "travel_leisure"
5
5
 
6
- TravelLeisure::CLI.new.call
6
+ TravelLeisure::CLI.new.start
@@ -1,67 +1,58 @@
1
1
  # code handling CLI display logic and user input
2
- class TravelLeisure::CLI #:: name space
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 menu
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
- puts "To view the destinations that we have travel guides for, enter 'travel'.".yellow.bold
21
- puts "or enter 'q' to exit".yellow.bold
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
- if input == 'travel'
26
- puts ""
27
- puts "Here is a list of destinations that we have travel guides for:".yellow.bold
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 "I don't understand that answer, please try again:".red.bold
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
- puts "\nPlease enter the number of the travel guide you would like to access\nor enter 'q' to exit:".yellow.bold
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
- if input == 'q'
44
- exit
45
- elsif
46
- destination = TravelLeisure::Destination.find(input.to_i)
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
- puts "I don't understand that answer.".red.bold
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
- if input == "y"
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
- elsif input == "n"
88
- menu
89
- elsif input == "q"
90
- exit
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 don't understand that answer."
94
- menu
84
+ puts "Sorry, I didn't understand that input.".red.bold
85
+ alt_menu
95
86
  end
96
87
  end
97
88
 
98
- def list_destinations
99
- TravelLeisure::Destination.all.each.with_index(1) do |destination, index|
100
- puts "#{index}. #{destination.city}, #{destination.country}"
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
@@ -1,3 +1,3 @@
1
1
  module TravelLeisure
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -28,4 +28,4 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "pry", "~> 0.10.4"
29
29
  spec.add_dependency "nokogiri", "~> 1.8"
30
30
  spec.add_dependency "colorize", "~> 0.8.1"
31
- end
31
+ end
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.3
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-29 00:00:00.000000000 Z
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:
Binary file
Binary file