Class: SlickdealsCli::CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject



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

def call
	build_popular
	woot_deals
	welcome		
	user_choice
	goodbye
end

#goodbyeObject



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

def goodbye
	puts "Come back tomorrow for more deals! Have a nice day!"
end

#user_choiceObject



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

def user_choice
	input = nil
	while input != "exit"
		puts "Type 1 for today's Popular Deals or 2 for the Deal of the day from Woot or exit:"
		input = gets.strip.downcase
		if input.to_i == 1
			popular_deals_list
		elsif input.to_i == 2
			woot_deal = @deals[input.to_i-1]
			puts "Here is the Daily Deal from Woot!"
			puts "#{woot_deal.name}:".colorize(:light_blue) + " #{woot_deal.price}.".colorize(:green)
			puts "You can find this deal at #{woot_deal.url}".colorize(:blue)
		else
			puts "Hmm, I'm not familiar with that input"
		end
	end
end

#welcomeObject



11
12
13
14
15
16
# File 'lib/slickdeals_cli/cli.rb', line 11

def welcome
	puts "***************************************"
	puts "Welcome to your Slickdeals of the day!!"
	puts "***************************************"
	puts "What type of deals would you like to see?"	
end