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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dcbc1bd32893df3dc6628024e9673075c32045bd52bde5d56b468c162012a2a
4
- data.tar.gz: 1e1ecf135f81b0c6dd163a8023ea6e9f85286edab0306c8a6028806d3e4804ad
3
+ metadata.gz: 71b56640f51ce8b1c269b6a76524aff3d7c57924639c9b8267ab86c51e575c2c
4
+ data.tar.gz: 825f95f41ede0a578f1035d9f169d175ff268388bcdb836134e8d9abf4f6c4ad
5
5
  SHA512:
6
- metadata.gz: e36856f48d56d2eef304700a1b4e1c41d14401d80ce42341e0d72c7eb3fc92758f016763a658928343b38b12e0d6bf0daac606a8f70737c61bc8edfb5b847eab
7
- data.tar.gz: 534721fa96cbaa73f4a664f6f99ee5c227b57abf63af64ef145481b925f60452c14f88cfa68b8cb6d73b8325a9c3f1a45cf3071047179f93846606338895b02e
6
+ metadata.gz: 7e6effb7aa9bd7b9fbe4a35bf1be6fef37c429bb60ad919e4749e621fef47c3da913ebf849aebd7e45b7b5caa37733ea809d1e22a0fabc7b2b0a47131991a35a
7
+ data.tar.gz: 88bfeaa3403f4bebebc09bd96d21d370bfabd52e2e65528f6120edd56ea23d5c9bce5dc65a8c54a6ecbe81d991ec6d849f2d9399be9bc9e554ebeca8464ce30e
data/bin/newegg_scraper CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require_relative "../lib/environment.rb"
4
- NeweggScraperChsbr::CLI.new.start
4
+ NeweggScraperChsbr::CLI.new.call
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 start
8
- puts "Hello! I heard you were interested in purchasing some CPU's."
9
- puts "Please enter y to browse."
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 "\n IF this data is correct please enter y"
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 "Hello! Would you like to set a budget? If no, set your maximum budget to 0"
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
@@ -1,3 +1,6 @@
1
1
  class NeweggScraperChsbr::Descriptors
2
-
2
+ attr_reader :bullets
3
+ def initialize(hash)
4
+ @bullets = hash
5
+ end
3
6
  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(URI.open(url)) # This opens the URL with open-uri, then parses it as an XML Object
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
 
@@ -0,0 +1,6 @@
1
+ class NeweggScraperChsbr::Shipping
2
+ attr_reader :price
3
+ def initialize(shipping_price)
4
+ @price = shipping_price
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NeweggScraperChsbr
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
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.2
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