adzerk 0.16 → 0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adzerk.rb +4 -1
- data/lib/adzerk/advertiser.rb +3 -2
- data/lib/adzerk/campaign.rb +9 -2
- data/lib/adzerk/channel.rb +9 -0
- data/lib/adzerk/client.rb +5 -2
- data/lib/adzerk/creative_map.rb +4 -4
- data/lib/adzerk/day_parting.rb +23 -0
- data/lib/adzerk/flight.rb +14 -5
- data/lib/adzerk/instant_count.rb +6 -0
- data/lib/adzerk/scheduled_reporting.rb +24 -0
- data/lib/adzerk/util.rb +6 -1
- data/lib/adzerk/version.rb +1 -1
- data/test/advertiser_api_spec.rb +8 -0
- data/test/campaign_api_spec.rb +13 -0
- data/test/channel_api_spec.rb +5 -0
- data/test/creative_map_api_spec.rb +9 -1
- data/test/day_parting_api_spec.rb +102 -0
- data/test/flight_api_spec.rb +26 -0
- data/test/instant_count_api_spec.rb +32 -2
- data/test/scheduled_reporting_api_spec.rb +60 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81c206b72f16aa47a2968e4f6fcc1143bd44d8ead4585e8c65e70e14a1b2541f
|
4
|
+
data.tar.gz: a61cfe82cbd4fe8a2899307fbc4844da2ae974257891e97b9c7336427c3d3989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44611cee6e3f78945dae45e86f286cbfb964c603933587191798df9c9b810bfd214c7b110edae97ff46968fca5ee74d0a7ef8dee87ccaca0ef47ef01672b7e6f
|
7
|
+
data.tar.gz: 0fab0586f87c62820036ef226b2c27bf2ee8c9a7ca38075ba17429c8269bed5e9e2e51649fcc3c722e968416006454533a6e5b44ea55b8ac67f35d8e9616df0b
|
data/lib/adzerk.rb
CHANGED
@@ -13,6 +13,7 @@ require "adzerk/publisher"
|
|
13
13
|
require "adzerk/invitation"
|
14
14
|
require "adzerk/reporting"
|
15
15
|
require "adzerk/channel_site_map"
|
16
|
+
require "adzerk/channel"
|
16
17
|
require "adzerk/geo_targeting"
|
17
18
|
require "adzerk/site_zone_targeting"
|
18
19
|
require "adzerk/category"
|
@@ -20,4 +21,6 @@ require "adzerk/client"
|
|
20
21
|
require "adzerk/priority"
|
21
22
|
require "adzerk/campaign"
|
22
23
|
require "adzerk/instant_count"
|
23
|
-
require "adzerk/creative_template"
|
24
|
+
require "adzerk/creative_template"
|
25
|
+
require "adzerk/scheduled_reporting"
|
26
|
+
require "adzerk/day_parting"
|
data/lib/adzerk/advertiser.rb
CHANGED
@@ -6,8 +6,9 @@ module Adzerk
|
|
6
6
|
parse_response(client.post_request(url, data))
|
7
7
|
end
|
8
8
|
|
9
|
-
def instant_counts(advertiser_id)
|
10
|
-
|
9
|
+
def instant_counts(advertiser_id, data={})
|
10
|
+
query_string = URI.encode_www_form(data)
|
11
|
+
url = "instantcounts/#{endpoint}/#{advertiser_id}?#{query_string}"
|
11
12
|
parse_response(client.get_request(url))
|
12
13
|
end
|
13
14
|
|
data/lib/adzerk/campaign.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
module Adzerk
|
2
2
|
class Campaign < ApiEndpoint
|
3
|
-
def instant_counts(campaign_id)
|
4
|
-
|
3
|
+
def instant_counts(campaign_id, data={})
|
4
|
+
query_string = URI.encode_www_form(data)
|
5
|
+
url = "instantcounts/#{endpoint}/#{campaign_id}?#{query_string}"
|
5
6
|
parse_response(client.get_request(url))
|
6
7
|
end
|
8
|
+
|
9
|
+
def search(campaign_name)
|
10
|
+
url = 'campaign/search'
|
11
|
+
data = { 'campaignName' => campaign_name }
|
12
|
+
parse_response(client.post_request(url, data))
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
data/lib/adzerk/client.rb
CHANGED
@@ -7,7 +7,8 @@ module Adzerk
|
|
7
7
|
:advertisers, :flights, :creatives, :creative_maps,
|
8
8
|
:publishers, :invitations, :reports, :channel_site_maps,
|
9
9
|
:logins, :geotargetings, :sitezonetargetings, :categories,
|
10
|
-
:instant_counts, :ads, :creative_templates
|
10
|
+
:instant_counts, :ads, :creative_templates, :scheduled_reports,
|
11
|
+
:day_parts
|
11
12
|
|
12
13
|
VERSION = Gem.loaded_specs['adzerk'].version.to_s
|
13
14
|
SDK_HEADER_NAME = 'X-Adzerk-Sdk-Version'
|
@@ -31,7 +32,7 @@ module Adzerk
|
|
31
32
|
@flights = Adzerk::Flight.new(:client => self, :endpoint => 'flight')
|
32
33
|
@zones = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'zone')
|
33
34
|
@campaigns = Adzerk::Campaign.new(:client => self, :endpoint => 'campaign')
|
34
|
-
@channels = Adzerk::
|
35
|
+
@channels = Adzerk::Channel.new(:client => self, :endpoint => 'channel')
|
35
36
|
@priorities = Adzerk::Priority.new(:client => self, :endpoint => 'priority')
|
36
37
|
@advertisers = Adzerk::Advertiser.new(:client => self, :endpoint => 'advertiser')
|
37
38
|
@publishers = Adzerk::Publisher.new(:client => self, :endpoint => 'publisher')
|
@@ -46,6 +47,8 @@ module Adzerk
|
|
46
47
|
@categories = Adzerk::Category.new(:client => self, :endpoint => 'category')
|
47
48
|
@instant_counts = Adzerk::InstantCount.new(:client => self)
|
48
49
|
@creative_templates = Adzerk::CreativeTemplate.new(:client => self)
|
50
|
+
@scheduled_reports = Adzerk::ScheduledReporting.new(:client => self, :endpoint => 'report')
|
51
|
+
@day_parts = Adzerk::DayParting.new(:client => self, :endpoint => 'dayparting')
|
49
52
|
end
|
50
53
|
|
51
54
|
def get_request(url, version: 'v1')
|
data/lib/adzerk/creative_map.rb
CHANGED
@@ -34,10 +34,10 @@ module Adzerk
|
|
34
34
|
@client.get_request(url)
|
35
35
|
end
|
36
36
|
|
37
|
-
def instant_counts(creative_map_id)
|
38
|
-
|
39
|
-
|
37
|
+
def instant_counts(creative_map_id, data={})
|
38
|
+
query_string = URI.encode_www_form(data)
|
39
|
+
url = "instantcounts/ad/#{creative_map_id}?#{query_string}"
|
40
|
+
parse_response(@client.get_request(url))
|
40
41
|
end
|
41
|
-
|
42
42
|
end
|
43
43
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Adzerk
|
2
|
+
class DayParting < ApiEndpoint
|
3
|
+
def create(flight_id, data={})
|
4
|
+
url = "flight/#{flight_id}/dayparting"
|
5
|
+
parse_response(@client.post_json_request(url, camelize_data(data)))
|
6
|
+
end
|
7
|
+
|
8
|
+
def get(flight_id, timepart_id)
|
9
|
+
url = "flight/#{flight_id}/dayparting/#{timepart_id}"
|
10
|
+
parse_response(@client.get_request(url))
|
11
|
+
end
|
12
|
+
|
13
|
+
def list(flight_id)
|
14
|
+
url = "flight/#{flight_id}/dayparting"
|
15
|
+
parse_response(@client.get_request(url))
|
16
|
+
end
|
17
|
+
|
18
|
+
def delete(flight_id, timepart_id)
|
19
|
+
url = "flight/#{flight_id}/dayparting/#{timepart_id}/delete"
|
20
|
+
@client.post_request(url, data={})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/adzerk/flight.rb
CHANGED
@@ -1,16 +1,25 @@
|
|
1
1
|
module Adzerk
|
2
2
|
class Flight < ApiEndpoint
|
3
3
|
def countries
|
4
|
-
|
4
|
+
response = @client.get_request('countries')
|
5
|
+
parse_response(response)
|
5
6
|
end
|
6
7
|
|
7
8
|
def regions(region)
|
8
|
-
url =
|
9
|
-
|
9
|
+
url = "region/#{region}"
|
10
|
+
response = @client.get_request(url)
|
11
|
+
parse_response(response)
|
10
12
|
end
|
11
13
|
|
12
|
-
def
|
13
|
-
url = "
|
14
|
+
def list_regions_for_country(country_code)
|
15
|
+
url = "country/#{country_code}/regions?version=2"
|
16
|
+
response = @client.get_request(url)
|
17
|
+
parse_response(response)
|
18
|
+
end
|
19
|
+
|
20
|
+
def instant_counts(flight_id, data={})
|
21
|
+
query_string = URI.encode_www_form(data)
|
22
|
+
url = "instantcounts/#{endpoint}/#{flight_id}?#{query_string}"
|
14
23
|
parse_response(client.get_request(url))
|
15
24
|
end
|
16
25
|
|
data/lib/adzerk/instant_count.rb
CHANGED
@@ -11,5 +11,11 @@ module Adzerk
|
|
11
11
|
response = @client.post_json_request(url, data)
|
12
12
|
parse_response(response)
|
13
13
|
end
|
14
|
+
|
15
|
+
def network_counts(data={})
|
16
|
+
query_string = URI.encode_www_form(data)
|
17
|
+
url = "instantcounts/network?#{query_string}"
|
18
|
+
parse_response(@client.get_request(url))
|
19
|
+
end
|
14
20
|
end
|
15
21
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Adzerk
|
2
|
+
class ScheduledReporting < ApiEndpoint
|
3
|
+
def create(data)
|
4
|
+
url = "report/schedule"
|
5
|
+
formatted_data = data.transform_keys{ |key| key.downcase }
|
6
|
+
parse_response(@client.post_json_request(url, camelize_data(formatted_data)))
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(report_id)
|
10
|
+
url = "report/schedule/#{report_id}"
|
11
|
+
parse_response(@client.get_request(url))
|
12
|
+
end
|
13
|
+
|
14
|
+
def list()
|
15
|
+
url = "report/schedule"
|
16
|
+
parse_response(@client.get_request(url))
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete(report_id)
|
20
|
+
url = "report/schedule/#{report_id}/delete"
|
21
|
+
parse_response(@client.get_request(url))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/adzerk/util.rb
CHANGED
@@ -29,7 +29,12 @@ module Adzerk
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def parse_response(response)
|
32
|
-
|
32
|
+
parsed_body = JSON.parse(response.body)
|
33
|
+
case parsed_body
|
34
|
+
when Hash then uncamelize_data(parsed_body)
|
35
|
+
when Array then parsed_body.map {|elem| uncamelize_data(elem)}
|
36
|
+
else parsed_body
|
37
|
+
end
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
data/lib/adzerk/version.rb
CHANGED
data/test/advertiser_api_spec.rb
CHANGED
@@ -50,6 +50,14 @@ describe "Advertiser API" do
|
|
50
50
|
expect(advertiser[:total_items]).to be > 0
|
51
51
|
end
|
52
52
|
|
53
|
+
it "should get advertiser instant counts" do
|
54
|
+
data = {
|
55
|
+
days: 5
|
56
|
+
}
|
57
|
+
count = @advertisers.instant_counts($advertiser_id, data)
|
58
|
+
expect(count.length).to be > 0
|
59
|
+
end
|
60
|
+
|
53
61
|
it "should delete a new advertiser" do
|
54
62
|
response = @advertisers.delete($advertiser_id)
|
55
63
|
expect(response.body).to eq('"Successfully deleted."')
|
data/test/campaign_api_spec.rb
CHANGED
@@ -140,6 +140,19 @@ describe "Campaign API" do
|
|
140
140
|
expect(campaigns.length).to be > 0
|
141
141
|
end
|
142
142
|
|
143
|
+
it "should get campaign instant counts" do
|
144
|
+
data = {
|
145
|
+
days: 5
|
146
|
+
}
|
147
|
+
count = @campaigns.instant_counts($campaign_id, data)
|
148
|
+
expect(count.length).to be > 0
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should search campaign based on name" do
|
152
|
+
campaign = @campaigns.search("Test%")
|
153
|
+
expect(campaign[:total_items]).to be > 0
|
154
|
+
end
|
155
|
+
|
143
156
|
it "should not create/update a campaign with a advertiserId that doesn't belong to it" do
|
144
157
|
new_campaign = {
|
145
158
|
:name => 'Test campaign ' + rand(1000000).to_s,
|
data/test/channel_api_spec.rb
CHANGED
@@ -39,6 +39,11 @@ describe "Channel API" do
|
|
39
39
|
expect($channel_ad_types).to eq(channel[:ad_types])
|
40
40
|
end
|
41
41
|
|
42
|
+
it "should get priorities for channel" do
|
43
|
+
count = @channels.get_priorities($channel_id)
|
44
|
+
expect(count.length).to be > 0
|
45
|
+
end
|
46
|
+
|
42
47
|
it "should update a channel" do
|
43
48
|
$u_channel_title = 'Test Channel ' + rand(1000000).to_s + 'test'
|
44
49
|
$u_channel_commission = '1.0'
|
@@ -169,7 +169,7 @@ describe "Creative Flight API" do
|
|
169
169
|
it "should list all creatives maps for a flight" do
|
170
170
|
creative_maps = @creative_maps.list(@flight_id)
|
171
171
|
creative_map = creative_maps[:items].last
|
172
|
-
$map_id= creative_map[:id]
|
172
|
+
$map_id = creative_map[:id]
|
173
173
|
|
174
174
|
expect(creative_map[:campaign_id]).to eq(@campaign_id)
|
175
175
|
expect(creative_map[:flight_id]).to eq(@flight_id)
|
@@ -195,6 +195,14 @@ describe "Creative Flight API" do
|
|
195
195
|
expect(creative_map[:creative][:is_sync]).to eq($IsSync)
|
196
196
|
end
|
197
197
|
|
198
|
+
it "should get creative map instant counts" do
|
199
|
+
data = {
|
200
|
+
days: 5
|
201
|
+
}
|
202
|
+
count = @creative_maps.instant_counts($map_id, data)
|
203
|
+
expect(count.length).to be > 0
|
204
|
+
end
|
205
|
+
|
198
206
|
it "should get a specific creative map" do
|
199
207
|
creative_map = @creative_maps.get($map_id, @flight_id)
|
200
208
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "DayParting API" do
|
4
|
+
before(:all) do
|
5
|
+
client = Adzerk::Client.new(API_KEY)
|
6
|
+
@day_partings = client.day_parts
|
7
|
+
@flights = client.flights
|
8
|
+
@advertisers = client.advertisers
|
9
|
+
@channels = client.channels
|
10
|
+
@campaigns = client.campaigns
|
11
|
+
@priorities = client.priorities
|
12
|
+
|
13
|
+
advertiser = @advertisers.create(:title => "test")
|
14
|
+
$advertiserId = advertiser[:id].to_s
|
15
|
+
|
16
|
+
channel = @channels.create(:title => 'Test Channel ' + rand(1000000).to_s,
|
17
|
+
:commission => '0.0',
|
18
|
+
:engine => 'CPM',
|
19
|
+
:keywords => 'test',
|
20
|
+
'CPM' => '10.00',
|
21
|
+
:ad_types => [1,2,3,4])
|
22
|
+
$channel_id = channel[:id].to_s
|
23
|
+
|
24
|
+
priority = @priorities.create(:name => "High Priority Test",
|
25
|
+
:channel_id => $channel_id,
|
26
|
+
:weight => 1,
|
27
|
+
:is_deleted => false)
|
28
|
+
$priority_id = priority[:id].to_s
|
29
|
+
|
30
|
+
campaign = @campaigns.
|
31
|
+
create(:name => 'Test campaign ' + rand(1000000).to_s,
|
32
|
+
:start_date => "1/1/2011",
|
33
|
+
:end_date => "12/31/2011",
|
34
|
+
:is_active => false,
|
35
|
+
:price => '10.00',
|
36
|
+
:advertiser_id => $advertiserId,
|
37
|
+
:flights => [],
|
38
|
+
:is_deleted => false)
|
39
|
+
$campaign_id = campaign[:id]
|
40
|
+
|
41
|
+
new_flight = {
|
42
|
+
:priority_id => $priority_id,
|
43
|
+
:name => 'Test flight ' + rand(1000000).to_s,
|
44
|
+
:start_date => "1/1/2011",
|
45
|
+
:end_date => "12/31/2011",
|
46
|
+
:no_end_date => false,
|
47
|
+
:price => '15.00',
|
48
|
+
:option_type => 1,
|
49
|
+
:impressions => 10000,
|
50
|
+
:is_unlimited => false,
|
51
|
+
:is_full_speed => false,
|
52
|
+
:keywords => "test, test2",
|
53
|
+
:user_agent_keywords => nil,
|
54
|
+
:weight_override => nil,
|
55
|
+
:campaign_id => $campaign_id,
|
56
|
+
:is_active => true,
|
57
|
+
:is_deleted => false,
|
58
|
+
:goal_type => 1
|
59
|
+
}
|
60
|
+
flight = @flights.create(new_flight)
|
61
|
+
$flight_id = flight[:id].to_s
|
62
|
+
end
|
63
|
+
|
64
|
+
after(:all) do
|
65
|
+
@flights.delete($flight_id)
|
66
|
+
@campaigns.delete($campaign_id)
|
67
|
+
@advertisers.delete($advertiserId)
|
68
|
+
@priorities.delete($priority_id)
|
69
|
+
@channels.delete($channel_id)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should create a day part entity" do
|
73
|
+
data = {
|
74
|
+
:start_time => '09:30:00',
|
75
|
+
:end_time => '17:00:00',
|
76
|
+
:week_days => ['MO','TU']
|
77
|
+
}
|
78
|
+
|
79
|
+
response = @day_partings.create($flight_id, data)
|
80
|
+
expect(response[:timepart_id]).to_not eq(nil)
|
81
|
+
$timepart_id = response[:timepart_id].to_s
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should get a day parting entity associated with a flight" do
|
85
|
+
response = @day_partings.get($flight_id, $timepart_id)
|
86
|
+
expect(response[:id].to_s).to eq($timepart_id)
|
87
|
+
expect(response[:flight_id].to_s).to eq($flight_id)
|
88
|
+
expect(response[:start_time]).to_not eq(nil)
|
89
|
+
expect(response[:end_time]).to_not eq(nil)
|
90
|
+
expect(response[:week_days]).to_not eq(nil)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should list all the day part entities in a flight" do
|
94
|
+
response = @day_partings.list($flight_id)
|
95
|
+
expect(response[:items].length).to be > 0
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should delete a day part entity associated with a flight" do
|
99
|
+
response = @day_partings.delete($flight_id, $timepart_id)
|
100
|
+
expect(response.code).to eq('204')
|
101
|
+
end
|
102
|
+
end
|
data/test/flight_api_spec.rb
CHANGED
@@ -170,6 +170,15 @@ describe "Flight API" do
|
|
170
170
|
expect(flights.length).to be > 0
|
171
171
|
end
|
172
172
|
|
173
|
+
it "should get flight instant counts" do
|
174
|
+
data = {
|
175
|
+
start: "2021-04-04",
|
176
|
+
end: "2021-04-20"
|
177
|
+
}
|
178
|
+
count = @flights.instant_counts($flight_id, data)
|
179
|
+
expect(count.length).to be > 0
|
180
|
+
end
|
181
|
+
|
173
182
|
it "should delete a new flight" do
|
174
183
|
response = @flights.delete($flight_id)
|
175
184
|
expect(response.body).to eq('"Successfully deleted"')
|
@@ -250,4 +259,21 @@ describe "Flight API" do
|
|
250
259
|
)
|
251
260
|
}.to raise_error "This campaign is not part of your network"
|
252
261
|
end
|
262
|
+
|
263
|
+
it "should list countries" do
|
264
|
+
response = @flights.countries()
|
265
|
+
expect(response.length).to be > 0
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should list metro codes for region" do
|
269
|
+
region_code = "MN"
|
270
|
+
response = @flights.regions(region_code)
|
271
|
+
expect(response.length).to be > 0
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should list regions for a country" do
|
275
|
+
country_code = "US"
|
276
|
+
response = @flights.list_regions_for_country(country_code)
|
277
|
+
expect(response.length).to be > 0
|
278
|
+
end
|
253
279
|
end
|
@@ -5,11 +5,32 @@ describe "Instant Count API" do
|
|
5
5
|
before(:all) do
|
6
6
|
client = Adzerk::Client.new(API_KEY)
|
7
7
|
@instant_counts = client.instant_counts
|
8
|
+
@advertisers = client.advertisers
|
9
|
+
@campaigns = client.campaigns
|
10
|
+
|
11
|
+
advertiser = @advertisers.create(:title => "test")
|
12
|
+
@advertiser_id = advertiser[:id]
|
13
|
+
|
14
|
+
campaign = @campaigns.
|
15
|
+
create(:name => 'Test campaign ' + rand(1000000).to_s,
|
16
|
+
:start_date => "1/1/2011",
|
17
|
+
:end_date => "12/31/2011",
|
18
|
+
:is_active => false,
|
19
|
+
:price => '10.00',
|
20
|
+
:advertiser_id => @advertiser_id,
|
21
|
+
:flights => [],
|
22
|
+
:is_deleted => false)
|
23
|
+
@campaign_id = campaign[:id]
|
24
|
+
end
|
25
|
+
|
26
|
+
after(:all) do
|
27
|
+
@campaigns.delete(@campaign_id)
|
28
|
+
@advertisers.delete(@advertiser_id)
|
8
29
|
end
|
9
30
|
|
10
31
|
it "should fetch bulk instant counts" do
|
11
|
-
advertiser_id =
|
12
|
-
campaign_id =
|
32
|
+
advertiser_id = @advertiser_id
|
33
|
+
campaign_id = @campaign_id
|
13
34
|
|
14
35
|
counts = @instant_counts.bulk({
|
15
36
|
:advertisers => [advertiser_id],
|
@@ -22,4 +43,13 @@ describe "Instant Count API" do
|
|
22
43
|
expect(counts).to have_key(:campaigns)
|
23
44
|
expect(counts[:campaigns]).to have_key(campaign_id.to_s.to_sym)
|
24
45
|
end
|
46
|
+
|
47
|
+
it "should get network instant counts" do
|
48
|
+
data = {
|
49
|
+
start: "2021-04-04",
|
50
|
+
end: "2021-04-20"
|
51
|
+
}
|
52
|
+
count = @instant_counts.network_counts(data)
|
53
|
+
expect(count.length).to be > 0
|
54
|
+
end
|
25
55
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Reporting API" do
|
4
|
+
before(:all) do
|
5
|
+
client = Adzerk::Client.new(API_KEY)
|
6
|
+
@scheduled_reports = client.scheduled_reports
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should create a scheduled report" do
|
10
|
+
$name = 'Test Report' + rand(1000000).to_s
|
11
|
+
$login_id = 25218
|
12
|
+
$kickoff_date = '2020-02-02T00:00:00'
|
13
|
+
$scheduling_window = 1
|
14
|
+
$recurrence_type = 2
|
15
|
+
data = {
|
16
|
+
:name => $name,
|
17
|
+
:login_id => $login_id,
|
18
|
+
:kickoff_date => $kickoff_date,
|
19
|
+
:scheduling_window => $scheduling_window,
|
20
|
+
:recurrence_type => $recurrence_type,
|
21
|
+
:criteria => {
|
22
|
+
:start_date_iso => '2020-01-01T00:00:00',
|
23
|
+
:end_date_iso => '2020-11-23T23:59:59',
|
24
|
+
:group_by => ['month'],
|
25
|
+
:parameters => [{
|
26
|
+
:country_code => 'US'
|
27
|
+
}],
|
28
|
+
},
|
29
|
+
:emails => ['cbensel@kevel.co'],
|
30
|
+
:show_events => true,
|
31
|
+
:show_click_bucketing => true,
|
32
|
+
:show_revenue => true,
|
33
|
+
:show_conversions => true,
|
34
|
+
}
|
35
|
+
|
36
|
+
response = @scheduled_reports.create(data)
|
37
|
+
expect($name).to eq(response[:name])
|
38
|
+
expect($login_id).to eq(response[:login_id])
|
39
|
+
expect($kickoff_date).to eq(response[:kickoff_date])
|
40
|
+
expect($scheduling_window).to eq(response[:scheduling_window])
|
41
|
+
expect($recurrence_type).to eq(response[:recurrence_type])
|
42
|
+
$report_id = response[:id]
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should get a single report" do
|
46
|
+
response = @scheduled_reports.get($report_id)
|
47
|
+
expect($report_id).to eq(response[:id])
|
48
|
+
expect($name).to eq(response[:name])
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should list all reports for account" do
|
52
|
+
response = @scheduled_reports.list()
|
53
|
+
expect(response.length).to be > 0
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should delete a report" do
|
57
|
+
response = @scheduled_reports.delete($report_id)
|
58
|
+
expect(response).to eq('Successfully deleted')
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adzerk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.17'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kacy Fortner
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2021-04-
|
20
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rspec
|
@@ -100,11 +100,13 @@ files:
|
|
100
100
|
- lib/adzerk/api_endpoint.rb
|
101
101
|
- lib/adzerk/campaign.rb
|
102
102
|
- lib/adzerk/category.rb
|
103
|
+
- lib/adzerk/channel.rb
|
103
104
|
- lib/adzerk/channel_site_map.rb
|
104
105
|
- lib/adzerk/client.rb
|
105
106
|
- lib/adzerk/creative.rb
|
106
107
|
- lib/adzerk/creative_map.rb
|
107
108
|
- lib/adzerk/creative_template.rb
|
109
|
+
- lib/adzerk/day_parting.rb
|
108
110
|
- lib/adzerk/errors.rb
|
109
111
|
- lib/adzerk/flight.rb
|
110
112
|
- lib/adzerk/geo_targeting.rb
|
@@ -113,6 +115,7 @@ files:
|
|
113
115
|
- lib/adzerk/priority.rb
|
114
116
|
- lib/adzerk/publisher.rb
|
115
117
|
- lib/adzerk/reporting.rb
|
118
|
+
- lib/adzerk/scheduled_reporting.rb
|
116
119
|
- lib/adzerk/site_zone_targeting.rb
|
117
120
|
- lib/adzerk/util.rb
|
118
121
|
- lib/adzerk/version.rb
|
@@ -125,6 +128,7 @@ files:
|
|
125
128
|
- test/creative_api_spec.rb
|
126
129
|
- test/creative_map_api_spec.rb
|
127
130
|
- test/creative_template_spec.rb
|
131
|
+
- test/day_parting_api_spec.rb
|
128
132
|
- test/flight_api_spec.rb
|
129
133
|
- test/geo_targeting_api_spec.rb
|
130
134
|
- test/instant_count_api_spec.rb
|
@@ -134,6 +138,7 @@ files:
|
|
134
138
|
- test/publisher_api_spec.rb
|
135
139
|
- test/rakefile.rb
|
136
140
|
- test/report_api_spec.rb
|
141
|
+
- test/scheduled_reporting_api_spec.rb
|
137
142
|
- test/security_api_spec.rb
|
138
143
|
- test/site_api_spec.rb
|
139
144
|
- test/site_zone_targeting_api_spec.rb
|