best_pizza 0.2.0
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 +7 -0
- data/bin/best-pizza +5 -0
- data/config/environment.rb +5 -0
- data/lib/best_pizza.rb +4 -0
- data/lib/best_pizza/cli.rb +66 -0
- data/lib/best_pizza/restaurant.rb +27 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e190566c6860bb5f49a7c2fc4a443992fab8a62
|
4
|
+
data.tar.gz: cd6f69f5c344e3e28c8326660c3ca2ffa1210e13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b5a09bd0f97beb4f01400c5269907aecd8d23ada23157b042c813a3ce9057aa1301bc173c795842075ff3d10ba64a722e4a017a6f863abc01ff1b09e5a3256f
|
7
|
+
data.tar.gz: 946f5af47be9d3e5449b8853600235a0120dff30c1ff35294375660d1d7b4f2e5c0a460a830872b34bea6512932af9f197bb90c2d3b32044192937b59a77e7b0
|
data/bin/best-pizza
ADDED
data/lib/best_pizza.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
class BestPizza::CLI
|
2
|
+
|
3
|
+
def call
|
4
|
+
BestPizza::Restaurant.scrape_pizza
|
5
|
+
list_pizza
|
6
|
+
menu
|
7
|
+
end
|
8
|
+
|
9
|
+
def list_pizza
|
10
|
+
puts ""
|
11
|
+
puts "================================================="
|
12
|
+
puts " Best New York Pizza "
|
13
|
+
puts "================================================="
|
14
|
+
@pizzas = BestPizza::Restaurant.pizza_restaurants
|
15
|
+
@pizzas.each.with_index(1) do |pizza, i|
|
16
|
+
puts "#{i}. #{pizza.name}"
|
17
|
+
end
|
18
|
+
puts "-------------------------------------------------"
|
19
|
+
end
|
20
|
+
|
21
|
+
def menu
|
22
|
+
input = nil
|
23
|
+
while input != "exit"
|
24
|
+
puts "Which delicious pizza restaurant would you like more information on?"
|
25
|
+
|
26
|
+
input = gets.strip.downcase
|
27
|
+
|
28
|
+
if input.to_i > 0 && input.to_i <= BestPizza::Restaurant.pizza_restaurants.size
|
29
|
+
pizza = BestPizza::Restaurant.find(input)
|
30
|
+
puts ""
|
31
|
+
puts "================================================="
|
32
|
+
puts " ** #{pizza.name} **"
|
33
|
+
puts "================================================="
|
34
|
+
puts "Neighborhood: #{pizza.area}"
|
35
|
+
puts "-------------------------------------------------"
|
36
|
+
puts "Description: #{pizza.description}"
|
37
|
+
puts "-------------------------------------------------"
|
38
|
+
|
39
|
+
repeat
|
40
|
+
|
41
|
+
elsif input == "list"
|
42
|
+
list_pizza
|
43
|
+
elsif input == "exit"
|
44
|
+
thanks
|
45
|
+
else
|
46
|
+
puts "Not sure what you're looking for, type 1-26, 'list', or 'exit'"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def repeat
|
52
|
+
puts ""
|
53
|
+
puts "Would you like to see another restaurant? Enter Y or N"
|
54
|
+
input = gets.strip.downcase
|
55
|
+
if input == "y"
|
56
|
+
list_pizza
|
57
|
+
else
|
58
|
+
thanks
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def thanks
|
63
|
+
puts "Thanks! Enjoy your pizza!"
|
64
|
+
exit
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class BestPizza::Restaurant
|
2
|
+
|
3
|
+
attr_accessor :name, :description, :area
|
4
|
+
|
5
|
+
@@pizza_restaurants = []
|
6
|
+
|
7
|
+
def self.pizza_restaurants
|
8
|
+
@@pizza_restaurants
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.scrape_pizza
|
12
|
+
doc = Nokogiri::HTML(open("https://www.thrillist.com/eat/new-york/the-best-pizza-in-new-york-city"))
|
13
|
+
|
14
|
+
doc.css("section.save-venue.saveable-venue").collect do |info|
|
15
|
+
pizza = self.new
|
16
|
+
pizza.name = info.css('h1').text.strip
|
17
|
+
pizza.area = info.css('h2').text.strip
|
18
|
+
pizza.description = info.css('p.save-venue__description').text.strip
|
19
|
+
|
20
|
+
self.pizza_restaurants << pizza
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.find(id)
|
25
|
+
self.pizza_restaurants[id.to_i - 1]
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: best_pizza
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vicky Lau
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.1
|
69
|
+
description: Best Pizzas in New York
|
70
|
+
email:
|
71
|
+
- vlau.nyc@gmail.com
|
72
|
+
executables:
|
73
|
+
- best-pizza
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- bin/best-pizza
|
78
|
+
- config/environment.rb
|
79
|
+
- lib/best_pizza.rb
|
80
|
+
- lib/best_pizza/cli.rb
|
81
|
+
- lib/best_pizza/restaurant.rb
|
82
|
+
homepage: https://github.com/vlaunyc/best-pizza-cli-gem
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.6.13
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: This Ruby Gem provides a CLI to view the 26 best pizza resturants in New
|
106
|
+
York as per thrillist website. Users can select from a list of pizza resturants
|
107
|
+
and then view details and location.
|
108
|
+
test_files: []
|