-
Notifications
You must be signed in to change notification settings - Fork 0
/
deadsets.rb
59 lines (45 loc) · 1.3 KB
/
deadsets.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
require_relative 'bootstrap_ar'
database = ENV['FP_ENV'] || 'development'
connect_to database
def get_request
puts "WELCOME TO DEADSETS.\nPlease enter the date of a Grateful Dead concert using the MM-DD-YY format:"
puts "---------------------------------------------------------------------------"
show = gets.chomp
set = Setlist.new(show)
set.print_url
puts "---------------------------------------------------------------------------"
puts "-To access favorites, type f"
puts "-Type q to quit Deadsets"
puts "-Press enter to look up another concert"
puts "---------------------------------------------------------------------------"
user_input = gets.chomp
if user_input == "q"
quit_app
end
if user_input == "y"
add_fav(set.show_date)
end
if user_input == "f"
access_favs
end
get_request
end
def quit_app
exit_img = open("http://zachkeller.net/deadsets/syf.txt")
exit_img.each_line do |line|
puts line
end
exit
end
def add_fav(date)
Favorite.create(:date => date)
end
def access_favs
puts "---------------------------------------------------------------------------"
favorites = Favorite.all
favorites.each do |fav|
puts fav.date
end
puts "---------------------------------------------------------------------------"
end
get_request