Class: Landmarks::CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/landmarks/cli.rb', line 3

def call
  puts ""
  puts "WELCOME TO TOP 20 ST. PETERSBURG ARCHITECTURAL LANDMARKS!"
  scraper = Landmarks::Landmark.scraper
  scraper.print_the_title
  scraper.scrape_landmarks_index
  puts ""
  scraper.print_landmarks_index
  puts ""
  start
end

#startObject



15
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
64
65
66
67
68
69
# File 'lib/landmarks/cli.rb', line 15

def start
  puts "Please enter the number of the landmark you would like more information on:"
  input = gets.chomp.to_i
  if !input.between?(1, 20)
    puts "Please enter a number from 1 to 20!"
    start
  end
  landmark = Landmarks::Landmark.find(input)
  puts "\t\n"
  puts landmark.name.strip.upcase
  puts "\t\n"
  puts "\t\t\t\t\t\t================== Description of the Landmark =================="
  puts "\t\n"
  puts landmark.description
  puts "\t\n"
  puts "\t\t\t\t\t\t================================================================="
  puts "\t\n"
  puts "Would you like to check the availability of directions, contact information and business hours? y/n"
  answer = gets.chomp.downcase

  if answer == "y"
    puts "\t\n"
    puts "\t\t\t\t\t\t====== Directions, contact information and business hours ======"
    puts "\t\n"
    puts landmark.directions
    puts "\t\n"
    puts "\t\t\t\t\t\t================================================================="
    puts "\t\n"
    puts "Would you like to find out more about another landmark? y/n"
    response = gets.chomp.downcase

    if response == "y"
      start
    else
      puts "\t\n"
      puts "Thank you for your interest! Have a great day, and welcome again in the future!"
      puts "\t\n"
      puts "\t\t\t**************************"
      puts "\t\n"
    end

  else
    puts "\t\n"
    puts "Would you like to find out more about another landmark? y/n"
    response = gets.chomp.downcase
    if response == "y"
      start
    else
      puts "Thank you for your interest! Have a great day, and welcome again in the future!"
      puts "\t\n"
      puts "\t\t\t**************************"
      puts "\t\n"
    end
  end
end