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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9b1e55dce42d84c2c166bf3936582e8e376b823
4
- data.tar.gz: fd4f2ac9788661e3d0f29e3e87b42d5bb4f718cc
3
+ metadata.gz: 0c1fbdd67560c1af4af3b290d4a092988bd3a553
4
+ data.tar.gz: b192d0609f4d0cef3c952ad98cc2e3e31f1d19e4
5
5
  SHA512:
6
- metadata.gz: 114017a976bd61d22cca180c6e8669f2f7aa65d4de1e38ed53420f1dbf2ff46a77773f69ee485d1cc46ffa3fe63e08d96cbb4e7db207eb44e37d1b5a0686e5a0
7
- data.tar.gz: 6039c383d85eff38dc615f094de86f5f27236b4f167b71a98307dc79cb3333db2716a4a5a427ea9fe88267aa7986ca62bba5fbde2263d33cc4f594a71c3f6bff
6
+ metadata.gz: 0841d7a651d31807c94893f96b8da0eed9f1ebed32fd1522ab26a3d91bef5142a3c88d5fef84993e9bc7cec83e3719f9d2c313e9966e39e3b1d501830c2040cb
7
+ data.tar.gz: a59e9c7470ba4a375c158cbae608d191886a483d2852412c9fc24986f66d61a56b3d2156e2f4b5dd6c74419d8fce4edf73ac62870188b24d32a48ad721c71774
@@ -10,11 +10,25 @@ class PopularDeals::CLI
10
10
  end
11
11
 
12
12
  def list_deals
13
- puts "Today's popular deals are:"
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
- puts "#{i}. #{deal.title} - deal popularity: #{deal.deal_rating}."
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 "Please see below details of deal no. #{input}".yellow.underline
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 "Deal:".yellow
61
- puts "#{@deal[keys[0]]}"
75
+ puts "DEAL:".magenta.bold.gsub(/^/, " ")
76
+ puts "#{@deal[keys[0]]}".gsub(/^/, " ")
62
77
  puts ""
63
- puts "Description:".yellow
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
- puts "Come back again for more deals. Have a great day!".light_blue
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
- @purchase_link = nil
54
- @purchase_link= doc.at_css("div.detailLeftColumn a.success").attr("href")
55
- if @purchase_link.nil?
56
- deal[:purchase] = @product_url
57
- else
58
- deal[:purchase] = @purchase_link
59
- end
60
- deal
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
@@ -1,3 +1,3 @@
1
1
  module PopularDeals
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -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{It displays popular deals of the day from https://slickdeals.net/deals/ with popular-deals command. You can also see a deal details by selecting number of the deal.}
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
- spec.add_development_dependency "rake", "~> 10.0"
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
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-05 00:00:00.000000000 Z
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: It displays popular deals of the day from https://slickdeals.net/deals/
70
- with popular-deals command. You can also see a deal details by selecting number
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