daodao 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/daodao.rb +9 -5
- data/lib/daodao/version.rb +1 -1
- data/spec/rank_fast_spec.rb +1 -1
- 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: 063d365c48571b42e3e614d83495bceeb5a1c6b6
|
4
|
+
data.tar.gz: e45c6b2ee49468d44e6a0717cfabe2c92a7782c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4838b8a4c674557f0e88ee1d84165ecc33f7766030eb449d93492667ac7ecf68f8a81c0fc5e8197f9bb81dffa0800f77ed08a3fcc4d73cb033a4de7a13a589
|
7
|
+
data.tar.gz: 372ddb0caa106c0a06b241c3b24fa9e0011315bc67488416c8e5f92e38c25a8faaa1dfc9c2b59da3963512fe7e68504b619bf42e5cdaeb7f3bfdc424e241f377
|
data/lib/daodao.rb
CHANGED
@@ -13,17 +13,16 @@ module Daodao
|
|
13
13
|
row = {}
|
14
14
|
row[:hotel_id] = hotel_id[/\d+/]
|
15
15
|
rank=1
|
16
|
-
provider = @html.css("
|
16
|
+
provider = @html.css("*.no_cpu.offer")
|
17
17
|
if provider.empty?
|
18
18
|
row[:hotel_name] = @html.xpath("//span[@itemprop='name']").text
|
19
19
|
@html.css("div.provider_meta_overview").each { |item|
|
20
20
|
key = 'rank'+rank.to_s
|
21
21
|
row[key.to_sym] = item.at("span[@class='providerLogo_96x41']/img")['alt']
|
22
22
|
rank+=1
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
provider.each { |item|
|
23
|
+
}else
|
24
|
+
row[:hotel_name] = @html.search("//h1[@id='HEADING']/text()").to_s.gsub(/\n|\s/,'')
|
25
|
+
provider.each { |item|
|
27
26
|
key = 'rank'+rank.to_s
|
28
27
|
row[key.to_sym] = item['data-vendorname']
|
29
28
|
rank+=1
|
@@ -31,4 +30,9 @@ module Daodao
|
|
31
30
|
end
|
32
31
|
row
|
33
32
|
end
|
33
|
+
|
34
|
+
def self.html
|
35
|
+
@html.to_html
|
36
|
+
end
|
37
|
+
|
34
38
|
end
|
data/lib/daodao/version.rb
CHANGED
data/spec/rank_fast_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daodao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- timlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|