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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73f691be9c685db9f1fc9fb133121e1ab70c8d14
4
- data.tar.gz: 772e44e2f86329068be9c862c99fd5fa161c44d5
3
+ metadata.gz: a9f426500464a6e578525bd61fa2b1cd088a31a0
4
+ data.tar.gz: 2e48ac6b5050e41f654c098d87f39656aac22b8e
5
5
  SHA512:
6
- metadata.gz: 274d3b1a247ee49340717265693a309a7dee7473b9c8bfa641e7e484d696702b6a9ba0568db991bc749cdccd97166169aed7704473d4228c481935d29d12528c
7
- data.tar.gz: 1cb11ccea0f1e51a81e921ca6cb85b02832042c98e4c6a5fabbacdf4797951f82b28cd7416cafed8d9108a9fc7dd2cf35aa88fc6d86019447a5c0858b9ed8ebb
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 5S" => "http://www.apple.com/br/shop/buy-iphone/iphone5s",
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?
@@ -1,3 +1,3 @@
1
1
  module PricebrApple
2
- VERSION = "0.5.5"
2
+ VERSION = "0.7"
3
3
  end
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.5.5
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-10-06 00:00:00.000000000 Z
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.6
124
+ rubygems_version: 2.4.8
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Prices of Apple products.