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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/command_line_interface.rb', line 15
def
input = ""
puts " "
puts "Welcome to the unofficial NYC Parks GreenThumb app".cyan.invert
puts "What are you interested in learning about today?".cyan.invert
puts " "
while input != "9"
puts "~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~"
puts " "
puts "[enter a number]".blue
puts "#{"[1]".cyan} #{"How many".cyan} gardens are there?"
puts "#{"[2]".cyan} Show me a (long) list of #{"all gardens".cyan} in the city, please."
puts "#{"[3]".cyan} Show me a list of the gardens #{"in my borough".cyan}."
puts "#{"[4]".cyan} Show me a list of the gardens #{"in my ZIP code".cyan}."
puts "#{"[5]".cyan} I'd like to see #{"a random garden".cyan}. Now."
puts "#{"[6]".cyan} I know my garden's name or ID number, can I #{"search for it".cyan}?"
puts "#{"[9]".cyan} Please, let me #{"exit".cyan}."
puts " "
input = gets.strip
case input
when "1"
puts " "
puts "Great question! How would you like me to pull the report?"
puts " "
puts "#{"[1]".cyan} in all of New York City"
puts "#{"[2]".cyan} in my borough"
puts "#{"[3]".cyan} in my ZIP"
input = gets.strip
case input
when "1"
citywide_garden_count_report
when "2"
puts " "
puts "Ok! Which borough are you in?"
puts "#{"[X]".cyan} Bronx"
puts "#{"[Q]".cyan} Queens"
puts "#{"[M]".cyan} Manhattan"
puts "#{"[B]".cyan} Brooklyn"
puts "#{"[R]".cyan} Staten Island"
input = gets.strip
until Garden.all.detect {|g| input == g.borough}
puts "That's not a borough. Please try again (maybe without brackets and capitalized?)."
input = gets.strip
end
puts "There are #{"#{Garden.filter_by_borough(input).count}".magenta} in #{"#{Garden.translate_borough(input)}".yellow}."
puts "The most vegetative ZIP codes in your borough are:"
puts " "
Garden.print_top_zipcodes(input)
puts " "
puts "~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~"
when "3"
puts " "
puts "Ok! What is your ZIP code?"
input = gets.strip
until Garden.all.detect {|g| input == g.zipcode}
puts "I'm not finding that ZIP code in my system. Please try again. (stuck in a loop? 10031 has some good gardens)."
input = gets.strip
end
puts "There are #{"#{Garden.filter_by_zip(input).count}".magenta} GreenThumb Gardens in #{"#{input}".yellow}."
puts ""
puts "~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~"
zip_one_liner(input)
end
when "2"
all_gardens_detail
puts "this is a long report! scroll up to see all of the gardens in New York City #{":)".yellow}"
puts ""
when "3"
puts " "
puts "Ok! Which borough are you in?"
puts "#{"[X]".cyan} Bronx"
puts "#{"[Q]".cyan} Queens"
puts "#{"[M]".cyan} Manhattan"
puts "#{"[B]".cyan} Brooklyn"
puts "#{"[R]".cyan} Staten Island"
input = gets.strip
until Garden.all.detect {|g| input == g.borough}
puts "That's not a borough. Please try again (maybe without brackets and capitalized?)."
input = gets.strip
end
puts "~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~"
puts " "
puts "Here is a list of garden names in your borough."
borough_one_liner(input)
puts "#{"this is a long report!".yellow} scroll up to see all of the gardens in #{Garden.translate_borough(input)} #{":)".yellow}"
puts ""
puts ""
puts ""
puts "#{"Type in the #{"garden ID".magenta} to learn more about a specific location:".cyan}"
puts ""
input = gets.strip
drill_down = find_by_parksid(input)
index_card(drill_down)
when "4"
puts " "
puts "Ok! What is your ZIP code?"
input = gets.strip
until Garden.all.detect {|g| input == g.zipcode}
puts "I'm not finding that ZIP code in my system. Please try again. (stuck in a loop? 10031 has some good gardens)."
input = gets.strip
end
puts "~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~"
puts ""
puts "Here's a list of garden names in your borough."
zip_one_liner(input)
puts "#{"Type in the #{"garden ID".magenta} to learn more about a specific location:".cyan}"
input = gets.strip
drill_down = find_by_parksid(input)
index_card(drill_down)
when "5"
random_garden
when "6"
puts "Type in the garden name or ID to pull up more info:"
input = gets.strip
search_function(input)
end
end
end
|