adops_report_scrapper 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edbe42b9645b997220cd4ac89c2d0473445eb11f
4
- data.tar.gz: d3c6d4a8fd8668879b64e6bd0a46e2cc60dd077f
3
+ metadata.gz: 6923611409097a83da3eaea3bf39b2b3753659d0
4
+ data.tar.gz: fb6d4cf022cb3a570619ac7755b75e9c605716ee
5
5
  SHA512:
6
- metadata.gz: ca089b75280f02a1d9af9a50d7d53b3975e1982541220842acf8955eda005ee13eba45956fd6b11bdcb65342850c3675383d2a141a6c565207818c3608419a70
7
- data.tar.gz: e869dfcac65dbcfca94d924105ab4f26364575845a4ad166fb660bf4c73ff0dabeb3510292440e8f8455bc7f04d1ca38644e32648bf9c047e056676e6d57f6fc
6
+ metadata.gz: 21dcfc4c96bdad16af2568a08a4367a740a512c572b29d69bc7c87042579cef3f96d459ce7550b19d48c65d13641eea9006aec7854d49361cc8eda72c1ce5903
7
+ data.tar.gz: dd660b46fa71be3de6e1955c42fe44de8726d9303c8d0124e05af34b63fe2959dacc96e3c0e1021e22579ef0946471dcf3910e2d06d53fbf4d47a4b3e2b01f83
@@ -23,10 +23,21 @@ class AdopsReportScrapper::BrightrollClient < AdopsReportScrapper::BaseClient
23
23
 
24
24
  def request_report
25
25
  @client.find(:xpath, '//*[text()="Tags"]').click
26
- @client.find(:css, '.details-date-filter').click
26
+ wait_for_loading
27
27
  # select date
28
+ @client.find(:css, '.details-date-filter').click
28
29
  @client.find(:xpath, '//*[text()="Yesterday"]').click
30
+ wait_for_loading
31
+ end
29
32
 
33
+ def extract_data_from_report
34
+ rows = @client.find_all :xpath, '//table[1]/*/tr'
35
+ rows = rows.to_a
36
+ rows.delete_at 1
37
+ @data = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
38
+ end
39
+
40
+ def wait_for_loading
30
41
  30.times do |_i| # wait 5 min
31
42
  begin
32
43
  @client.find(:css, '.bubble-loader.bubble-loader-3')
@@ -37,11 +48,4 @@ class AdopsReportScrapper::BrightrollClient < AdopsReportScrapper::BaseClient
37
48
  end
38
49
  sleep 10
39
50
  end
40
-
41
- def extract_data_from_report
42
- rows = @client.find_all :xpath, '//table[1]/*/tr'
43
- rows = rows.to_a
44
- rows.delete_at 1
45
- @data = rows.map { |tr| tr.find_css('td,th').map { |td| td.visible_text } }
46
- end
47
51
  end
@@ -1,3 +1,3 @@
1
1
  module AdopsReportScrapper
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adops_report_scrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stayman Hou