ml_s4m 0.7.6.2 → 0.8
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/ml_s4m/version.rb +1 -1
- data/lib/ml_s4m.rb +15 -2
- 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: c9eebdbee770e320e2d7cc8c6aaf2adeeb908330
|
4
|
+
data.tar.gz: 4bd292f1f15c414824c3d6404dece1506d346124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e413a352ae651e538fc4c02ee5e3c48323abf1fbab1fcc5564075e58ff97fa18bc27c9c955e0c9a16cd4c7f79b88a0e3d8eb832daf0403da3c8a51ce618cef73
|
7
|
+
data.tar.gz: 42812b8fb22ceb2985932668cac600b42d8062d6ee487c561117632626a7188c001b812bf4cf1f024a5aaca828ca81456ffca71d0660bd763f7f0ac4f931c869
|
data/lib/ml_s4m/version.rb
CHANGED
data/lib/ml_s4m.rb
CHANGED
@@ -24,10 +24,23 @@ module MlS4m
|
|
24
24
|
begin
|
25
25
|
page = Nokogiri::HTML(open(url_page))
|
26
26
|
unless page.nil?
|
27
|
-
list = page.css('
|
27
|
+
list = page.css('ol#searchResults.list-view.srv').css('li')
|
28
28
|
list_price = []
|
29
29
|
list.each do |item|
|
30
|
-
|
30
|
+
if item.children[6].nil?
|
31
|
+
if !item.children[6].children[1].nil? && item.children[6].children[1].children[1].nil?
|
32
|
+
price = item.children[6].children[1].children[1].text
|
33
|
+
price.gsub('R$ ','').gsub('.','') unless price.nil?
|
34
|
+
list_price << price unless price.nil?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if list_price.empty?
|
39
|
+
list = page.css('div').css('section').css('ol#searchResults').css('li')
|
40
|
+
list_price = []
|
41
|
+
list.each do |item|
|
42
|
+
if item.children[6].nil?
|
43
|
+
item.children[1].children[1].children[1].children[2].children[1].nil? || item.children[1].children[1].children[1].children[2].children[1].children[3].nil?
|
31
44
|
price = item.children[1].children[1].children[1].children[2].children[1].children[3].text
|
32
45
|
list_price << price unless price.nil?
|
33
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ml_s4m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Alencar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|