pawesome_parks 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pawesome_parks/cli.rb +44 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7924c477cfe603d280ab9e5574970722a86b6f4939a583e89b01f87f42ac11f3
|
4
|
+
data.tar.gz: d0809c04ba4d6366c46a8b3d2f242d47b4873d08fd5cb1587aa3f5c5e614e340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75afc9f5c3896578392ef6002b833a61360297d8a535551608f22f5d0813e0af06dc2143245e9ed83eb78cfaa0fd3dd2f4380097d14c3131e7aec44093c7dc35
|
7
|
+
data.tar.gz: 9dca55f0f6e5c3d5eed1f33043ad73f27986b0fadf7782f4fbf6e81ae487e5183a502b0366561566f8411cf31b75305e06565bd2d22bedf93586e36b7fc1bf41
|
data/lib/pawesome_parks/cli.rb
CHANGED
@@ -8,7 +8,7 @@ class PawesomeParks::CLI
|
|
8
8
|
██╔═══╝ ██╔══██║██║███╗██║██╔══╝ ╚════██║██║ ██║██║╚██╔╝██║██╔══╝ ██╔═══╝ ██╔══██║██╔══██╗██╔═██╗ ╚════██║
|
9
9
|
██║ ██║ ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗ ██║ ██║ ██║██║ ██║██║ ██╗███████║
|
10
10
|
╚═╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
|
11
|
-
\n".
|
11
|
+
\n".green
|
12
12
|
puts "\nWelcome to Pawesome Parks!\n\n"
|
13
13
|
puts "There are currently 51 dog-friendly parks within the City of Sydney council region in NSW, Australia. With a range of off-leash hours and other restrictions, this app will let you explore the most suitable park to take your furry friend!"
|
14
14
|
retrieve_dog_parks
|
@@ -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,10 +39,12 @@ 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
|
-
puts "\nSorry, that is an invalid selection, please enter another option:".
|
47
|
+
puts "\nSorry, that is an invalid selection, please enter another option:".green
|
47
48
|
end
|
48
49
|
end
|
49
50
|
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
|
56
|
-
puts "
|
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:".
|
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
|
-
|
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:".
|
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
|
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:".
|
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:".
|
93
|
-
elsif location == "
|
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:".
|
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
|
@@ -107,7 +114,7 @@ class PawesomeParks::CLI
|
|
107
114
|
puts "\nDog parks at postcode #{location} include:\n\n"
|
108
115
|
parks.each { |park| print_park park }
|
109
116
|
else
|
110
|
-
puts "\nUnable to locate a dog park at that postcode. Postcodes with a dog park include:\n".
|
117
|
+
puts "\nUnable to locate a dog park at that postcode. Postcodes with a dog park include:\n".green
|
111
118
|
puts PawesomeParks::Park.postcodes.each { |postcode| postcode }
|
112
119
|
puts ""
|
113
120
|
end
|
@@ -119,7 +126,7 @@ class PawesomeParks::CLI
|
|
119
126
|
puts "\nDog parks in #{location.capitalize} include:\n\n"
|
120
127
|
parks.each { |park| print_park park }
|
121
128
|
else
|
122
|
-
puts "\nUnable to locate a dog park at that suburb name. Suburbs with a dog park include:\n".
|
129
|
+
puts "\nUnable to locate a dog park at that suburb name. Suburbs with a dog park include:\n".green
|
123
130
|
PawesomeParks::Park.suburbs.each { |suburb| puts suburb.capitalize }
|
124
131
|
puts ""
|
125
132
|
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
|
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.
|
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-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|