pricebr_apple 0.5.5 → 0.7
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 +4 -4
- data/lib/pricebr_apple.rb +14 -2
- data/lib/pricebr_apple/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f426500464a6e578525bd61fa2b1cd088a31a0
|
4
|
+
data.tar.gz: 2e48ac6b5050e41f654c098d87f39656aac22b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da55aa6640661305e5caec60a06c3b3cc4993e5988a7cacccd2e731c9b95d74947e72414bdecafb8ad9a94027291406f9e3dd99074eadfd645c75efc4394528f
|
7
|
+
data.tar.gz: e4b1acba679523e3c19d5f0c85c79d96bb28c2d186616406821981469a997db83d95264b5b9ad5ec60f557b6502076422d55db642425b6f442258e75e867fe6e
|
data/lib/pricebr_apple.rb
CHANGED
@@ -7,9 +7,11 @@ module PricebrApple
|
|
7
7
|
# EUA
|
8
8
|
# MacBook Pro : http://www.apple.com/shop/buy-mac/macbook-pro
|
9
9
|
PRICE_URL = {
|
10
|
-
"IPHONE 6S" => "http://www.apple.com/br/shop/buy-iphone/iphone6s",
|
10
|
+
"IPHONE 6S" => "http://www.apple.com/br/shop/buy-iphone/iphone6s#00",
|
11
|
+
"IPHONE 6S PLUS" => "http://www.apple.com/br/shop/buy-iphone/iphone6s#01",
|
11
12
|
"IPHONE SE" => "http://www.apple.com/br/shop/buy-iphone/iphone-se",
|
12
|
-
"IPHONE
|
13
|
+
"IPHONE 7" => "http://www.apple.com/br/shop/buy-iphone/iphone-7#00",
|
14
|
+
"IPHONE 7 PLUS" => "http://www.apple.com/br/shop/buy-iphone/iphone-7#01",
|
13
15
|
"MACBOOK PRO" => "http://www.apple.com/br/shop/buy-mac/macbook-pro",
|
14
16
|
"MACBOOK AIR" => "http://www.apple.com/br/shop/buy-mac/macbook-air",
|
15
17
|
"MACBOOK" => "http://www.apple.com/br/shop/buy-mac/macbook",
|
@@ -45,8 +47,12 @@ module PricebrApple
|
|
45
47
|
if !url_page.nil? && !@model.nil?
|
46
48
|
@page = Nokogiri::HTML(open(url_page))
|
47
49
|
list_price = @page.css('.current_price')
|
50
|
+
list_price = @page.css('.as-price-currentprice') if list_price.empty?
|
48
51
|
unless list_price.nil?
|
49
52
|
list_price.map{|item| @price = item.children[1].children[3].children[0].text.gsub(' ', '').gsub("\nR$",'').gsub("\n",'').gsub('.','').gsub(',','.').to_f if !item.nil? && item.children[1].children[1].values[1].to_s == @model}
|
53
|
+
@price = self.script_crawler({script: list_price, partNumber: @model}) if @price.nil?
|
54
|
+
else
|
55
|
+
@price = 0.0
|
50
56
|
end
|
51
57
|
end
|
52
58
|
@price
|
@@ -56,6 +62,12 @@ module PricebrApple
|
|
56
62
|
@price
|
57
63
|
end
|
58
64
|
|
65
|
+
# params {script: 'text', partNumber: 'model'}
|
66
|
+
def script_crawler(params)
|
67
|
+
if !params[:script].nil? && !params[:partNumber].nil?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
59
71
|
# params {url_page : 'http://'}
|
60
72
|
def get_list_partNumber(params)
|
61
73
|
unless params[:url_page].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pricebr_apple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Alencar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.4.
|
124
|
+
rubygems_version: 2.4.8
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Prices of Apple products.
|