pricebr_apple 0.2.5 → 0.5
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/.gitignore +0 -0
- data/.rspec +0 -0
- data/.ruby-gemset +0 -0
- data/.ruby-version +0 -0
- data/.travis.yml +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +7 -1
- data/Rakefile +0 -0
- data/lib/pricebr_apple.rb +19 -15
- data/lib/pricebr_apple/version.rb +1 -1
- data/pricebr_apple.gemspec +0 -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: 56c9ba3d1389c1b63de72080843c1cf0d959cc9c
|
|
4
|
+
data.tar.gz: 19f369f1959cc41fa453f72e3b5deb3f7abd16bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c71a9562d0906d0535b1029d315fbced4c9ab13b54b9c2dce61769a0f80de46dbd0d73d0cb3797a5ffe03794aa59569465a68d87795e32cc0c201a9ce1f3494
|
|
7
|
+
data.tar.gz: 639a81820dbd32b48d84740b993eda638879795f5a5bb4644fa793587e85027c6294f9af6800d821b99d78bf9485695d9864be6eebad783efcb1e6b6bc4e5aee
|
data/.gitignore
CHANGED
|
File without changes
|
data/.rspec
CHANGED
|
File without changes
|
data/.ruby-gemset
CHANGED
|
File without changes
|
data/.ruby-version
CHANGED
|
File without changes
|
data/.travis.yml
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/LICENSE.txt
CHANGED
|
File without changes
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
File without changes
|
data/lib/pricebr_apple.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'pricebr_apple/version'
|
|
2
2
|
require 'nokogiri'
|
|
3
3
|
require 'open-uri'
|
|
4
4
|
require 'pry'
|
|
@@ -7,17 +7,20 @@ module PricebrApple
|
|
|
7
7
|
# EUA
|
|
8
8
|
# MacBook Pro : http://www.apple.com/shop/buy-mac/macbook-pro
|
|
9
9
|
PRICE_URL = {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
10
|
+
"IPHONE 6S" => "http://www.apple.com/br/shop/buy-iphone/iphone6s",
|
|
11
|
+
"IPHONE SE" => "http://www.apple.com/br/shop/buy-iphone/iphone-se",
|
|
12
|
+
"IPHONE 5S" => "http://www.apple.com/br/shop/buy-iphone/iphone5s",
|
|
13
|
+
"MACBOOK PRO" => "http://www.apple.com/br/shop/buy-mac/macbook-pro",
|
|
14
|
+
"MACBOOK AIR" => "http://www.apple.com/br/shop/buy-mac/macbook-air",
|
|
15
|
+
"MACBOOK" => "http://www.apple.com/br/shop/buy-mac/macbook",
|
|
16
|
+
"IMAC" => "http://www.apple.com/br/shop/buy-mac/imac",
|
|
17
|
+
"APPLE TV" => "http://www.apple.com/br/shop/buy-tv/apple-tv",
|
|
18
|
+
"IPAD PRO" => "http://www.apple.com/br/shop/buy-ipad/ipad-pro",
|
|
19
|
+
"IPAD AIR 2" => "http://www.apple.com/br/shop/buy-ipad/ipad-air-2",
|
|
20
|
+
"IPAD MINI 4" => "http://www.apple.com/br/shop/buy-ipad/ipad-mini-4",
|
|
21
|
+
"IPAD MINI 2" => "http://www.apple.com/br/shop/buy-ipad/ipad-mini-2",
|
|
22
|
+
"WATCH SERIES 1" => "http://www.apple.com/br/shop/buy-watch/apple-watch-series-1",
|
|
23
|
+
"WATCH" => "http://www.apple.com/br/shop/buy-watch/apple-watch",
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
class PriceBR
|
|
@@ -35,11 +38,12 @@ module PricebrApple
|
|
|
35
38
|
end
|
|
36
39
|
end
|
|
37
40
|
|
|
38
|
-
# params {url_page: '
|
|
41
|
+
# params {url_page: 'device page', partNumber: 'model'}
|
|
39
42
|
def get_price(params)
|
|
40
43
|
@model = params[:partNumber]
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
url_page = params[:url_page]
|
|
45
|
+
if !url_page.nil? && !@model.nil?
|
|
46
|
+
@page = Nokogiri::HTML(open(url_page))
|
|
43
47
|
list_price = @page.css('.current_price')
|
|
44
48
|
unless list_price.nil?
|
|
45
49
|
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}
|
data/pricebr_apple.gemspec
CHANGED
|
File without changes
|
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.5'
|
|
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-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|