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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b7e9eacbf6cbe5bbfc30e566447703171f97c88
4
- data.tar.gz: 6b3d10c511674c81b83d3776fb7d894540a823f2
3
+ metadata.gz: 063d365c48571b42e3e614d83495bceeb5a1c6b6
4
+ data.tar.gz: e45c6b2ee49468d44e6a0717cfabe2c92a7782c0
5
5
  SHA512:
6
- metadata.gz: 016d318b1aa5093632ed066c32b92c0d1fe85d863daaece9451fe5b136f0f285f94c3dfa1bee99a03f1d7c7ff2d96076c5dc29a313ba0823a56cbd97f1a7db93
7
- data.tar.gz: f9d53f41a5ed4f21e4961c0f2537aefd8da3fe169807c3e9ff05bf77ed2c8facb0e6541c424cbfbb74258206a1628a072d3805862b4f15f0b8394454527f622c
6
+ metadata.gz: 4a4838b8a4c674557f0e88ee1d84165ecc33f7766030eb449d93492667ac7ecf68f8a81c0fc5e8197f9bb81dffa0800f77ed08a3fcc4d73cb033a4de7a13a589
7
+ data.tar.gz: 372ddb0caa106c0a06b241c3b24fa9e0011315bc67488416c8e5f92e38c25a8faaa1dfc9c2b59da3963512fe7e68504b619bf42e5cdaeb7f3bfdc424e241f377
@@ -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("div.no_cpu.offer or span.no_cpu.offer")
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
- else
25
- row[:hotel_name] = @html.xpath("//h1[@id='HEADING']").text
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
@@ -1,3 +1,3 @@
1
1
  module Daodao
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  describe Daodao do
3
3
  ranks = Daodao.rank('2682464')
4
- puts ranks
4
+ warn ranks
5
5
  it "The first Ota name 'Booking.com' " do
6
6
  expect(ranks[:rank1]).to eq 'Booking.com'
7
7
  end
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.5
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-02-06 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler