adzerk 0.8 → 0.9
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 +7 -0
- data/lib/adzerk/reporting.rb +42 -3
- data/lib/adzerk/version.rb +1 -1
- data/test/campaign_api_spec.rb +6 -1
- data/test/category_api_spec.rb +24 -7
- data/test/channel_site_map_api_spec.rb +5 -0
- data/test/creative_api_spec.rb +9 -4
- data/test/creative_map_api_spec.rb +19 -11
- data/test/flight_api_spec.rb +14 -8
- data/test/geo_targeting_api_spec.rb +17 -13
- data/test/invitation_api_spec.rb +5 -0
- data/test/login_api_spec.rb +1 -1
- data/test/priority_api_spec.rb +6 -2
- data/test/report_api_spec.rb +8 -7
- data/test/site_api_spec.rb +0 -4
- data/test/site_zone_targeting_api_spec.rb +16 -9
- data/test/zone_api_spec.rb +4 -0
- metadata +34 -44
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 6ba4b853cea1aba9150e437e7360604d3791bcc7
|
|
4
|
+
data.tar.gz: 3f3ca3a7026b66061257b2958411f6e1cc7184a6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 144f5a632d83d075c45f9f05e103fce634531a1b4a8c806bc1a25d30a73763fdde47133023401ae9ac74dab1a3432beb5996984fd4174fef1505b733f94020f9
|
|
7
|
+
data.tar.gz: adcb50f27f01290bbd7c0a6e3401a8b9d58491af62fa3aaf29584924518c6eb32b9f291ac6e11a27af135424a0fb1d74c41323716b12dca61a744e924d2dfb5d
|
data/lib/adzerk/reporting.rb
CHANGED
|
@@ -4,13 +4,52 @@ module Adzerk
|
|
|
4
4
|
|
|
5
5
|
attr_accessor :client
|
|
6
6
|
|
|
7
|
+
REPORT_STATUS = {
|
|
8
|
+
success: 2
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
def initialize(args = {})
|
|
8
12
|
@client = args.fetch(:client)
|
|
9
13
|
end
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
# Queues a report and then polls for it using exponential backoff, blocking
|
|
16
|
+
# until the report is either retrieved or (optionally) if a timeout is
|
|
17
|
+
# exceeded.
|
|
18
|
+
#
|
|
19
|
+
# The timeout is a total number of milliseconds to wait before giving up
|
|
20
|
+
# and raising an error.
|
|
21
|
+
#
|
|
22
|
+
# If no timeout is provided, this function will continue to poll forever
|
|
23
|
+
# with exponential backoff.
|
|
24
|
+
#
|
|
25
|
+
# Returns the parsed report JSON when a report is retrieved.
|
|
26
|
+
def create_report(data={}, timeout=nil)
|
|
27
|
+
# Queue the report.
|
|
28
|
+
queue_response = create_queued_report(data)
|
|
29
|
+
|
|
30
|
+
# Ensure it contains a report ID.
|
|
31
|
+
report_id = queue_response[:id]
|
|
32
|
+
raise "Unexpected response: #{queue_response}" unless report_id
|
|
33
|
+
|
|
34
|
+
# Try to get the report indefinitely or up until the timeout, with
|
|
35
|
+
# exponential backoff.
|
|
36
|
+
time_to_stop = Time.now + (timeout / 1000.0) unless timeout.nil?
|
|
37
|
+
retries = 0
|
|
38
|
+
|
|
39
|
+
while timeout.nil? or Time.now < time_to_stop
|
|
40
|
+
poll_result = retrieve_queued_report(report_id)
|
|
41
|
+
|
|
42
|
+
if poll_result[:status] == REPORT_STATUS[:success]
|
|
43
|
+
return poll_result[:result]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
poll_interval = (2 ** retries) * 100
|
|
47
|
+
sleep poll_interval / 1000.0
|
|
48
|
+
|
|
49
|
+
retries += 1
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
raise "Failed to retrieve report within #{timeout} ms."
|
|
14
53
|
end
|
|
15
54
|
|
|
16
55
|
def create_queued_report(data={})
|
data/lib/adzerk/version.rb
CHANGED
data/test/campaign_api_spec.rb
CHANGED
|
@@ -27,7 +27,12 @@ describe "Campaign API" do
|
|
|
27
27
|
$priority_id = priority[:id].to_s
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
after(:all) do
|
|
31
|
+
@campaigns.delete($campaign_id_1)
|
|
32
|
+
@advertisers.delete($campaign_advertiser_id)
|
|
33
|
+
@priorities.delete($priority_id)
|
|
34
|
+
@channels.delete($channel_id)
|
|
35
|
+
end
|
|
31
36
|
|
|
32
37
|
it "should create a new campaign with no flights" do
|
|
33
38
|
$campaign_name = 'Test campaign ' + rand(1000000).to_s
|
data/test/category_api_spec.rb
CHANGED
|
@@ -4,9 +4,6 @@ describe "Category API" do
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
before(:all) do
|
|
7
|
-
new_advertiser = {
|
|
8
|
-
'Title' => "Test"
|
|
9
|
-
}
|
|
10
7
|
client = Adzerk::Client.new(API_KEY)
|
|
11
8
|
@flights= client.flights
|
|
12
9
|
@advertisers = client.advertisers
|
|
@@ -73,6 +70,14 @@ describe "Category API" do
|
|
|
73
70
|
|
|
74
71
|
end
|
|
75
72
|
|
|
73
|
+
after(:all) do
|
|
74
|
+
@flights.delete($flight_id)
|
|
75
|
+
@campaigns.delete($campaign_id)
|
|
76
|
+
@advertisers.delete($advertiserId)
|
|
77
|
+
@priorities.delete($priority_id)
|
|
78
|
+
@channels.delete($channel_id)
|
|
79
|
+
end
|
|
80
|
+
|
|
76
81
|
it "should add a category to a flight" do
|
|
77
82
|
cat = @category.create($flight_id, $new_category)
|
|
78
83
|
$category_id = cat[:id]
|
|
@@ -97,10 +102,22 @@ describe "Category API" do
|
|
|
97
102
|
|
|
98
103
|
it "should error when the flight or category id does not exist or does not belong to the network" do
|
|
99
104
|
bad_id = 0
|
|
100
|
-
|
|
101
|
-
expect{
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
|
|
106
|
+
expect {
|
|
107
|
+
@category.create(bad_id, $new_category)
|
|
108
|
+
}.to raise_error "Flight is not a part of your network"
|
|
109
|
+
|
|
110
|
+
expect {
|
|
111
|
+
@category.list(bad_id)
|
|
112
|
+
}.to raise_error "Flight is not a part of your network"
|
|
113
|
+
|
|
114
|
+
expect {
|
|
115
|
+
@category.delete(bad_id,$category_id)
|
|
116
|
+
}.to raise_error "Flight is not a part of your network"
|
|
117
|
+
|
|
118
|
+
expect {
|
|
119
|
+
@category.delete($flight_id,bad_id)
|
|
120
|
+
}.to raise_error "Category is not part of your network"
|
|
104
121
|
end
|
|
105
122
|
|
|
106
123
|
end
|
data/test/creative_api_spec.rb
CHANGED
|
@@ -4,10 +4,15 @@ describe "Creative API" do
|
|
|
4
4
|
|
|
5
5
|
before(:all) do
|
|
6
6
|
client = Adzerk::Client.new(API_KEY)
|
|
7
|
+
@advertisers = client.advertisers
|
|
7
8
|
@creatives = client.creatives
|
|
8
|
-
@advertiser_id =
|
|
9
|
+
@advertiser_id = @advertisers.create(:title => "Test")[:id]
|
|
9
10
|
end
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
after(:all) do
|
|
13
|
+
@advertisers.delete(@advertiser_id)
|
|
14
|
+
end
|
|
15
|
+
|
|
11
16
|
# this test gets a 400 error... doesn't work with current release
|
|
12
17
|
# commenting out for now
|
|
13
18
|
|
|
@@ -22,7 +27,7 @@ describe "Creative API" do
|
|
|
22
27
|
# :is_active => true,
|
|
23
28
|
# :alt => 'test alt',
|
|
24
29
|
# :is_deleted => false,
|
|
25
|
-
# :is_sync => false
|
|
30
|
+
# :is_sync => false
|
|
26
31
|
# }
|
|
27
32
|
# creative_path = File.expand_path(File.dirname(__FILE__) + '/' + '250x250.gif')
|
|
28
33
|
# creative = @creatives.create(new_creative, creative_path)
|
|
@@ -60,7 +65,7 @@ describe "Creative API" do
|
|
|
60
65
|
:ad_type_id => $AdTypeId,
|
|
61
66
|
:is_active => $IsCreativeActive,
|
|
62
67
|
:alt => $Alt,
|
|
63
|
-
:is_deleted => $IsCreativeDeleted,
|
|
68
|
+
:is_deleted => $IsCreativeDeleted,
|
|
64
69
|
:is_sync => $IsSync,
|
|
65
70
|
:'isHTMLJS' => $isHTMLJS,
|
|
66
71
|
:script_body => $ScriptBody
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
|
3
3
|
describe "Creative Flight API" do
|
|
4
|
-
|
|
5
|
-
|
|
6
4
|
before(:all) do
|
|
7
5
|
client = Adzerk::Client.new(API_KEY)
|
|
8
6
|
@creative_maps = client.creative_maps
|
|
@@ -74,10 +72,20 @@ describe "Creative Flight API" do
|
|
|
74
72
|
@zone_id = zone[:id]
|
|
75
73
|
end
|
|
76
74
|
|
|
75
|
+
after(:all) do
|
|
76
|
+
@flights.delete(@flight_id)
|
|
77
|
+
@campaigns.delete(@campaign_id)
|
|
78
|
+
@advertisers.delete(@advertiser_id)
|
|
79
|
+
@priorities.delete(@priority_id)
|
|
80
|
+
@channels.delete(@channel_id)
|
|
81
|
+
@zones.delete(@zone_id)
|
|
82
|
+
@sites.delete(@site_id)
|
|
83
|
+
end
|
|
84
|
+
|
|
77
85
|
it "should create a creative map" do
|
|
78
86
|
|
|
79
87
|
$ImageName = "test.jpg"
|
|
80
|
-
|
|
88
|
+
|
|
81
89
|
$SizeOverride = false
|
|
82
90
|
$Iframe = false
|
|
83
91
|
$Impressions = 10000
|
|
@@ -86,7 +94,7 @@ describe "Creative Flight API" do
|
|
|
86
94
|
$IsMapActive = true
|
|
87
95
|
$IsMapDeleted = false
|
|
88
96
|
$CustomTargeting = '$keywords contains "bjork"'
|
|
89
|
-
|
|
97
|
+
|
|
90
98
|
$Title = 'Test creative ' + rand(1000000).to_s
|
|
91
99
|
$Url = "http://adzerk.com"
|
|
92
100
|
$Body = "Test text"
|
|
@@ -99,7 +107,7 @@ describe "Creative Flight API" do
|
|
|
99
107
|
$IsSync = false
|
|
100
108
|
|
|
101
109
|
$PublisherAccountId = 372
|
|
102
|
-
|
|
110
|
+
|
|
103
111
|
new_creative = {
|
|
104
112
|
:campaign_id => @campaign_id,
|
|
105
113
|
:flight_id => @flight_id,
|
|
@@ -189,7 +197,7 @@ describe "Creative Flight API" do
|
|
|
189
197
|
|
|
190
198
|
it "should get a specific creative map" do
|
|
191
199
|
creative_map = @creative_maps.get($map_id, @flight_id)
|
|
192
|
-
|
|
200
|
+
|
|
193
201
|
expect(creative_map[:campaign_id]).to eq(@campaign_id)
|
|
194
202
|
expect(creative_map[:flight_id]).to eq(@flight_id)
|
|
195
203
|
expect(creative_map[:impressions]).to eq($Impressions)
|
|
@@ -215,7 +223,7 @@ describe "Creative Flight API" do
|
|
|
215
223
|
end
|
|
216
224
|
|
|
217
225
|
it "should update a specific creative map" do
|
|
218
|
-
|
|
226
|
+
|
|
219
227
|
new_impressions = 1234
|
|
220
228
|
new_percentage = 51
|
|
221
229
|
new_is_active = false
|
|
@@ -238,7 +246,7 @@ describe "Creative Flight API" do
|
|
|
238
246
|
}
|
|
239
247
|
}
|
|
240
248
|
creative_map = @creative_maps.update(updated_creative)
|
|
241
|
-
|
|
249
|
+
|
|
242
250
|
#test new values
|
|
243
251
|
expect(creative_map[:percentage]).to eq(new_percentage)
|
|
244
252
|
expect(creative_map[:impressions]).to eq(new_impressions)
|
|
@@ -315,7 +323,7 @@ describe "Creative Flight API" do
|
|
|
315
323
|
expect(creative_map[:creative][:alt]).to eq new_alt
|
|
316
324
|
expect(creative_map[:creative][:is_sync]).to eq new_is_sync
|
|
317
325
|
expect(creative_map[:creative][:image_name]).to eq new_image_name
|
|
318
|
-
|
|
326
|
+
|
|
319
327
|
end
|
|
320
328
|
|
|
321
329
|
it "should delete the creatives after creating it" do
|
|
@@ -324,7 +332,7 @@ describe "Creative Flight API" do
|
|
|
324
332
|
end
|
|
325
333
|
|
|
326
334
|
it "should not get a map in a different network" do
|
|
327
|
-
expect{ @creative_maps.get(123, @flight_id) }.to raise_error "This
|
|
335
|
+
expect{ @creative_maps.get(123, @flight_id) }.to raise_error "This PassCreativeMap does not belong to your network."
|
|
328
336
|
end
|
|
329
337
|
|
|
330
338
|
it "should get a map that's been deleted" do
|
|
@@ -350,7 +358,7 @@ describe "Creative Flight API" do
|
|
|
350
358
|
:id => $creative_id
|
|
351
359
|
}
|
|
352
360
|
)
|
|
353
|
-
}.to raise_error "This
|
|
361
|
+
}.to raise_error "This Flight does not belong to your network."
|
|
354
362
|
end
|
|
355
363
|
|
|
356
364
|
it "should not update a map that's been deleted" do
|
data/test/flight_api_spec.rb
CHANGED
|
@@ -3,11 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
|
3
3
|
describe "Flight API" do
|
|
4
4
|
|
|
5
5
|
before(:all) do
|
|
6
|
-
new_advertiser = {
|
|
7
|
-
'Title' => "Test"
|
|
8
|
-
}
|
|
9
6
|
client = Adzerk::Client.new(API_KEY)
|
|
10
|
-
@flights= client.flights
|
|
7
|
+
@flights = client.flights
|
|
11
8
|
@advertisers = client.advertisers
|
|
12
9
|
@channels = client.channels
|
|
13
10
|
@campaigns = client.campaigns
|
|
@@ -40,7 +37,14 @@ describe "Flight API" do
|
|
|
40
37
|
:flights => [],
|
|
41
38
|
:is_deleted => false)
|
|
42
39
|
$campaign_id = campaign[:id]
|
|
40
|
+
end
|
|
43
41
|
|
|
42
|
+
after(:all) do
|
|
43
|
+
@flights.delete($flight_id_2)
|
|
44
|
+
@campaigns.delete($campaign_id)
|
|
45
|
+
@advertisers.delete($advertiserId)
|
|
46
|
+
@priorities.delete($priority_id)
|
|
47
|
+
@channels.delete($channel_id)
|
|
44
48
|
end
|
|
45
49
|
|
|
46
50
|
it "should create a flight" do
|
|
@@ -125,7 +129,9 @@ describe "Flight API" do
|
|
|
125
129
|
:is_deleted => $flight_IsDeleted
|
|
126
130
|
}
|
|
127
131
|
|
|
128
|
-
expect {
|
|
132
|
+
expect {
|
|
133
|
+
@flights.create flight_without_goal_type
|
|
134
|
+
}.to raise_error "Goal Type is a required field"
|
|
129
135
|
end
|
|
130
136
|
|
|
131
137
|
it "should list a specific flight" do
|
|
@@ -199,7 +205,7 @@ describe "Flight API" do
|
|
|
199
205
|
'GoalType' => $flight_GoalType
|
|
200
206
|
}
|
|
201
207
|
flight = @flights.create(new_flight)
|
|
202
|
-
$
|
|
208
|
+
$flight_id_2 = flight[:id].to_s
|
|
203
209
|
expect(flight[:no_end_date]).to eq(false)
|
|
204
210
|
expect(flight[:priority_id]).to eq($priority_id.to_i)
|
|
205
211
|
expect(flight[:name]).to eq($flight_Name)
|
|
@@ -224,8 +230,8 @@ describe "Flight API" do
|
|
|
224
230
|
end
|
|
225
231
|
|
|
226
232
|
it "should not create a flight for a campaign in a different network" do
|
|
227
|
-
expect{
|
|
228
|
-
|
|
233
|
+
expect {
|
|
234
|
+
@flights.create(
|
|
229
235
|
:no_end_date => false,
|
|
230
236
|
:priority_id => $priority_id,
|
|
231
237
|
:name => $flight_Name,
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
|
3
3
|
describe "GeoTargeting API" do
|
|
4
|
-
|
|
5
|
-
|
|
6
4
|
before(:all) do
|
|
7
|
-
new_advertiser = {
|
|
8
|
-
'Title' => "Test"
|
|
9
|
-
}
|
|
10
5
|
client = Adzerk::Client.new(API_KEY)
|
|
11
6
|
@flights= client.flights
|
|
12
7
|
@advertisers = client.advertisers
|
|
@@ -64,7 +59,14 @@ describe "GeoTargeting API" do
|
|
|
64
59
|
}
|
|
65
60
|
flight = @flights.create(new_flight)
|
|
66
61
|
$flight_id = flight[:id].to_s
|
|
62
|
+
end
|
|
67
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)
|
|
68
70
|
end
|
|
69
71
|
|
|
70
72
|
it "should create a geotargeting" do
|
|
@@ -79,7 +81,7 @@ describe "GeoTargeting API" do
|
|
|
79
81
|
:metro_code => $geo_MetroCode,
|
|
80
82
|
:is_exclude => true,
|
|
81
83
|
}
|
|
82
|
-
|
|
84
|
+
|
|
83
85
|
geo = @geotargetings.create($flight_id, new_geo)
|
|
84
86
|
expect(geo[:country_code]).to eq($geo_CountryCode)
|
|
85
87
|
expect(geo[:region]).to eq($geo_Region)
|
|
@@ -90,7 +92,7 @@ describe "GeoTargeting API" do
|
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
it "should retrieve a geotargeting" do
|
|
93
|
-
|
|
95
|
+
@geotargetings.get($flight_id,$geo_id)
|
|
94
96
|
end
|
|
95
97
|
|
|
96
98
|
it "should update a geotargeting" do
|
|
@@ -105,18 +107,20 @@ describe "GeoTargeting API" do
|
|
|
105
107
|
end
|
|
106
108
|
|
|
107
109
|
it "should delete a geotargeting" do
|
|
108
|
-
|
|
110
|
+
@geotargetings.delete($flight_id,$geo_id)
|
|
109
111
|
end
|
|
110
112
|
|
|
111
113
|
it "should error when deleting a geotargeting that does not exist" do
|
|
112
|
-
expect{
|
|
114
|
+
expect {
|
|
115
|
+
@geotargetings.delete($flight_id, 1)
|
|
116
|
+
}.to raise_error "Couldn't find network for model: PassLocation, id: 1"
|
|
113
117
|
end
|
|
114
118
|
|
|
115
119
|
it "should check if a flight is not a part of your network" do
|
|
116
120
|
non_network_flight = 123;
|
|
117
|
-
expect{ @geotargetings.delete(non_network_flight,1) }.to raise_error("Flight
|
|
118
|
-
expect{ @geotargetings.get(non_network_flight,1) }.to raise_error("Flight
|
|
119
|
-
expect{ @geotargetings.update(non_network_flight,1,{}) }.to raise_error("Flight
|
|
121
|
+
expect{ @geotargetings.delete(non_network_flight,1) }.to raise_error("This Flight does not belong to your network.")
|
|
122
|
+
expect{ @geotargetings.get(non_network_flight,1) }.to raise_error("This Flight does not belong to your network.")
|
|
123
|
+
expect{ @geotargetings.update(non_network_flight,1,{}) }.to raise_error("This Flight does not belong to your network.")
|
|
120
124
|
end
|
|
121
125
|
|
|
122
|
-
end
|
|
126
|
+
end
|
data/test/invitation_api_spec.rb
CHANGED
|
@@ -11,6 +11,11 @@ describe "Invitation API" do
|
|
|
11
11
|
@site_id = site[:id].to_s
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
after do
|
|
15
|
+
@client.advertisers.delete(@advertiser_id)
|
|
16
|
+
@client.sites.delete(@site_id)
|
|
17
|
+
end
|
|
18
|
+
|
|
14
19
|
it "should create a new publisher invitation" do
|
|
15
20
|
response = @client.invitations.invite_publisher(:email => 'test@adzerk.com',
|
|
16
21
|
:site_id => @site_id,
|
data/test/login_api_spec.rb
CHANGED
data/test/priority_api_spec.rb
CHANGED
|
@@ -4,8 +4,8 @@ describe "Priority API" do
|
|
|
4
4
|
|
|
5
5
|
before(:all) do
|
|
6
6
|
client = Adzerk::Client.new(API_KEY)
|
|
7
|
-
channels = client.channels
|
|
8
|
-
channel = channels.
|
|
7
|
+
@channels = client.channels
|
|
8
|
+
channel = @channels.
|
|
9
9
|
create(:title => 'Test Channel ' + rand(1000000).to_s,
|
|
10
10
|
:commission => '0',
|
|
11
11
|
:engine => 'CPM',
|
|
@@ -16,6 +16,10 @@ describe "Priority API" do
|
|
|
16
16
|
@priorities = client.priorities
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
after(:all) do
|
|
20
|
+
@channels.delete($channel_id)
|
|
21
|
+
end
|
|
22
|
+
|
|
19
23
|
it "should create a new priority" do
|
|
20
24
|
$priority_name = 'Test priority ' + rand(1000000).to_s
|
|
21
25
|
$priority_channel_id = $channel_id
|
data/test/report_api_spec.rb
CHANGED
|
@@ -16,11 +16,11 @@ describe "Report API" do
|
|
|
16
16
|
}
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
it "should create a report" do
|
|
20
|
-
report = @reports.create_report($new_report)
|
|
21
|
-
|
|
19
|
+
it "should create a report within 20 seconds" do
|
|
20
|
+
report = @reports.create_report($new_report, 20000)
|
|
21
|
+
expect(report.has_key? :report_id).to be true
|
|
22
22
|
expect(report[:is_total]).to be true
|
|
23
|
-
expect(report[:grouping]).to eq ["month"]
|
|
23
|
+
# expect(report[:grouping]).to eq ["month"]
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it "should create a queued report" do
|
|
@@ -44,12 +44,13 @@ describe "Report API" do
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it "should retrieve a queued report if available" do
|
|
47
|
-
# use $saved_report_id from 3 tests ago, wait a
|
|
48
|
-
|
|
47
|
+
# use $saved_report_id from 3 tests ago, wait a while to make sure the
|
|
48
|
+
# report is ready
|
|
49
|
+
sleep 10
|
|
49
50
|
response = @reports.retrieve_queued_report($saved_report_id)
|
|
50
51
|
expect(response[:status]).to eq 2
|
|
51
52
|
expect(response[:result][:is_total]).to be true
|
|
52
|
-
expect(response[:result][:grouping]).to eq ["month"]
|
|
53
|
+
# expect(response[:result][:grouping]).to eq ["month"]
|
|
53
54
|
end
|
|
54
55
|
end
|
|
55
56
|
|
data/test/site_api_spec.rb
CHANGED
|
@@ -9,10 +9,6 @@ describe "Site API" do
|
|
|
9
9
|
|
|
10
10
|
it "should create a new site" do
|
|
11
11
|
$site_title = 'Test Site ' + rand(1000000).to_s
|
|
12
|
-
new_site = {
|
|
13
|
-
'Title' => $site_title,
|
|
14
|
-
'Url' => @site_url
|
|
15
|
-
}
|
|
16
12
|
site = @client.sites.create(:title => $site_title, :url => @site_url)
|
|
17
13
|
$site_id = site[:id].to_s
|
|
18
14
|
expect($site_title).to eq(site[:title])
|
|
@@ -2,13 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
|
2
2
|
|
|
3
3
|
describe "SiteZoneTargeting API" do
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
before(:all) do
|
|
7
|
-
new_advertiser = {
|
|
8
|
-
'Title' => "Test"
|
|
9
|
-
}
|
|
10
6
|
client = Adzerk::Client.new(API_KEY)
|
|
11
|
-
@flights= client.flights
|
|
7
|
+
@flights = client.flights
|
|
12
8
|
@advertisers = client.advertisers
|
|
13
9
|
@channels = client.channels
|
|
14
10
|
@campaigns = client.campaigns
|
|
@@ -76,7 +72,16 @@ describe "SiteZoneTargeting API" do
|
|
|
76
72
|
:site_id => $site_id,
|
|
77
73
|
:is_deleted => false)
|
|
78
74
|
$zone_id = zone[:id].to_s
|
|
75
|
+
end
|
|
79
76
|
|
|
77
|
+
after(:all) do
|
|
78
|
+
@flights.delete($flight_id)
|
|
79
|
+
@campaigns.delete($campaign_id)
|
|
80
|
+
@advertisers.delete($advertiserId)
|
|
81
|
+
@zones.delete($zone_id)
|
|
82
|
+
@sites.delete($site_id)
|
|
83
|
+
@priorities.delete($priority_id)
|
|
84
|
+
@channels.delete($channel_id)
|
|
80
85
|
end
|
|
81
86
|
|
|
82
87
|
it "should create a sitezone targeting" do
|
|
@@ -89,7 +94,7 @@ describe "SiteZoneTargeting API" do
|
|
|
89
94
|
:zone_id => $sitezone_ZoneId,
|
|
90
95
|
:is_exclude => true,
|
|
91
96
|
}
|
|
92
|
-
|
|
97
|
+
|
|
93
98
|
sitezone = @sitezonetargeting.create($flight_id, new_sitezone)
|
|
94
99
|
expect(sitezone[:site_id]).to eq($sitezone_SiteId.to_i)
|
|
95
100
|
expect(sitezone[:zone_id]).to eq($sitezone_ZoneId.to_i)
|
|
@@ -121,13 +126,15 @@ describe "SiteZoneTargeting API" do
|
|
|
121
126
|
end
|
|
122
127
|
|
|
123
128
|
it "should error when deleting a sitezone targeting that does not exist" do
|
|
124
|
-
expect{
|
|
129
|
+
expect {
|
|
130
|
+
@sitezonetargeting.delete($flight_id,1)
|
|
131
|
+
}.to raise_error "Couldn't find network for model: PassSiteMap, id: 1"
|
|
125
132
|
end
|
|
126
133
|
|
|
127
134
|
it "should check if a flight is not a part of your network" do
|
|
128
135
|
non_network_flight = 123;
|
|
129
|
-
expect{ @sitezonetargeting.delete(non_network_flight,1) }.to raise_error("Flight
|
|
130
|
-
expect{ @sitezonetargeting.get(non_network_flight,1) }.to raise_error("Flight
|
|
136
|
+
expect{ @sitezonetargeting.delete(non_network_flight,1) }.to raise_error("This Flight does not belong to your network.")
|
|
137
|
+
expect{ @sitezonetargeting.get(non_network_flight,1) }.to raise_error("This Flight does not belong to your network.")
|
|
131
138
|
expect{ @sitezonetargeting.update(non_network_flight,1,{}) }.to raise_error("Flight is not a part of your network")
|
|
132
139
|
end
|
|
133
140
|
|
data/test/zone_api_spec.rb
CHANGED
metadata
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: adzerk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: '0.9'
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Kacy Fortner
|
|
@@ -18,12 +17,11 @@ authors:
|
|
|
18
17
|
autorequire:
|
|
19
18
|
bindir: bin
|
|
20
19
|
cert_chain: []
|
|
21
|
-
date: 2016-08
|
|
20
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
|
22
21
|
dependencies:
|
|
23
22
|
- !ruby/object:Gem::Dependency
|
|
24
23
|
name: rspec
|
|
25
24
|
requirement: !ruby/object:Gem::Requirement
|
|
26
|
-
none: false
|
|
27
25
|
requirements:
|
|
28
26
|
- - '='
|
|
29
27
|
- !ruby/object:Gem::Version
|
|
@@ -31,7 +29,6 @@ dependencies:
|
|
|
31
29
|
type: :development
|
|
32
30
|
prerelease: false
|
|
33
31
|
version_requirements: !ruby/object:Gem::Requirement
|
|
34
|
-
none: false
|
|
35
32
|
requirements:
|
|
36
33
|
- - '='
|
|
37
34
|
- !ruby/object:Gem::Version
|
|
@@ -39,23 +36,20 @@ dependencies:
|
|
|
39
36
|
- !ruby/object:Gem::Dependency
|
|
40
37
|
name: json
|
|
41
38
|
requirement: !ruby/object:Gem::Requirement
|
|
42
|
-
none: false
|
|
43
39
|
requirements:
|
|
44
|
-
- -
|
|
40
|
+
- - '>='
|
|
45
41
|
- !ruby/object:Gem::Version
|
|
46
42
|
version: 1.7.7
|
|
47
43
|
type: :runtime
|
|
48
44
|
prerelease: false
|
|
49
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
none: false
|
|
51
46
|
requirements:
|
|
52
|
-
- -
|
|
47
|
+
- - '>='
|
|
53
48
|
- !ruby/object:Gem::Version
|
|
54
49
|
version: 1.7.7
|
|
55
50
|
- !ruby/object:Gem::Dependency
|
|
56
51
|
name: rest-client
|
|
57
52
|
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
none: false
|
|
59
53
|
requirements:
|
|
60
54
|
- - '='
|
|
61
55
|
- !ruby/object:Gem::Version
|
|
@@ -63,7 +57,6 @@ dependencies:
|
|
|
63
57
|
type: :runtime
|
|
64
58
|
prerelease: false
|
|
65
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
-
none: false
|
|
67
60
|
requirements:
|
|
68
61
|
- - '='
|
|
69
62
|
- !ruby/object:Gem::Version
|
|
@@ -71,17 +64,15 @@ dependencies:
|
|
|
71
64
|
- !ruby/object:Gem::Dependency
|
|
72
65
|
name: activesupport
|
|
73
66
|
requirement: !ruby/object:Gem::Requirement
|
|
74
|
-
none: false
|
|
75
67
|
requirements:
|
|
76
|
-
- -
|
|
68
|
+
- - '>='
|
|
77
69
|
- !ruby/object:Gem::Version
|
|
78
70
|
version: 3.2.8
|
|
79
71
|
type: :runtime
|
|
80
72
|
prerelease: false
|
|
81
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
-
none: false
|
|
83
74
|
requirements:
|
|
84
|
-
- -
|
|
75
|
+
- - '>='
|
|
85
76
|
- !ruby/object:Gem::Version
|
|
86
77
|
version: 3.2.8
|
|
87
78
|
description: Ruby library for the Adzerk API
|
|
@@ -91,67 +82,66 @@ extensions: []
|
|
|
91
82
|
extra_rdoc_files: []
|
|
92
83
|
files:
|
|
93
84
|
- lib/adzerk.rb
|
|
85
|
+
- lib/adzerk/advertiser.rb
|
|
86
|
+
- lib/adzerk/api_endpoint.rb
|
|
94
87
|
- lib/adzerk/category.rb
|
|
88
|
+
- lib/adzerk/channel_site_map.rb
|
|
95
89
|
- lib/adzerk/client.rb
|
|
96
90
|
- lib/adzerk/creative.rb
|
|
97
|
-
- lib/adzerk/
|
|
98
|
-
- lib/adzerk/channel_site_map.rb
|
|
99
|
-
- lib/adzerk/version.rb
|
|
100
|
-
- lib/adzerk/priority.rb
|
|
91
|
+
- lib/adzerk/creative_map.rb
|
|
101
92
|
- lib/adzerk/errors.rb
|
|
102
|
-
- lib/adzerk/api_endpoint.rb
|
|
103
93
|
- lib/adzerk/flight.rb
|
|
104
|
-
- lib/adzerk/creative_map.rb
|
|
105
|
-
- lib/adzerk/publisher.rb
|
|
106
|
-
- lib/adzerk/advertiser.rb
|
|
107
94
|
- lib/adzerk/geo_targeting.rb
|
|
108
95
|
- lib/adzerk/invitation.rb
|
|
109
|
-
- lib/adzerk/
|
|
96
|
+
- lib/adzerk/priority.rb
|
|
97
|
+
- lib/adzerk/publisher.rb
|
|
110
98
|
- lib/adzerk/reporting.rb
|
|
99
|
+
- lib/adzerk/site_zone_targeting.rb
|
|
100
|
+
- lib/adzerk/util.rb
|
|
101
|
+
- lib/adzerk/version.rb
|
|
102
|
+
- test/adtype_api_spec.rb
|
|
103
|
+
- test/advertiser_api_spec.rb
|
|
104
|
+
- test/campaign_api_spec.rb
|
|
111
105
|
- test/category_api_spec.rb
|
|
112
|
-
- test/
|
|
113
|
-
- test/site_zone_targeting_api_spec.rb
|
|
106
|
+
- test/channel_api_spec.rb
|
|
114
107
|
- test/channel_site_map_api_spec.rb
|
|
115
|
-
- test/site_api_spec.rb
|
|
116
108
|
- test/creative_api_spec.rb
|
|
117
|
-
- test/
|
|
118
|
-
- test/security_api_spec.rb
|
|
109
|
+
- test/creative_map_api_spec.rb
|
|
119
110
|
- test/flight_api_spec.rb
|
|
120
111
|
- test/geo_targeting_api_spec.rb
|
|
121
|
-
- test/
|
|
122
|
-
- test/adtype_api_spec.rb
|
|
123
|
-
- test/channel_api_spec.rb
|
|
124
|
-
- test/creative_map_api_spec.rb
|
|
125
|
-
- test/util_spec.rb
|
|
112
|
+
- test/invitation_api_spec.rb
|
|
126
113
|
- test/login_api_spec.rb
|
|
114
|
+
- test/priority_api_spec.rb
|
|
127
115
|
- test/publisher_api_spec.rb
|
|
128
|
-
- test/zone_api_spec.rb
|
|
129
|
-
- test/invitation_api_spec.rb
|
|
130
|
-
- test/advertiser_api_spec.rb
|
|
131
|
-
- test/spec_helper.rb
|
|
132
116
|
- test/rakefile.rb
|
|
117
|
+
- test/report_api_spec.rb
|
|
118
|
+
- test/security_api_spec.rb
|
|
119
|
+
- test/site_api_spec.rb
|
|
120
|
+
- test/site_zone_targeting_api_spec.rb
|
|
121
|
+
- test/spec_helper.rb
|
|
122
|
+
- test/util_spec.rb
|
|
123
|
+
- test/zone_api_spec.rb
|
|
133
124
|
homepage: http://adzerk.com
|
|
134
125
|
licenses: []
|
|
126
|
+
metadata: {}
|
|
135
127
|
post_install_message:
|
|
136
128
|
rdoc_options: []
|
|
137
129
|
require_paths:
|
|
138
130
|
- lib
|
|
139
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
|
-
none: false
|
|
141
132
|
requirements:
|
|
142
|
-
- -
|
|
133
|
+
- - '>='
|
|
143
134
|
- !ruby/object:Gem::Version
|
|
144
135
|
version: '0'
|
|
145
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
|
-
none: false
|
|
147
137
|
requirements:
|
|
148
|
-
- -
|
|
138
|
+
- - '>='
|
|
149
139
|
- !ruby/object:Gem::Version
|
|
150
140
|
version: '0'
|
|
151
141
|
requirements: []
|
|
152
142
|
rubyforge_project:
|
|
153
|
-
rubygems_version:
|
|
143
|
+
rubygems_version: 2.4.6
|
|
154
144
|
signing_key:
|
|
155
|
-
specification_version:
|
|
145
|
+
specification_version: 4
|
|
156
146
|
summary: Adzerk API
|
|
157
147
|
test_files: []
|