adops_report_scrapper 0.1.4 → 0.1.5
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/adops_report_scrapper/triplelift_client.rb +27 -19
- 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: 90ddebdbcf3cfd0c810e901e848db5745beb16bf
|
4
|
+
data.tar.gz: 9e9974b8b6c28c3cebce1a9f7e104ff6bf714e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca85fd4ca169052d8c34f865ea311c6c1c804cb6820c56637b40eff542c6086c73296fe5147ed0b7367ddbcd74777e8c587990b7f76f932199d7586a8515a4e8
|
7
|
+
data.tar.gz: 1874fbb0593d472c3f24339966008471cf84bed45e78b6b53c13e666ff56fa59df7749fd2210c4bb78aefae5eda5488f68089acddaf59708013ed98e0800b162
|
@@ -32,30 +32,38 @@ class AdopsReportScrapper::TripleliftClient < AdopsReportScrapper::BaseClient
|
|
32
32
|
index = -1 - @publishers.count(publisher)
|
33
33
|
sleep 1
|
34
34
|
@client.find_all(:xpath, "//*[text()=\"#{publisher}\"]")[index].click
|
35
|
-
|
36
|
-
|
35
|
+
10.times do
|
36
|
+
@client.find(:xpath, '//*[text()="Reporting"]').click
|
37
|
+
sleep 2
|
37
38
|
|
38
|
-
|
39
|
+
return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
@client.find(:xpath, '//*[@model="startDate"]//input').set @date_str
|
42
|
+
sleep 1
|
43
|
+
@client.find(:xpath, '//*[@model="endDate"]//input').set @date_str
|
44
|
+
sleep 1
|
45
|
+
@client.find(:xpath, '//button[../../div[contains(text(),"Group by")]]').click
|
46
|
+
@client.find(:xpath, '//*[text()="Date and Placement"]').click
|
47
|
+
wait_for_spin
|
47
48
|
|
48
|
-
|
49
|
+
return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
rows = @client.find_all :xpath, '//table/*/tr'
|
52
|
+
rows = rows.to_a
|
53
|
+
rows.shift
|
54
|
+
header = rows.shift
|
55
|
+
n_data = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
|
56
|
+
if n_data[-1][1].empty?
|
57
|
+
@client.evaluate_script 'window.location.reload()'
|
58
|
+
next
|
59
|
+
end
|
60
|
+
if @data.count == 0
|
61
|
+
n_header = header.find_css('td,th').map { |td| td.visible_text }
|
62
|
+
@data << n_header
|
63
|
+
end
|
64
|
+
@data += n_data
|
65
|
+
break
|
57
66
|
end
|
58
|
-
@data += rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
|
59
67
|
end
|
60
68
|
|
61
69
|
def wait_for_spin
|
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.5
|
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-08-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|