pawesome_parks 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pawesome_parks/cli.rb +40 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cfceaabccc8843c8ced3145ec6632910c9f8c3bd1232c66052b1d3233e9422a
4
- data.tar.gz: 74aec0740139ceae5ab605b1650ecdb8b872778896ed0c7294715e90d4119649
3
+ metadata.gz: 7924c477cfe603d280ab9e5574970722a86b6f4939a583e89b01f87f42ac11f3
4
+ data.tar.gz: d0809c04ba4d6366c46a8b3d2f242d47b4873d08fd5cb1587aa3f5c5e614e340
5
5
  SHA512:
6
- metadata.gz: 45de3ab79ae991f45fad642be9dafa0bd664b5e0f1dad13c96e595ab09a6080fecc3e799f48c3d517087a9957531d2dc610152f9099f85459e884887f6780ad0
7
- data.tar.gz: 67b3af7ae1d404b49ff859e012bc7f146ae242c1a1951ee1d6d87e954d654e9c8c8bc4c8d1a1ab5c9b2c6f5438abee414dce77ca3e3d0b6d707e1f0c3411c345
6
+ metadata.gz: 75afc9f5c3896578392ef6002b833a61360297d8a535551608f22f5d0813e0af06dc2143245e9ed83eb78cfaa0fd3dd2f4380097d14c3131e7aec44093c7dc35
7
+ data.tar.gz: 9dca55f0f6e5c3d5eed1f33043ad73f27986b0fadf7782f4fbf6e81ae487e5183a502b0366561566f8411cf31b75305e06565bd2d22bedf93586e36b7fc1bf41
@@ -31,7 +31,6 @@ class PawesomeParks::CLI
31
31
  end
32
32
 
33
33
  def menu_selection
34
-
35
34
  loop do
36
35
  choice = display_options
37
36
  if choice == "1"
@@ -40,8 +39,10 @@ class PawesomeParks::CLI
40
39
  search_for_park
41
40
  elsif choice == "3"
42
41
  off_leash_hours
43
- elsif choice.downcase == "exit"
42
+ elsif choice.downcase == "/exit"
44
43
  exit_app
44
+ elsif choice.downcase == "/help"
45
+ help
45
46
  else
46
47
  puts "\nSorry, that is an invalid selection, please enter another option:".green
47
48
  end
@@ -52,51 +53,57 @@ class PawesomeParks::CLI
52
53
  puts "\nMenu:"
53
54
  puts "1 - List all dog parks"
54
55
  puts "2 - Search for dog parks by suburb or postcode"
55
- puts "3 - View parks with unrestricted off-leash hours\n"
56
- puts "\nPlease select an option from the menu above by entering '1', '2', or '3' below. You can also enter 'exit' to leave the application and 'menu' to bring up this menu at any time:".green
56
+ puts "3 - View parks with unrestricted off-leash hours"
57
+ puts "/help - Provides a list of available commands\n"
58
+ puts "\nPlease select an option from the menu above by entering '1', '2', or '3' below. You can also enter '/exit' to leave the application or '/menu' to return to this menu at any time:".green
57
59
  gets.strip.downcase
58
60
  end
59
61
 
60
62
  def list_dog_parks
61
63
  puts "\nAll Dog Parks:\n"
62
64
  PawesomeParks::Park.park_names.each { |park| puts park }
63
- puts "\nEnter one of the above park names to see more details, or enter 'menu' to return to the main menu:".green
65
+ puts "\nEnter one of the above park names to see more details, or enter '/menu' to return to the main menu:".green
64
66
  get_park_details_by_name
65
67
  end
66
68
 
67
69
  def get_park_details_by_name
68
70
  loop do
69
71
  choice = gets.strip.downcase
70
- names = PawesomeParks::Park.park_names.map { |name| name.downcase }
71
- if names.include? choice
72
+ if PawesomeParks::Park.park_names.find { |name| name.downcase == choice }
72
73
  puts ""
73
74
  chosen_park_instance = PawesomeParks::Park.find_by_name choice
74
75
  print_park chosen_park_instance
75
- puts "\nPlease enter another park name for more details or enter 'menu' to return to the main menu:".green
76
- elsif choice == "exit"
76
+ puts "\nPlease enter another park name for more details or enter '/menu' to return to the main menu:".green
77
+ elsif choice == "/exit"
77
78
  exit_app
78
- elsif choice == "menu"
79
+ elsif choice == "/menu"
79
80
  menu_selection
81
+ elsif choice == "/help"
82
+ help
80
83
  else
81
- puts "\nInvalid park name. Please enter a park name included in the list above:".green
84
+ puts "\nInvalid park name. Please enter a park name included in the list above or enter '/menu to return to the main menu".green
82
85
  end
83
86
  end
84
87
  end
85
88
 
86
89
  def search_for_park
87
- puts "\nPlease enter a suburb name or postcode within the City of Sydney:".green
90
+ puts "\nPlease enter a suburb name or postcode within the City of Sydney. Enter '/print' to see a list of possible suburbs and postcodes to choose from:".green
88
91
  loop do
89
92
  location = gets.strip.downcase
90
93
  if location.to_i != 0
91
94
  search_by_postcode location
92
- puts "\nPlease enter another postcode or suburb name for park details, enter 'menu' to return to the main menu:".green
93
- elsif location == "exit"
95
+ puts "\nPlease enter another postcode or suburb name for park details, enter '/menu' to return to the main menu:".green
96
+ elsif location == "/print"
97
+ print_locations
98
+ elsif location == "/exit"
94
99
  exit_app
95
- elsif location == "menu"
100
+ elsif location == "/menu"
96
101
  menu_selection
102
+ elsif location == "/help"
103
+ help
97
104
  else
98
105
  search_by_suburb location
99
- puts "\nPlease enter another suburb name or postcode for park details, enter 'menu' to return to the main menu:".green
106
+ puts "\nPlease enter another suburb name or postcode for park details, enter '/menu' to return to the main menu:".green
100
107
  end
101
108
  end
102
109
  end
@@ -129,10 +136,26 @@ class PawesomeParks::CLI
129
136
  puts "\nParks with unrestricted off-leash hours include:\n\n"
130
137
  parks = PawesomeParks::Park.unrestricted_off_leash_hours
131
138
  parks.each { |park| puts park.name }
132
- puts "\nEnter one of the above parks name's to see more details, or enter 'menu' to return to the main menu:".green
139
+ puts "\nEnter one of the above parks name's to see more details or enter '/menu' to return to the main menu:".green
133
140
  get_park_details_by_name
134
141
  end
135
142
 
143
+ def help
144
+ puts "\nAvailable Commands:"
145
+ puts "/menu - Return to the main menu (use at any time)".yellow
146
+ puts "/help - Brings up this list of available commands (use at any time)".yellow
147
+ puts "/print - Use when prompted to list information".yellow
148
+ puts "/exit - Terminates the program (use at any time)".yellow
149
+ menu_selection
150
+ end
151
+
152
+ def print_locations
153
+ puts "\nSuburbs with dog parks include:"
154
+ PawesomeParks::Park.suburbs.each { |suburb| puts suburb.capitalize }
155
+ puts "\nPostcodes with dog parks include:"
156
+ PawesomeParks::Park.postcodes.each { |postcode| puts postcode }
157
+ search_for_park
158
+ end
136
159
 
137
160
  def print_park park
138
161
  puts "#{park.name}:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pawesome_parks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauren Giordano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-07 00:00:00.000000000 Z
11
+ date: 2023-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize