newegg_scraper_chsbr 0.1.2 → 0.1.3
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/bin/newegg_scraper +1 -1
- data/lib/environment.rb +3 -1
- data/lib/newegg_scraper_chsbr/cli.rb +5 -5
- data/lib/newegg_scraper_chsbr/cpu.rb +4 -4
- data/lib/newegg_scraper_chsbr/descriptors.rb +4 -1
- data/lib/newegg_scraper_chsbr/scraper.rb +1 -1
- data/lib/newegg_scraper_chsbr/shipping.rb +6 -0
- data/lib/newegg_scraper_chsbr/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b56640f51ce8b1c269b6a76524aff3d7c57924639c9b8267ab86c51e575c2c
|
4
|
+
data.tar.gz: 825f95f41ede0a578f1035d9f169d175ff268388bcdb836134e8d9abf4f6c4ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e6effb7aa9bd7b9fbe4a35bf1be6fef37c429bb60ad919e4749e621fef47c3da913ebf849aebd7e45b7b5caa37733ea809d1e22a0fabc7b2b0a47131991a35a
|
7
|
+
data.tar.gz: 88bfeaa3403f4bebebc09bd96d21d370bfabd52e2e65528f6120edd56ea23d5c9bce5dc65a8c54a6ecbe81d991ec6d849f2d9399be9bc9e554ebeca8464ce30e
|
data/bin/newegg_scraper
CHANGED
data/lib/environment.rb
CHANGED
@@ -8,4 +8,6 @@ require_relative './newegg_scraper_chsbr/user.rb'
|
|
8
8
|
require_relative './newegg_scraper_chsbr/name.rb'
|
9
9
|
require_relative './newegg_scraper_chsbr/price.rb'
|
10
10
|
require_relative './newegg_scraper_chsbr/cli.rb'
|
11
|
-
require_relative './newegg_scraper_chsbr/cpu.rb'
|
11
|
+
require_relative './newegg_scraper_chsbr/cpu.rb'
|
12
|
+
require_relative './newegg_scraper_chsbr/descriptors.rb'
|
13
|
+
require_relative './newegg_scraper_chsbr/shipping.rb'
|
@@ -4,9 +4,9 @@ class NeweggScraperChsbr::CLI
|
|
4
4
|
def initialize
|
5
5
|
NeweggScraperChsbr::DataGrabber.new
|
6
6
|
end
|
7
|
-
def
|
8
|
-
puts "
|
9
|
-
puts "Please enter y to
|
7
|
+
def call
|
8
|
+
puts "Were you interested in purchasing some CPU's?"
|
9
|
+
puts "Please enter y to do so."
|
10
10
|
@counter = gets.strip
|
11
11
|
while @counter == 'y' do
|
12
12
|
get_init_data_for_user
|
@@ -40,7 +40,7 @@ class NeweggScraperChsbr::CLI
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
def if_correct_info
|
43
|
-
puts "\
|
43
|
+
puts "\nIf you're satisfied with your selection, the computer will print\na list of CPUs that satisfy the criteria. Enter y to continue."
|
44
44
|
@counter = gets.strip
|
45
45
|
if @counter == 'y'
|
46
46
|
@user = NeweggScraperChsbr::User.new(@cpu_make, @min_price, @max_price)
|
@@ -49,7 +49,7 @@ class NeweggScraperChsbr::CLI
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
def get_price_range
|
52
|
-
puts "
|
52
|
+
puts "Welcome. Would you like to set a budget? If no, set your maximum budget to 0"
|
53
53
|
puts "Please enter the integer value of your maximum price."
|
54
54
|
puts "$500.50, please enter as 501, or 500 to stay below budget."
|
55
55
|
@max_price = gets.strip
|
@@ -5,8 +5,8 @@ class NeweggScraperChsbr::Cpu
|
|
5
5
|
def initialize(name, price, shipping, desc)
|
6
6
|
@name = NeweggScraperChsbr::Name.new(name)
|
7
7
|
@price = NeweggScraperChsbr::Price.new(price)
|
8
|
-
@desc = desc
|
9
|
-
@shipping = shipping
|
8
|
+
@desc = NeweggScraperChsbr::Descriptors.new(desc)
|
9
|
+
@shipping = NewEggScraperChsbr::Shipping.new(shipping)
|
10
10
|
@@all << self
|
11
11
|
end
|
12
12
|
def self.all
|
@@ -54,12 +54,12 @@ class NeweggScraperChsbr::Cpu
|
|
54
54
|
def self.display_cpu_with_extras(user)
|
55
55
|
|
56
56
|
user.chosen_cpu.each do | chosen_cpu |
|
57
|
-
puts "\n\n\n#{@@all[chosen_cpu - 1].name.name}\nHas a price of: #{@@all[chosen_cpu - 1].price.price}\nShipping: #{@@all[chosen_cpu - 1].shipping}\n\n Descriptive Points:\n"
|
57
|
+
puts "\n\n\n#{@@all[chosen_cpu - 1].name.name}\nHas a price of: #{@@all[chosen_cpu - 1].price.price}\nShipping: #{@@all[chosen_cpu - 1].shipping.price}\n\n Descriptive Points:\n"
|
58
58
|
@@all[chosen_cpu - 1].printDesc
|
59
59
|
end
|
60
60
|
end
|
61
61
|
def printDesc
|
62
|
-
@desc.each do | key, value |
|
62
|
+
@desc.bullets.each do | key, value |
|
63
63
|
puts " #{key + 1}: #{value}"
|
64
64
|
end
|
65
65
|
end
|
@@ -4,7 +4,7 @@ class NeweggScraperChsbr::Scraper
|
|
4
4
|
|
5
5
|
URL = "https://www.newegg.com/p/pl?d=cpu"
|
6
6
|
def initialize(url = URL)
|
7
|
-
@xml_obj = Nokogiri::HTML(
|
7
|
+
@xml_obj = Nokogiri::HTML(open(url)) # This opens the URL with open-uri, then parses it as an XML Object
|
8
8
|
end
|
9
9
|
|
10
10
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newegg_scraper_chsbr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lrd134
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/newegg_scraper_chsbr/name.rb
|
56
56
|
- lib/newegg_scraper_chsbr/price.rb
|
57
57
|
- lib/newegg_scraper_chsbr/scraper.rb
|
58
|
+
- lib/newegg_scraper_chsbr/shipping.rb
|
58
59
|
- lib/newegg_scraper_chsbr/user.rb
|
59
60
|
- lib/newegg_scraper_chsbr/version.rb
|
60
61
|
homepage: https://github.com/Lrd134/aa_phase_1_proj
|