Knox_Restaurants 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +1 -1
- data/Knox_Restaurants-0.1.0.gem +0 -0
- data/Knox_Restaurants-0.2.0.gem +0 -0
- data/Knox_Restaurants-0.3.0.gem +0 -0
- data/README.md +1 -1
- data/lib/Knox_Restaurants/api.rb +1 -1
- data/lib/Knox_Restaurants/cli.rb +61 -21
- data/lib/Knox_Restaurants/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17898c7e15ca36dbbd5fa2935857ecda7b0ce59f97abd9eb27518a1826a77853
|
4
|
+
data.tar.gz: b8cfa7381d74905a01b3ef86e7f14013be7a2e15ed99ed1c8d72614ce81f51a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69899bb34a84472180fdec6faa83a52eca9945ddbe2fd69ee636552dd75cd4b4beccc6be43b03bc24a2721d6c5ecfd30f09c153a5a87cb1c30d4c084d54b183a
|
7
|
+
data.tar.gz: 9a5b0ff55fe9d29abdebc919326aa66ef77e957302fae6bbf1c102d3563f5b88f4b7f0358b8cfc384deea94c56ce9fb3cd0c5f727541615423b7aa9394e8d736
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
To start the program, run 'bin/
|
23
|
+
To start the program, run 'bin/Knox_Restaurants' in terminal. There will be a numbered list of cuisines to choose from. There will be a prompt to enter in a number. It will return a list of restaurants corresponding to the user's input. From here, enter a valid number to get more information for that restaurant. Enter "end" to exit the program.
|
24
24
|
|
25
25
|
## Development
|
26
26
|
|
data/lib/Knox_Restaurants/api.rb
CHANGED
@@ -3,7 +3,7 @@ class KnoxRestaurants::API
|
|
3
3
|
attr_accessor :cuisine
|
4
4
|
|
5
5
|
def self.fetch
|
6
|
-
key = ENV["
|
6
|
+
key = ENV["KEY"]
|
7
7
|
url = "https://api.yelp.com/v3/businesses/search?term=restaurant&location=knoxville&limit=50"
|
8
8
|
response = HTTParty.get(url, headers: {'Authorization' => "Bearer #{key}"})
|
9
9
|
response.parsed_response
|
data/lib/Knox_Restaurants/cli.rb
CHANGED
@@ -2,9 +2,13 @@ class KnoxRestaurants::CLI
|
|
2
2
|
#outputs to user
|
3
3
|
|
4
4
|
def call
|
5
|
-
puts "Welcome to Knoxville!"
|
6
5
|
KnoxRestaurants::API.fetch #fetches from API
|
7
|
-
|
6
|
+
puts <<-REST
|
7
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
8
|
+
| Welcome to Knoxville! |
|
9
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
10
|
+
REST
|
11
|
+
start
|
8
12
|
end
|
9
13
|
|
10
14
|
def start
|
@@ -16,20 +20,43 @@ class KnoxRestaurants::CLI
|
|
16
20
|
|
17
21
|
def display_cuisine_choices
|
18
22
|
@cuisine = KnoxRestaurants::Restaurant.get_cuisines.each.with_index(1) do |cuisine, idx|
|
19
|
-
puts
|
23
|
+
puts <<-REST
|
24
|
+
#{idx}. #{cuisine}
|
25
|
+
REST
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
23
29
|
def input_cuisine_choice
|
24
|
-
puts
|
25
|
-
|
26
|
-
|
30
|
+
puts <<-REST
|
31
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
32
|
+
| What are you in the mood for? |
|
33
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
34
|
+
REST
|
35
|
+
puts <<-REST
|
36
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
37
|
+
| Enter a valid number |
|
38
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
39
|
+
REST
|
40
|
+
puts <<-REST
|
41
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
42
|
+
| Enter 'end' to exit |
|
43
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
44
|
+
REST
|
27
45
|
input = gets.strip.downcase
|
28
46
|
if valid?(input, @cuisine)
|
29
47
|
display_restaurants(input.to_i)
|
30
|
-
puts
|
48
|
+
puts <<-REST
|
49
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
50
|
+
| To find out more, enter the |
|
51
|
+
| number for the restaurant you want |
|
52
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
53
|
+
REST
|
31
54
|
else
|
32
|
-
puts
|
55
|
+
puts <<-REST
|
56
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
57
|
+
| I don't understand. Please pick another cuisine |
|
58
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
59
|
+
REST
|
33
60
|
sleep(2)
|
34
61
|
start
|
35
62
|
end
|
@@ -37,12 +64,18 @@ class KnoxRestaurants::CLI
|
|
37
64
|
|
38
65
|
def display_restaurants(input)
|
39
66
|
@restaurant = KnoxRestaurants::Restaurant.get_cuisine_restaurants(input).each.with_index(1) do |r, idx|
|
40
|
-
puts
|
67
|
+
puts <<-REST
|
68
|
+
#{idx}. #{r.name}
|
69
|
+
REST
|
41
70
|
end
|
42
71
|
end
|
43
72
|
|
44
73
|
def return_details
|
45
|
-
puts
|
74
|
+
puts <<-REST
|
75
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
76
|
+
| Please enter a valid restaurant number |
|
77
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
78
|
+
REST
|
46
79
|
restaurant = gets.chomp
|
47
80
|
if valid?(restaurant, @restaurant)
|
48
81
|
display_details(restaurant.to_i)
|
@@ -54,15 +87,14 @@ class KnoxRestaurants::CLI
|
|
54
87
|
def display_details(input)
|
55
88
|
r = @restaurant[input-1]
|
56
89
|
|
57
|
-
puts
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
90
|
+
puts <<-REST
|
91
|
+
Address: #{r.address}
|
92
|
+
Phone number: #{r.phone_number}
|
93
|
+
Rating: #{r.rating} of 5
|
94
|
+
Price Range: #{r.price}
|
95
|
+
Reviews: #{r.reviews}
|
96
|
+
Website: #{r.url}
|
97
|
+
REST
|
66
98
|
end
|
67
99
|
|
68
100
|
def valid?(input,array)
|
@@ -73,7 +105,11 @@ class KnoxRestaurants::CLI
|
|
73
105
|
end
|
74
106
|
|
75
107
|
def last_hurrah
|
76
|
-
puts
|
108
|
+
puts <<-REST
|
109
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
110
|
+
| Would you like to pick another cuisine? Yes or No |
|
111
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
112
|
+
REST
|
77
113
|
if gets.chomp.downcase == "yes"
|
78
114
|
start
|
79
115
|
else
|
@@ -82,7 +118,11 @@ class KnoxRestaurants::CLI
|
|
82
118
|
end
|
83
119
|
|
84
120
|
def goodbye
|
85
|
-
puts
|
121
|
+
puts <<-REST
|
122
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
123
|
+
| Thanks for visiting Knoxville. Have a nice day! |
|
124
|
+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
|
125
|
+
REST
|
86
126
|
exit
|
87
127
|
end
|
88
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Knox_Restaurants
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chaya Deaver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,9 @@ files:
|
|
108
108
|
- CODE_OF_CONDUCT.md
|
109
109
|
- Gemfile
|
110
110
|
- Gemfile.lock
|
111
|
+
- Knox_Restaurants-0.1.0.gem
|
112
|
+
- Knox_Restaurants-0.2.0.gem
|
113
|
+
- Knox_Restaurants-0.3.0.gem
|
111
114
|
- Knox_Restaurants.gemspec
|
112
115
|
- LICENSE.txt
|
113
116
|
- README.md
|