popular_deals 0.2.4 → 0.2.5
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 +36 -11
- data/lib/popular_deals/newdeals.rb +13 -8
- data/lib/popular_deals/version.rb +1 -1
- data/popular_deals.gemspec +4 -3
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c1fbdd67560c1af4af3b290d4a092988bd3a553
|
4
|
+
data.tar.gz: b192d0609f4d0cef3c952ad98cc2e3e31f1d19e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0841d7a651d31807c94893f96b8da0eed9f1ebed32fd1522ab26a3d91bef5142a3c88d5fef84993e9bc7cec83e3719f9d2c313e9966e39e3b1d501830c2040cb
|
7
|
+
data.tar.gz: a59e9c7470ba4a375c158cbae608d191886a483d2852412c9fc24986f66d61a56b3d2156e2f4b5dd6c74419d8fce4edf73ac62870188b24d32a48ad721c71774
|
data/lib/popular_deals/cli.rb
CHANGED
@@ -10,11 +10,25 @@ class PopularDeals::CLI
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def list_deals
|
13
|
-
puts "
|
13
|
+
puts ""
|
14
|
+
puts "Today's popular deals are:".upcase.yellow
|
15
|
+
puts ""
|
14
16
|
@deals = PopularDeals::NewDeals.new_deals
|
15
17
|
@deals.each do |info|
|
16
18
|
info.each.with_index(1) do |deal, i|
|
17
|
-
|
19
|
+
if i < 10
|
20
|
+
puts "#{i}. #{deal.title}".cyan.bold
|
21
|
+
puts "Deal rating: #{deal.deal_rating}.".gsub(/^/, " ")
|
22
|
+
puts "Deal value - #{deal.price}".gsub(/^/, " ")
|
23
|
+
puts "#{deal.posted}".gsub(/^/, " ")
|
24
|
+
puts ""
|
25
|
+
elsif i >= 10
|
26
|
+
puts "#{i}. #{deal.title}".cyan.bold
|
27
|
+
puts "Deal rating: #{deal.deal_rating}.".gsub(/^/, " ")
|
28
|
+
puts "Deal value - #{deal.price}".gsub(/^/, " ")
|
29
|
+
puts "#{deal.posted}".gsub(/^/, " ")
|
30
|
+
puts ""
|
31
|
+
end
|
18
32
|
end
|
19
33
|
end
|
20
34
|
end
|
@@ -24,7 +38,7 @@ class PopularDeals::CLI
|
|
24
38
|
while input != "exit"
|
25
39
|
|
26
40
|
puts ""
|
27
|
-
puts "Enter the number of deal you would like more info on or type Exit".light_blue
|
41
|
+
puts "Enter the number of deal you would like more info on or type Exit".light_blue.bold
|
28
42
|
puts ""
|
29
43
|
input = gets.strip.downcase
|
30
44
|
puts ""
|
@@ -32,7 +46,8 @@ class PopularDeals::CLI
|
|
32
46
|
if input.to_i > 0 && input.to_i <= 20
|
33
47
|
puts ""
|
34
48
|
puts "-----------------------------------------------------------------------------------------------------------"
|
35
|
-
puts "
|
49
|
+
puts ""
|
50
|
+
puts "Please see below details of deal no. #{input}".upcase.cyan.bold
|
36
51
|
disply_deal(input, product_url)
|
37
52
|
#open_deal_in_browser
|
38
53
|
elsif input == "list"
|
@@ -57,21 +72,31 @@ class PopularDeals::CLI
|
|
57
72
|
@deal = PopularDeals::NewDeals.deal_page(input, product_url)
|
58
73
|
keys = @deal.keys
|
59
74
|
puts ""
|
60
|
-
puts "
|
61
|
-
puts "#{@deal[keys[0]]}"
|
75
|
+
puts "DEAL:".magenta.bold.gsub(/^/, " ")
|
76
|
+
puts "#{@deal[keys[0]]}".gsub(/^/, " ")
|
62
77
|
puts ""
|
63
|
-
puts "Description:".
|
64
|
-
puts "#{@deal[keys[1]]}"
|
78
|
+
puts "Description:".upcase.magenta.bold.gsub(/^/, " ")
|
79
|
+
puts "#{@deal[keys[1]]}".gsub(/^/, " ")
|
80
|
+
puts ""
|
81
|
+
if @deal[keys[2]].nil?
|
82
|
+
puts "To lock this deal, please visit:".upcase.magenta.bold.gsub(/^/, " ")
|
83
|
+
puts "#{product_url}".gsub(/^/, " ")
|
84
|
+
else
|
85
|
+
puts "To lock this deal, please visit:".upcase.magenta.bold.gsub(/^/, " ")
|
86
|
+
puts "#{@deal[keys[2]]}".gsub(/^/, " ")
|
87
|
+
end
|
65
88
|
puts ""
|
66
|
-
puts "To lock this deal, please visit:".yellow
|
67
|
-
puts "#{@deal[keys[2]]}"
|
68
89
|
puts "-----------------------------------------------------------------------------------------------------------"
|
69
90
|
puts ""
|
70
91
|
end
|
71
92
|
|
72
93
|
def goodbye
|
94
|
+
shopping = ["We could give up shopping but we are not a quitter.", "When in doubt, go shopping.", "I still believe in the Holy Trinity, except now it's Target, Trader Joe's, and IKEA.", "I love shopping. There is a little bit of magic found in buying something new. It is instant gratification, a quick fix.", "If you can not stop thinking about it, Buy it!", "Shopping is cheaper than therapy."]
|
95
|
+
line = shopping.sample
|
73
96
|
puts ""
|
74
|
-
|
97
|
+
print "#{line}".yellow
|
98
|
+
puts "\u{1f609}"
|
99
|
+
puts "Come back again for more deals. Have a great day!".yellow
|
75
100
|
puts ""
|
76
101
|
end
|
77
102
|
|
@@ -50,14 +50,19 @@ class PopularDeals::NewDeals
|
|
50
50
|
data = doc.text.strip
|
51
51
|
deal[:name] = doc.css("h1").text.strip
|
52
52
|
deal[:discription] = doc.css(".textDescription").text.strip
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
#@purchase_link = ""
|
54
|
+
if doc.at_css("a#largeBuyNow").nil?
|
55
|
+
deal[:purchase] = @product_url
|
56
|
+
else
|
57
|
+
deal[:purchase] = doc.at_css("a#largeBuyNow").attr("href")
|
58
|
+
end
|
59
|
+
# @purchase_link= doc.at_css("a#largeBuyNow").attr("href")
|
60
|
+
# if @purchase_link.nil?
|
61
|
+
# deal[:purchase] = @product_url
|
62
|
+
# else
|
63
|
+
# deal[:purchase] = @purchase_link
|
64
|
+
# end
|
65
|
+
deal
|
61
66
|
end
|
62
67
|
|
63
68
|
end
|
data/popular_deals.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["'hima_chhag@yahoo.com'"]
|
11
11
|
|
12
12
|
spec.summary = %q{It displays popular deals of the day from https://slickdeals.net/deals/ with popular-deals command.}
|
13
|
-
spec.description = %q{
|
13
|
+
spec.description = %q{This CLI App displays a list of the popular deals with deal rating and price. Just use 'popular-deals' command. You can also see a deal details by selecting number of the deal you may be interested in.}
|
14
14
|
spec.homepage = "https://github.com/HimaChitalia/popular_deals"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -20,9 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.bindir = "bin"
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
|
+
spec.post_install_message = "Cinderella is a proof that a new pair of shoes can change your life."
|
23
24
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.14"
|
25
|
-
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
27
|
|
27
28
|
spec.add_dependency "nokogiri"
|
28
29
|
spec.add_dependency "colorize", '~> 0'
|
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.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Hima Chitalia'"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,9 +66,9 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
70
|
-
|
71
|
-
of the deal.
|
69
|
+
description: This CLI App displays a list of the popular deals with deal rating and
|
70
|
+
price. Just use 'popular-deals' command. You can also see a deal details by selecting
|
71
|
+
number of the deal you may be interested in.
|
72
72
|
email:
|
73
73
|
- "'hima_chhag@yahoo.com'"
|
74
74
|
executables:
|
@@ -98,7 +98,8 @@ homepage: https://github.com/HimaChitalia/popular_deals
|
|
98
98
|
licenses:
|
99
99
|
- MIT
|
100
100
|
metadata: {}
|
101
|
-
post_install_message:
|
101
|
+
post_install_message: Cinderella is a proof that a new pair of shoes can change your
|
102
|
+
life.
|
102
103
|
rdoc_options: []
|
103
104
|
require_paths:
|
104
105
|
- lib
|