Class: CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
6
# File 'lib/makeup_maker/cli.rb', line 3

def call
  list_makers
  menu
end

#goodbyeObject



37
38
39
# File 'lib/makeup_maker/cli.rb', line 37

def goodbye
  puts "That's all the info I have! Hope it was helpful!"
end

#list_makersObject



8
9
10
11
12
13
14
# File 'lib/makeup_maker/cli.rb', line 8

def list_makers
  puts "Makeup Manufacturers: USA"
  @makers = Scraper.name
  @makers.each.with_index(1) do |makers, i|
    puts "#{i}. #{makers}"
  end
end


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/makeup_maker/cli.rb', line 17

def menu
  @the_makers = Scraper.scrape_info
  input = nil
  while input != "exit"
    puts "Enter the number of the manufacturer you would like more info on or type exit to leave: "
    input = gets.strip.downcase
    if input.to_i > 0
      makers = @the_makers[input.to_i - 1]
      puts "Stock Name:" + " #{makers.stock_name}"
      puts "Stock Price:"+ " $#{makers.stock_price}"
      puts "Location:" + " #{makers.location}"
      puts "URL:" + " #{makers.url}"
      puts "Corporate Info:" + " #{makers.corp_info}"
    elsif input != "exit"
      puts "Invalid entry. Please enter a number or exit."
    end
  end
  goodbye
end