adops_report_scrapper 0.1.37 → 0.1.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/adops_report_scrapper/littlethings_client.rb +20 -3
- data/lib/adops_report_scrapper/version.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: 5d5284b22029a3b96b9ce29a91764f0fc1ea2508
|
4
|
+
data.tar.gz: 2a863648e4aa1a49de19dbd2a26c410150630a26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ce5c7cc7bc6f82fc1e4d2614a0aba6ed2f7131a40df27cec15026b5a4b9b3e906824209e35e0a65850f7674debca9a75917096cc59c00136c174e68e112378c
|
7
|
+
data.tar.gz: 7e1ea0ce6294c5c7efdf1cb0c4346c01a03143901530dc9942ea45b3ebb2d59afeab4c91a57dfa4839f366b09060102ddbf81ccd5e74c86902977a0639f72682
|
data/CHANGELOG
CHANGED
@@ -34,6 +34,8 @@ class AdopsReportScrapper::LittlethingsClient < AdopsReportScrapper::BaseClient
|
|
34
34
|
daterange_begin_str = (Date.today - 5).strftime('%m/%d/%Y')
|
35
35
|
daterange_str = "#{daterange_begin_str} - #{daterange_end_str}"
|
36
36
|
@client.visit "http://www.reportingthings.com/report/story/#{pub_id}/all/all?type=revenue&daterange=#{URI.encode(daterange_str)}"
|
37
|
+
utm_rows = @client.find_all(:xpath, '//*[contains(text(),"UTMs")]')
|
38
|
+
utm_rows.each { |utm_row| utm_row.click }
|
37
39
|
end
|
38
40
|
|
39
41
|
def extract_data_from_report
|
@@ -42,9 +44,24 @@ class AdopsReportScrapper::LittlethingsClient < AdopsReportScrapper::BaseClient
|
|
42
44
|
rows = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
|
43
45
|
header = rows.shift
|
44
46
|
@data = [header]
|
47
|
+
flag_found_date = false
|
45
48
|
rows.each do |row|
|
46
|
-
next unless row[0] == date_str
|
47
|
-
|
49
|
+
next unless row[0] == date_str || flag_found_date
|
50
|
+
case row[0]
|
51
|
+
when date_str
|
52
|
+
flag_found_date = true
|
53
|
+
unless row[1].include? 'UTMs'
|
54
|
+
@data << row
|
55
|
+
break
|
56
|
+
end
|
57
|
+
next
|
58
|
+
when ''
|
59
|
+
@data << row
|
60
|
+
@data[-1][0] = date_str
|
61
|
+
next
|
62
|
+
else
|
63
|
+
break
|
64
|
+
end
|
48
65
|
end
|
49
66
|
end
|
50
|
-
end
|
67
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adops_report_scrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stayman Hou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|