popular_deals 0.2.3 → 0.2.4
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.rb +1 -1
- data/lib/popular_deals/cli.rb +9 -0
- data/lib/popular_deals/newdeals.rb +9 -3
- data/lib/popular_deals/version.rb +1 -1
- data/popular_deals.gemspec +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9b1e55dce42d84c2c166bf3936582e8e376b823
|
4
|
+
data.tar.gz: fd4f2ac9788661e3d0f29e3e87b42d5bb4f718cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 114017a976bd61d22cca180c6e8669f2f7aa65d4de1e38ed53420f1dbf2ff46a77773f69ee485d1cc46ffa3fe63e08d96cbb4e7db207eb44e37d1b5a0686e5a0
|
7
|
+
data.tar.gz: 6039c383d85eff38dc615f094de86f5f27236b4f167b71a98307dc79cb3333db2716a4a5a427ea9fe88267aa7986ca62bba5fbde2263d33cc4f594a71c3f6bff
|
data/lib/popular_deals.rb
CHANGED
data/lib/popular_deals/cli.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
class PopularDeals::CLI
|
3
3
|
|
4
4
|
attr_accessor :product_url
|
5
|
+
#BROWSER=(/usr/local/bin/firefox-bin -new-tab '%s':/usr/local/bin/google-chrome-stable)
|
5
6
|
|
6
7
|
def call
|
7
8
|
list_deals
|
@@ -33,6 +34,7 @@ class PopularDeals::CLI
|
|
33
34
|
puts "-----------------------------------------------------------------------------------------------------------"
|
34
35
|
puts "Please see below details of deal no. #{input}".yellow.underline
|
35
36
|
disply_deal(input, product_url)
|
37
|
+
#open_deal_in_browser
|
36
38
|
elsif input == "list"
|
37
39
|
list_deals
|
38
40
|
elsif input == "exit"
|
@@ -44,6 +46,13 @@ class PopularDeals::CLI
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
49
|
+
# def open_deal_in_browser
|
50
|
+
# uri = "http://www.ruby-lang.org"
|
51
|
+
# Launchy.open( uri ) do |exception|
|
52
|
+
# puts "Attempted to open #{uri} and failed because #{exception}"
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
|
47
56
|
def disply_deal(input, product_url)
|
48
57
|
@deal = PopularDeals::NewDeals.deal_page(input, product_url)
|
49
58
|
keys = @deal.keys
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class PopularDeals::NewDeals
|
2
2
|
|
3
3
|
|
4
|
-
attr_accessor :title, :url, :deal_rating, :price, :posted, :name, :discription, :purchase
|
4
|
+
attr_accessor :title, :url, :deal_rating, :price, :posted, :name, :discription, :purchase, :purchase_link
|
5
5
|
|
6
6
|
def self.new_deals
|
7
7
|
self.scrap_deals
|
@@ -50,8 +50,14 @@ 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
|
-
|
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
|
55
61
|
end
|
56
62
|
|
57
63
|
end
|
data/popular_deals.gemspec
CHANGED
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.4
|
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-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|