adops_report_scrapper 0.2.21 → 0.2.22

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: d537923a45df90cbac619437c713036c1346694f
4
- data.tar.gz: 321edb47fe694a55ed67fa8cea9f871ad9de8721
3
+ metadata.gz: 733daef4780a1a787e5224a1e0c4ea5393a1e702
4
+ data.tar.gz: 2e6fd95b75d7ada0e4ae33807fec3ec49e5ecd23
5
5
  SHA512:
6
- metadata.gz: 2f32f5d409fa1eca2fb95f6ac7c8981e75b925d1754e65deb4642564fe6e077cf1d1a800bfbfa605d5d9515645b6d10e915f78d918a3f12490aee7bdb72ee2af
7
- data.tar.gz: 094edf3648718c6d86dee8441fb2c2e02b47d2f81d274b3722931739a35ddb5b04a4b37aa526c4fa7ec49ca3a01c39c507fca4b7eab2e8aa7d4d12fd0d293dbd
6
+ metadata.gz: 08801ecb1f99e899c7bc929d7e6fecc1581d694263c30bd2dbc36a64b007229d2718b9bc6e61daa0004e4f12f15274a0cb530a2165cb1f1de1be5758ca252b64
7
+ data.tar.gz: 6825200fd8451a0096c331b6a8526008ee3c62123b6ba529c8b9c3c1c06609caecdef181afe938b6c702298fc26bc24cb349b0207e1d0c491259e75abc8e2627
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.22
4
+ popads buyer
5
+
3
6
  ## 0.2.20
4
7
  add adsparc
5
8
 
data/Rakefile CHANGED
@@ -211,6 +211,11 @@ task :adsupplybuyer do
211
211
  save_as_csv :adsupplybuyer, :adsupplybuyer
212
212
  end
213
213
 
214
+ desc 'Collect popadsbuyer data'
215
+ task :popadsbuyer do
216
+ save_as_csv :popadsbuyer, :popadsbuyer
217
+ end
218
+
214
219
  desc 'Collect adsparc data'
215
220
  task :adsparc do
216
221
  save_as_csv :adsparc, :adsparc
@@ -19,6 +19,7 @@ require 'adops_report_scrapper/adiply_client'
19
19
  require 'adops_report_scrapper/adsense_client'
20
20
  require 'adops_report_scrapper/adsupply_client'
21
21
  require 'adops_report_scrapper/adsupplybuyer_client'
22
+ require 'adops_report_scrapper/popadsbuyer_client'
22
23
  require 'adops_report_scrapper/adx_client'
23
24
  require 'adops_report_scrapper/brightroll_client'
24
25
  require 'adops_report_scrapper/browsi_client'
@@ -0,0 +1,58 @@
1
+ require 'date'
2
+ require_relative 'base_client'
3
+ require 'rest-client'
4
+
5
+ class AdopsReportScrapper::PopadsbuyerClient < AdopsReportScrapper::BaseClient
6
+ def date_supported?(date = nil)
7
+ _date = date || @date
8
+ return true if _date < (Date.today + 1)
9
+ false
10
+ end
11
+
12
+ def init_client
13
+ end
14
+
15
+ def before_quit_with_error
16
+ end
17
+
18
+ private
19
+
20
+ def scrap
21
+ if @options[:hourly]
22
+ scrap_hourly
23
+ else
24
+ scrap_daily
25
+ end
26
+ end
27
+
28
+ def scrap_daily
29
+ date_str = @date.strftime('%Y-%m-%d')
30
+ time_zone_id = 'America%2FNew_York'
31
+
32
+ response = RestClient.post "https://www.popads.net/api/report_advertiser?key=#{@secret}&zone=#{time_zone_id}&start=#{date_str}%2000%3A00&end=#{date_str}%2023%3A59&groups=campaign,datetime%3Aday", {}
33
+
34
+ data = JSON.parse response
35
+ data = data['rows']
36
+ header = data[0].keys
37
+ @data = [header]
38
+ @data += data.map do |datum|
39
+ header.map { |key| datum[key] }
40
+ end
41
+ end
42
+
43
+ def scrap_hourly
44
+ start_date_str = (@date - 1).strftime('%Y-%m-%d')
45
+ end_date_str = @date.strftime('%Y-%m-%d')
46
+ time_zone_id = 'America%2FNew_York'
47
+
48
+ response = RestClient.post "https://www.popads.net/api/report_advertiser?key=#{@secret}&zone=#{time_zone_id}&start=#{start_date_str}%2000%3A00&end=#{end_date_str}%2023%3A59&groups=datetime%3Ahour", {}
49
+
50
+ data = JSON.parse response
51
+ data = data['rows']
52
+ header = data[0].keys
53
+ @data = [header]
54
+ @data += data.map do |datum|
55
+ header.map { |key| datum[key] }
56
+ end
57
+ end
58
+ end
@@ -1,3 +1,3 @@
1
1
  module AdopsReportScrapper
2
- VERSION = "0.2.21"
2
+ VERSION = "0.2.22"
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.2.21
4
+ version: 0.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stayman Hou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-02 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -275,6 +275,7 @@ files:
275
275
  - lib/adops_report_scrapper/nativo_client.rb
276
276
  - lib/adops_report_scrapper/netseer_client.rb
277
277
  - lib/adops_report_scrapper/openx_client.rb
278
+ - lib/adops_report_scrapper/popadsbuyer_client.rb
278
279
  - lib/adops_report_scrapper/positivemobile_client.rb
279
280
  - lib/adops_report_scrapper/revcontent_client.rb
280
281
  - lib/adops_report_scrapper/rhythmone_client.rb