newegg_scraper_chsbr 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a1b81329b2a7b6d81d367cb748a541aadf7ec20bc5e6de1cb4d3a213272d0f2
|
4
|
+
data.tar.gz: f0db86150303b05d41ba55e7e7e9da56a0c5b4517d7e18e2d8f7e297cf35171d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f181080b9900c467cbc954c7174aee44515cdab8f7261007a3cf5a1716334d8c7e6f9d6941d4b56a47e72d3e8a7c507ae10b93e060af63fb491e5e53da13a67
|
7
|
+
data.tar.gz: 0cfa7c6ef87a6af288baa2011fc8f0d9ed19669c06604cbc4dbdcd70febe493862c7f00501807e5dec9298a26411a9778be6beb14f2cd3afe9caf34504335e34
|
data/bin/newegg_scraper
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class NeweggScraperChsbr::
|
1
|
+
class NeweggScraperChsbr::Cli
|
2
2
|
attr_reader :user
|
3
3
|
def initialize
|
4
4
|
NeweggScraperChsbr::DataGrabber.new
|
@@ -19,11 +19,13 @@ class NeweggScraperChsbr::CLI
|
|
19
19
|
get_init_data_for_user
|
20
20
|
printed_cpus = NeweggScraperChsbr::Cpu.display_cpu(@user)
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
if printed_cpus.size != 0
|
23
|
+
@user.choose_cpu(printed_cpus)
|
24
|
+
NeweggScraperChsbr::Cpu.display_cpu_with_extras(@user)
|
25
|
+
end
|
24
26
|
|
25
27
|
|
26
|
-
|
28
|
+
|
27
29
|
puts "If you would like to restart the program please enter : #{@counter}.\nTo exit type n or exit."
|
28
30
|
@counter = gets.strip
|
29
31
|
corr_input = control_bool
|
@@ -125,4 +127,35 @@ class NeweggScraperChsbr::CLI
|
|
125
127
|
end
|
126
128
|
|
127
129
|
end
|
130
|
+
# def choose_cpu(printed_cpus)
|
131
|
+
# puts "Please enter the number of the CPU you'd like to see more about."
|
132
|
+
# chosen = gets.strip
|
133
|
+
# while !is_numeric?(chosen)
|
134
|
+
# puts "Please enter the number of the CPU you'd like to see more about."
|
135
|
+
# chosen = gets.strip
|
136
|
+
# end
|
137
|
+
# if !printed_cpus.include?(chosen.to_i)
|
138
|
+
# puts "You chose a CPU outside of your budget please choose another."
|
139
|
+
# choose_cpu(printed_cpus)
|
140
|
+
# end
|
141
|
+
# @user.chosen_cpu << chosen.to_i
|
142
|
+
# puts "Would you like to see more about another CPU?\nEnter y to do so.\nEnter n to see details about the chosen CPU(s)"
|
143
|
+
# input = gets.strip
|
144
|
+
|
145
|
+
# if input == 'y'
|
146
|
+
# choose_cpu(printed_cpus)
|
147
|
+
# end
|
148
|
+
|
149
|
+
# end
|
150
|
+
# def is_numeric?(obj)
|
151
|
+
# obj.match(/\A[^+-]?\d+?(\^.\d+)?\Z/) == nil ? false : true
|
152
|
+
# end
|
153
|
+
# def self.display_cpu_with_extras(user)
|
154
|
+
|
155
|
+
# user.chosen_cpu.each do | chosen_cpu |
|
156
|
+
|
157
|
+
# puts "\n\n\n#{NeweggScraperChsbr::Cpu.all[chosen_cpu - 1].name.name}\nHas a price of: #{NeweggScraperChsbr::Cpu.all[chosen_cpu - 1].price.price}\nShipping: #{NeweggScraperChsbr::Cpu.all[chosen_cpu - 1].shipping.price}\n\n Descriptive Points:\n"
|
158
|
+
# NeweggScraperChsbr::Cpu.all[chosen_cpu - 1].printDesc
|
159
|
+
# end
|
160
|
+
# end
|
128
161
|
end
|
@@ -59,13 +59,14 @@ class NeweggScraperChsbr::Cpu
|
|
59
59
|
puts("\n #{counter}:\n Name: #{computer.name.name}\n Price: #{computer.price.price}")
|
60
60
|
printed_cpus << counter
|
61
61
|
|
62
|
-
elsif printed_cpus.size == 0
|
63
|
-
puts "You did not match any CPU criteria."
|
64
62
|
end
|
65
63
|
|
66
64
|
counter += 1
|
67
65
|
|
68
66
|
end
|
67
|
+
if printed_cpus.size == 0
|
68
|
+
puts "You did not match any CPU criteria."
|
69
|
+
end
|
69
70
|
printed_cpus
|
70
71
|
|
71
72
|
end
|
@@ -70,7 +70,7 @@ class NeweggScraperChsbr::DataGrabber
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
def isCoolerOrMB?(name)
|
73
|
-
name.include?("Water") || name.include?("Air") || name.include?("Motherboard") || name.include?("AIO") || name.include?("FLY")
|
73
|
+
name.include?("Water") || name.include?("Air") || name.include?("Motherboard") || name.include?("AIO") || name.include?("FLY") || name.include?("Cooler")
|
74
74
|
end
|
75
75
|
def getPrice
|
76
76
|
scraped_info = NeweggScraperChsbr::Scraper.new
|
@@ -117,7 +117,7 @@ class NeweggScraperChsbr::DataGrabber
|
|
117
117
|
prices.each_with_index do | price, index |
|
118
118
|
|
119
119
|
if !isCoolerOrMB?(names[index])
|
120
|
-
cpus << NeweggScraperChsbr::Cpu.new(names[index],
|
120
|
+
cpus << NeweggScraperChsbr::Cpu.new(names[index], prices[index - 1], shipping[index], desc_hash[index])
|
121
121
|
|
122
122
|
end
|
123
123
|
end
|