adops_report_scrapper 0.1.33 → 0.1.34

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: 4a633c8cf0856165fc6c1800dba2b47783f8c430
4
- data.tar.gz: 4a97596911c12a37f0cdbdf8dc4c1489dca5778f
3
+ metadata.gz: a1ae6fd211544a7d662b49b8b113ccb60f6b7059
4
+ data.tar.gz: 57496565cbfbcbcc81650262ec83d8151768c3bf
5
5
  SHA512:
6
- metadata.gz: 98a1f620bd14c2c635f3651f59167da96755befe938ee32cb4c10f205e33122d39365fedb85060a97c76d73edb180c56b4332aecb2bc75e5d08b80edf0996435
7
- data.tar.gz: d6fe2d0a0c1a37e270a718fd21a68d13c9e8e2caf87aed4803986f81f30c05a3fa7d8e00475b15761dc76059b25326c47febfedf06e4c2f343919441b2798809
6
+ metadata.gz: c5cc4e0d71edf0ec341d493f0b7193eed9ee8105260dc8a52f60b59c725ea3beaeb8a9158084ce4fbdc3148b686d68718ab2ae6b51a5a1e00c1af52bd3680f1e
7
+ data.tar.gz: 17a4db37edc2203ad9c830dbc0fa9c918d86a528749abfb3279609a63a8d9e4ff900840d3459b24cb5a4277fd13fb8e84122ac8f0dacfae18d5f8b5640254f7f
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.34
4
+ fixed triple lift for their new ui
5
+
3
6
  ## 0.1.33
4
7
  distinguish adx product in adx client
5
8
 
@@ -20,61 +20,34 @@ class AdopsReportScrapper::TripleliftClient < AdopsReportScrapper::BaseClient
20
20
  @date_str = @date.strftime('%B %d, %Y')
21
21
  @client.find(:xpath, '//*[text()="Reporting"]').click
22
22
  wait_for_spin
23
- # byebug
24
- # @client.find(:xpath, '//button[contains(text(),"Last 7 days")]').click
25
- # @client.find(:xpath, '//a[contains(text(),"Yesterday")]').click
26
-
27
-
23
+ @client.find(:xpath, '//button[contains(text(),"Last 7 days")]').click
24
+ @client.find(:xpath, '//a[contains(text(),"Yesterday")]').click
25
+ sleep 1
28
26
 
29
- @client.find(:xpath, '//button[../../div[contains(text(),"Publisher")]]').click
30
- @publishers = @client.find_all(:xpath, '//*[@ng-click="selectPublisher(pub)"]').to_a.map { |pub_elem| pub_elem.text(:all) }
31
- sleep 2
32
- @publishers = @client.find_all(:xpath, '//*[@ng-click="selectPublisher(pub)"]').to_a.map { |pub_elem| pub_elem.text(:all) }
33
- @client.find(:xpath, '//button[../../div[contains(text(),"Publisher")]]').click
34
- @data = []
35
- while @publishers.count > 0
36
- extract_data(@publishers.shift)
37
- end
38
- end
27
+ @client.find(:xpath, '//tl-checkbox/div/span[text()[normalize-space()="Placement"]]').click
28
+ sleep 1
29
+ @client.find(:xpath, '//tl-checkbox/div/span[text()[normalize-space()="Clicks"]]').click
30
+ sleep 1
31
+ @client.find(:xpath, '//*[text()[normalize-space()="Run query"]]').click
32
+ sleep 10
39
33
 
40
- def extract_data(publisher)
41
- 10.times do
42
- @client.find(:xpath, '//*[text()="Reporting"]').click
43
- sleep 2
44
- @client.find(:xpath, '//button[../../div[contains(text(),"Publisher")]]').click
45
- index = -1 - @publishers.count(publisher)
46
- sleep 1
47
- @client.find_all(:xpath, "//*[text()=\"#{publisher}\"]")[index].click
48
- wait_for_spin
49
-
50
- return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
51
-
52
- @client.find(:xpath, '//*[@model="startDate"]//input').set @date_str
53
- sleep 1
54
- @client.find(:xpath, '//*[@model="endDate"]//input').set @date_str
55
- sleep 1
56
- @client.find(:xpath, '//button[../../div[contains(text(),"Group by")]]').click
57
- @client.find(:xpath, '//*[text()="Date and Placement"]').click
58
- wait_for_spin
34
+ extract_data
35
+ end
59
36
 
60
- return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
37
+ def extract_data
38
+ @data = []
39
+ return if @client.find_all(:xpath, '//*[text()="No data available for selected date range"]').count > 0
61
40
 
62
- rows = @client.find_all :xpath, '//table/*/tr'
63
- rows = rows.to_a
64
- rows.shift
65
- header = rows.shift
66
- n_data = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
67
- if n_data[-1][1].empty?
68
- @client.evaluate_script 'window.location.reload()'
69
- next
70
- end
71
- if @data.count == 0
72
- n_header = header.find_css('td,th').map { |td| td.visible_text }
73
- @data << n_header
74
- end
75
- @data += n_data
76
- break
41
+ rows = @client.find_all :xpath, '//table/*/tr'
42
+ rows = rows.to_a
43
+ rows.pop
44
+ header = rows.shift
45
+ n_data = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
46
+ if @data.count == 0
47
+ n_header = header.find_css('td,th').map { |td| td.visible_text }
48
+ @data << n_header
77
49
  end
50
+ @data += n_data
78
51
  end
79
52
 
80
53
  def wait_for_spin
@@ -1,3 +1,3 @@
1
1
  module AdopsReportScrapper
2
- VERSION = "0.1.33"
2
+ VERSION = "0.1.34"
3
3
  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.33
4
+ version: 0.1.34
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-11-28 00:00:00.000000000 Z
11
+ date: 2016-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient