popular_deals 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/popular_deals/cli.rb +2 -0
- data/lib/popular_deals/newdeals.rb +1 -30
- data/lib/popular_deals/version.rb +1 -1
- data/popular_deals.gemspec +2 -11
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0c9a6aa0400dd372ef21382ee3b2f93504308a1
|
4
|
+
data.tar.gz: 5ff407f201c8fdecba0cba3a777c4c4ae8fcfe2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3923b32832721f927f5e6068de72fd0fc36f284ac2e1dd4c115bd39589b441e7a26a106b2578c2ef7168db06c0124fbf906f9418dc69f92da96b5e94db90161
|
7
|
+
data.tar.gz: a8d3a1f36a666744bd028826e40283007b355e63407abf3c283ceaf02c41abf09e840bd66ac0ce1062e33f3c4a1c20a20ee6a12b9c5c6101388a33bc77d81e81
|
data/lib/popular_deals/cli.rb
CHANGED
@@ -21,11 +21,13 @@ class PopularDeals::CLI
|
|
21
21
|
def menu
|
22
22
|
input = nil
|
23
23
|
while input != "exit"
|
24
|
+
|
24
25
|
puts ""
|
25
26
|
puts "Enter the number of deal you would like more info on or type Exit".light_blue
|
26
27
|
puts ""
|
27
28
|
input = gets.strip.downcase
|
28
29
|
puts ""
|
30
|
+
|
29
31
|
if input.to_i > 0 && input.to_i <= 20
|
30
32
|
puts ""
|
31
33
|
puts "-----------------------------------------------------------------------------------------------------------"
|
@@ -11,7 +11,6 @@ class PopularDeals::NewDeals
|
|
11
11
|
deals = []
|
12
12
|
deals << self.scrap_slickdeals
|
13
13
|
deals
|
14
|
-
#binding.pry
|
15
14
|
end
|
16
15
|
|
17
16
|
def self.scrap_slickdeals
|
@@ -30,9 +29,7 @@ class PopularDeals::NewDeals
|
|
30
29
|
new_array = date.split
|
31
30
|
deal.posted = "#{new_array[0]} #{new_array[1]}"
|
32
31
|
deal
|
33
|
-
#binding.pry
|
34
32
|
end
|
35
|
-
#binding.pry
|
36
33
|
end
|
37
34
|
|
38
35
|
def self.open_deal_page(input)
|
@@ -42,45 +39,19 @@ class PopularDeals::NewDeals
|
|
42
39
|
d = info[index]
|
43
40
|
@product_url = "#{d.url}"
|
44
41
|
end
|
45
|
-
#puts "#{@product_url}"
|
46
42
|
@product_url
|
47
43
|
end
|
48
44
|
|
49
45
|
def self.deal_page(input, product_url)
|
50
46
|
self.open_deal_page(input)
|
51
|
-
|
52
|
-
deal = {}
|
47
|
+
deal = {}
|
53
48
|
html = open(@product_url)
|
54
49
|
doc = Nokogiri::HTML(html)
|
55
50
|
data = doc.text.strip
|
56
|
-
#puts "#{data}"
|
57
51
|
deal[:name] = doc.css("h1").text.strip
|
58
52
|
deal[:discription] = doc.css(".textDescription").text.strip
|
59
53
|
deal[:purchase] = doc.css("div.detailLeftColumn a.success").attribute("href").value
|
60
|
-
#deal[:purchase] = doc.at_xpath('//*[@class="success"]//a/@href').to_s
|
61
|
-
|
62
|
-
#end
|
63
|
-
|
64
54
|
deal
|
65
|
-
#binding.pry
|
66
55
|
end
|
67
56
|
|
68
57
|
end
|
69
|
-
#end
|
70
|
-
|
71
|
-
#deal = doc.css("div.dealRow").first
|
72
|
-
#title = deal.css("div.dealTitle a.track-popularDealLink").text - works
|
73
|
-
#url= deal.css("div.dealTitle a").attribute("href").value -works
|
74
|
-
#deal_rating = deal.css("div.ratingCol div.num").text -works
|
75
|
-
#price = deal.css("div.priceCol div.price").text -works
|
76
|
-
#posted = deal.css("div.dealLinks").first.text.strip
|
77
|
-
#new_string = posted.split
|
78
|
-
#date = "#{new_string[0]} #{new_string[1]}"
|
79
|
-
|
80
|
-
#deal = doc.css("div.dealRow").first
|
81
|
-
#title = deal.css("div.dealTitle a.track-popularDealLink").text - works
|
82
|
-
#url= doc.css("div.dealTitle a").first.attribute("href").value -works
|
83
|
-
#deal_rating = doc.css("div.ratingCol div.num").first.text -works
|
84
|
-
#price = doc.css("div.priceCol div.price").first.text -works
|
85
|
-
#posted = doc.css("div.priceCol div.price").first.text
|
86
|
-
#date = posted..sub /More info.*/, ''
|
data/popular_deals.gemspec
CHANGED
@@ -14,20 +14,11 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/HimaChitalia/popular_deals"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
# if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
# else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
-
# "public gem pushes."
|
24
|
-
# end
|
25
|
-
|
26
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
18
|
f.match(%r{^(test|spec|features)/})
|
28
19
|
end
|
29
|
-
|
30
|
-
spec.executables = spec.files.grep(%r{^
|
20
|
+
spec.bindir = "bin"
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
22
|
spec.require_paths = ["lib"]
|
32
23
|
|
33
24
|
spec.add_development_dependency "bundler", "~> 1.14"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: popular_deals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Hima Chitalia'"
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -83,7 +83,10 @@ dependencies:
|
|
83
83
|
description: It displays popular deals of the day from https://slickdeals.net/deals/.
|
84
84
|
email:
|
85
85
|
- "'hima_chhag@yahoo.com'"
|
86
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- console
|
88
|
+
- popular-deals
|
89
|
+
- setup
|
87
90
|
extensions: []
|
88
91
|
extra_rdoc_files: []
|
89
92
|
files:
|
@@ -123,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
126
|
version: '0'
|
124
127
|
requirements: []
|
125
128
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.6.
|
129
|
+
rubygems_version: 2.6.11
|
127
130
|
signing_key:
|
128
131
|
specification_version: 4
|
129
132
|
summary: It displays popular deals of the day from https://slickdeals.net/deals/.
|