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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a308286c8be74d32479abae098b6a0c56fe5822
4
- data.tar.gz: b25af761e68edcbeba8f59f044213159595e945e
3
+ metadata.gz: 5d5284b22029a3b96b9ce29a91764f0fc1ea2508
4
+ data.tar.gz: 2a863648e4aa1a49de19dbd2a26c410150630a26
5
5
  SHA512:
6
- metadata.gz: 1e3c40e38be7112945dff112f356b382ff73135b103751a27dc9a39994b3c31d8af5ebbed2453eeabdc73cb5cda1d43a2d94f53de286cb79e68d865d514b88c5
7
- data.tar.gz: c739c40809f150ba8a02ef5d17448e0205ecc4b708d64581fc36ad2e3d5f6b2f96fb644dcf1f329829900e4b53734768afe18a4a301cba35ac1dd496086cf09d
6
+ metadata.gz: 8ce5c7cc7bc6f82fc1e4d2614a0aba6ed2f7131a40df27cec15026b5a4b9b3e906824209e35e0a65850f7674debca9a75917096cc59c00136c174e68e112378c
7
+ data.tar.gz: 7e1ea0ce6294c5c7efdf1cb0c4346c01a03143901530dc9942ea45b3ebb2d59afeab4c91a57dfa4839f366b09060102ddbf81ccd5e74c86902977a0639f72682
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.38
4
+ improve littlethings to support multiple utms
5
+
3
6
  ## 0.1.37
4
7
  implement undertone
5
8
 
@@ -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
- @data << row
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
@@ -1,3 +1,3 @@
1
1
  module AdopsReportScrapper
2
- VERSION = "0.1.37"
2
+ VERSION = "0.1.38"
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.37
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-10 00:00:00.000000000 Z
11
+ date: 2016-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient