Class: Travel::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/travel/cli.rb

Instance Method Summary collapse

Instance Method Details

#all_inclusive_resortsObject



72
73
74
75
76
77
# File 'lib/travel/cli.rb', line 72

def all_inclusive_resorts
  Travel::Scraper.scrape_all_inclusive_resorts.each.with_index(1) do |winner, index|
    puts "#{index}: #{winner.name} - #{winner.location}"
  end
  return nil
end

#attractionsObject



79
80
81
82
83
84
# File 'lib/travel/cli.rb', line 79

def attractions
  Travel::Scraper.scrape_attractions.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name} - #{winner.location}"
  end
  return nil
end

#beachesObject



86
87
88
89
90
91
# File 'lib/travel/cli.rb', line 86

def beaches
  Travel::Scraper.scrape_beaches.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name} - #{winner.location}, #{winner.best_time}"
  end
  return nil
end

#callObject



3
4
5
6
7
8
# File 'lib/travel/cli.rb', line 3

def call 
  puts "Welcome to World Travelers'Awards for #{Time.now.year}"
   list_awards
   menu

end

#destinationsObject



93
94
95
96
97
98
# File 'lib/travel/cli.rb', line 93

def destinations
   Travel::Scraper.scrape_destinations.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name}"
   end
   return nil
end

#destinations_on_the_riseObject



100
101
102
103
104
105
# File 'lib/travel/cli.rb', line 100

def destinations_on_the_rise
   Travel::Scraper.scrape_destinations_on_the_rise.each.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name}"
   end
   return nil
end

#goodbyeObject



67
68
69
70
# File 'lib/travel/cli.rb', line 67

def goodbye
  puts "Thank you for visiting Travelers Choice Awards. Have a nice day!"
  exit
end

#hotelsObject



107
108
109
110
111
112
# File 'lib/travel/cli.rb', line 107

def hotels
  Travel::Scraper.scrape_hotels.each.with_index(1) do |winner, index|
    puts "#{index}: #{winner.name} - #{winner.location}"
  end
  return nil
end

#islandsObject



115
116
117
118
119
120
# File 'lib/travel/cli.rb', line 115

def islands
   Travel::Scraper.scrape_islands.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name}"
   end
   return nil
end

#landmarksObject



122
123
124
125
126
127
# File 'lib/travel/cli.rb', line 122

def landmarks
   Travel::Scraper.scrape_landmarks.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name}- #{winner.location}"
   end
   return nil
end

#list_awardsObject



10
11
12
13
# File 'lib/travel/cli.rb', line 10

def list_awards
  puts "Please select a category or type exit."
  @lists = Travel::List.choices_awards
end


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/travel/cli.rb', line 16

def menu
  input = nil
  
  while input != "exit"
    puts "Enter the number of the Award you wish to see, list to see the main menu or type exit."
    input = gets.strip.downcase
    case input
    
    when "1"
      puts "All Inclusive Resorts"
      all_inclusive_resorts
    when "2"
      puts"Attractions"
      attractions
    when "3"
      puts"Beaches"
      beaches
    when "4"
      puts"Destinations"
      destinations
    when "5"
      puts"Destinations on the Rise"
      destinations_on_the_rise
    when "6"
      puts"Hotels"
      hotels
    when "7"
      puts"Islands"
      islands
    when "8"
      puts"Landmarks"
      landmarks
    when "9"
      puts"Museums"
      museums
    when "10"
      puts"Restaurants"
      restaurants
    when "list"
      list_awards
    when "exit"
      goodbye
    else
      puts "Wrong Number!!!"
    end
  end

end

#museumsObject



129
130
131
132
133
134
# File 'lib/travel/cli.rb', line 129

def museums
   Travel::Scraper.scrape_museums.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name}- #{winner.location}"
   end
   return nil
end

#restaurantsObject



136
137
138
139
140
141
# File 'lib/travel/cli.rb', line 136

def restaurants
   Travel::Scraper.scrape_restaurants.each.with_index(1) do |winner, index|
     puts "#{index}: #{winner.name}- #{winner.location} - #{winner.cuisine}"
   end
   return nil
end