adzerk 0.1.4 → 0.2
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.
- data/lib/adzerk.rb +15 -0
- data/lib/adzerk/advertiser.rb +9 -0
- data/lib/adzerk/api_endpoint.rb +41 -0
- data/lib/adzerk/channel_site_map.rb +53 -0
- data/lib/adzerk/client.rb +80 -0
- data/lib/adzerk/creative.rb +17 -0
- data/lib/adzerk/creative_map.rb +38 -0
- data/lib/adzerk/flight.rb +12 -0
- data/lib/adzerk/invitation.rb +23 -0
- data/lib/adzerk/publisher.rb +17 -0
- data/lib/adzerk/reporting.rb +21 -0
- data/lib/adzerk/util.rb +37 -0
- data/lib/adzerk/version.rb +3 -0
- data/test/advertiser_api_spec.rb +57 -82
- data/test/campaign_api_spec.rb +150 -271
- data/test/channel_api_spec.rb +72 -79
- data/test/channel_site_map_api_spec.rb +43 -94
- data/test/creative_api_spec.rb +82 -251
- data/test/creative_map_api_spec.rb +291 -375
- data/test/flight_api_spec.rb +165 -493
- data/test/invitation_api_spec.rb +18 -41
- data/test/login_api_spec.rb +24 -49
- data/test/priority_api_spec.rb +53 -83
- data/test/publisher_api_spec.rb +71 -142
- data/test/rakefile.rb +7 -7
- data/test/report_api_spec.rb +18 -24
- data/test/security_api_spec.rb +21 -0
- data/test/site_api_spec.rb +37 -51
- data/test/spec_helper.rb +4 -17
- data/test/zone_api_spec.rb +38 -64
- metadata +61 -23
- data/lib/Adzerk.rb +0 -55
- data/lib/adzerk/Advertiser.rb +0 -39
- data/lib/adzerk/Campaign.rb +0 -33
- data/lib/adzerk/Channel.rb +0 -33
- data/lib/adzerk/ChannelSiteMap.rb +0 -44
- data/lib/adzerk/Creative.rb +0 -43
- data/lib/adzerk/CreativeMap.rb +0 -33
- data/lib/adzerk/Flight.rb +0 -44
- data/lib/adzerk/Invitation.rb +0 -17
- data/lib/adzerk/Login.rb +0 -28
- data/lib/adzerk/Priority.rb +0 -34
- data/lib/adzerk/Publisher.rb +0 -47
- data/lib/adzerk/Reporting.rb +0 -16
- data/lib/adzerk/Site.rb +0 -35
- data/lib/adzerk/Zone.rb +0 -35
- data/test/channel_api_security_spec.rb +0 -51
- data/test/csv_export_spec.rb +0 -89
- data/test/delivery-test.rb +0 -132
- data/test/test.rb +0 -43
- data/test/test2.rb +0 -175
@@ -1,97 +1,79 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Creative Flight API" do
|
4
|
-
|
5
|
-
|
6
|
-
@@map = $adzerk::CreativeMap.new
|
7
|
-
@@creative = $adzerk::Creative.new
|
8
|
-
@@advertiser = $adzerk::Advertiser.new
|
9
|
-
@@channel = $adzerk::Channel.new
|
10
|
-
@@campaign = $adzerk::Campaign.new
|
11
|
-
@@site = $adzerk::Site.new
|
12
|
-
@@flight = $adzerk::Flight.new
|
13
|
-
@@priority = $adzerk::Priority.new
|
14
|
-
@@zone = $adzerk::Zone.new
|
15
|
-
|
4
|
+
|
5
|
+
|
16
6
|
before(:all) do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
'Engine' => 'CPM',
|
27
|
-
'Keywords' => 'test',
|
28
|
-
'CPM' => '10.00',
|
29
|
-
'AdTypes' => [1,2,3,4]
|
30
|
-
}
|
31
|
-
response = @@channel.create(new_channel)
|
32
|
-
$channelId = JSON.parse(response.body)["Id"]
|
7
|
+
client = Adzerk::Client.new(API_KEY)
|
8
|
+
@creative_maps = client.creative_maps
|
9
|
+
@advertisers = client.advertisers
|
10
|
+
@channels = client.channels
|
11
|
+
@campaigns = client.campaigns
|
12
|
+
@sites = client.sites
|
13
|
+
@flights = client.flights
|
14
|
+
@priorities = client.priorities
|
15
|
+
@zones = client.zones
|
33
16
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
'
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
'Url' => 'http://www.adzerk.com'
|
81
|
-
}
|
82
|
-
response = @@site.create(new_site)
|
83
|
-
$siteId = JSON.parse(response.body)["Id"]
|
84
|
-
|
85
|
-
new_zone = {
|
86
|
-
'Name' => 'Test Zone ' + rand(10000000).to_s,
|
87
|
-
'SiteId' => $siteId,
|
17
|
+
advertiser = @advertisers.create(:title => "test")
|
18
|
+
@advertiser_id = advertiser[:id].to_s
|
19
|
+
|
20
|
+
channel = @channels.create(:title => 'Test Channel ' + rand(1000000).to_s,
|
21
|
+
:commission => '0.0',
|
22
|
+
:engine => 'CPM',
|
23
|
+
:keywords => 'test',
|
24
|
+
'CPM' => '10.00',
|
25
|
+
:ad_types => [1,2,3,4])
|
26
|
+
@channel_id = channel[:id].to_s
|
27
|
+
|
28
|
+
priority = @priorities.create(:name => "High Priority Test",
|
29
|
+
:channel_id => @channel_id,
|
30
|
+
:weight => 1,
|
31
|
+
:is_deleted => false)
|
32
|
+
@priority_id = priority[:id].to_s
|
33
|
+
|
34
|
+
campaign = @campaigns.
|
35
|
+
create(:name => 'Test campaign ' + rand(1000000).to_s,
|
36
|
+
:start_date => "1/1/2011",
|
37
|
+
:end_date => "12/31/2011",
|
38
|
+
:is_active => false,
|
39
|
+
:price => '10.00',
|
40
|
+
:advertiser_id => @advertiser_id,
|
41
|
+
:flights => [],
|
42
|
+
:is_deleted => false)
|
43
|
+
@campaign_id = campaign[:id]
|
44
|
+
|
45
|
+
new_flight = {
|
46
|
+
:no_end_date => false,
|
47
|
+
:priority_id => @priority_id,
|
48
|
+
:name => 'Test flight ' + rand(1000000).to_s,
|
49
|
+
:start_date => "1/1/2011",
|
50
|
+
:endDate => "12/31/2011",
|
51
|
+
:noEndDate => false,
|
52
|
+
:price => '15.00',
|
53
|
+
:option_type => 1,
|
54
|
+
:impressions => 10000,
|
55
|
+
:is_unlimited => false,
|
56
|
+
:is_full_speed => false,
|
57
|
+
:keywords => "test, test2",
|
58
|
+
:user_agent_keywords => nil,
|
59
|
+
:weight_override => nil,
|
60
|
+
:campaign_id => @campaign_id,
|
61
|
+
:is_active => true,
|
62
|
+
:is_deleted => false
|
88
63
|
}
|
89
|
-
|
90
|
-
|
64
|
+
flight = @flights.create(new_flight)
|
65
|
+
@flight_id = flight[:id]
|
91
66
|
|
67
|
+
site = @sites.create(:title => 'Test Site ' + rand(1000000).to_s,
|
68
|
+
:url => 'http://www.adzerk.com')
|
69
|
+
@site_id = site[:id]
|
70
|
+
|
71
|
+
zone = @zones.create(:name => 'Test Zone ' + rand(10000000).to_s,
|
72
|
+
:site_id => @site_id)
|
73
|
+
@zone_id = zone[:id]
|
92
74
|
end
|
93
|
-
|
94
|
-
it "should create a creative" do
|
75
|
+
|
76
|
+
it "should create a creative map" do
|
95
77
|
$Title = 'Test creative ' + rand(1000000).to_s
|
96
78
|
$ImageName = "test.jpg"
|
97
79
|
$Url = "http://adzerk.com"
|
@@ -106,332 +88,266 @@ describe "Creative Flight API" do
|
|
106
88
|
$SizeOverride = false
|
107
89
|
$Iframe = false
|
108
90
|
$PublisherAccountId = 372
|
109
|
-
$ScriptBody = '<html>'
|
91
|
+
$ScriptBody = '<html>'
|
110
92
|
$Impressions = 100000
|
111
93
|
$Percentage = 50
|
112
|
-
$DistributionType = 1
|
94
|
+
$DistributionType = 1
|
113
95
|
$IsHTMLJS = true
|
114
96
|
$IsActive = true
|
115
97
|
$Alt = "test alt"
|
116
98
|
$IsDeleted = false
|
117
99
|
$IsSync = false
|
118
|
-
|
100
|
+
|
119
101
|
new_creative = {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
'
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
'IsSync' => $IsSync
|
102
|
+
:campaign_id => @campaign_id,
|
103
|
+
:flight_id => @flight_id,
|
104
|
+
:size_override => false,
|
105
|
+
:iframe => false,
|
106
|
+
:impressions => 100000,
|
107
|
+
:percentage => 50,
|
108
|
+
:siteId => @site_id,
|
109
|
+
:zoneId => @zone_id,
|
110
|
+
:distributionType => 1,
|
111
|
+
:isActive => true,
|
112
|
+
:isDeleted => false,
|
113
|
+
:creative => {
|
114
|
+
:title => "Creative Title",
|
115
|
+
:url => "http://www.adzerk.com",
|
116
|
+
:body => "Test Body",
|
117
|
+
:advertiser_id => @advertiser_id,
|
118
|
+
:ad_type_id => 18,
|
119
|
+
'IsHTMLJS' => true,
|
120
|
+
:script_body => "<html></html>",
|
121
|
+
:is_active => true,
|
122
|
+
:alt => "alt text",
|
123
|
+
:is_deleted => false,
|
124
|
+
:is_sync => false
|
144
125
|
}
|
145
126
|
}
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
JSON.parse(response.body)["ZoneId"].should == $zoneId
|
157
|
-
JSON.parse(response.body)["SiteId"].should == $siteId
|
158
|
-
JSON.parse(response.body)["SizeOverride"].should == $SizeOverride
|
159
|
-
JSON.parse(response.body)["PublisherAccountId"].should == $PublisherAccountId
|
160
|
-
JSON.parse(response.body)["Impressions"].should == $Impressions
|
161
|
-
JSON.parse(response.body)["Percentage"].should == $Percentage
|
162
|
-
JSON.parse(response.body)["DistributionType"].should == $DistributionType
|
163
|
-
JSON.parse(response.body)["Creative"]["IsHTMLJS"].should == $IsHTMLJS
|
164
|
-
JSON.parse(response.body)["Creative"]["ScriptBody"].should == $ScriptBody
|
165
|
-
JSON.parse(response.body)["Creative"]["IsActive"].should == $IsActive
|
166
|
-
JSON.parse(response.body)["Creative"]["Alt"].should == $Alt
|
167
|
-
JSON.parse(response.body)["IsDeleted"].should == $IsDeleted
|
168
|
-
JSON.parse(response.body)["Creative"]["IsSync"].should == $IsSync
|
169
|
-
$creative_id_id = JSON.parse(response.body)["Creative"]["Id"]
|
170
|
-
end
|
171
|
-
|
172
|
-
it "should list all creatives for a flight" do
|
173
|
-
response = @@map.list($FlightId)
|
174
|
-
entry = response["Items"].last.to_json
|
175
|
-
$map_id = JSON.parse(entry)["Id"]
|
176
|
-
JSON.parse(entry)["Creative"]["Title"].should == $Title
|
177
|
-
JSON.parse(entry)["Creative"]["Url"].should == $Url
|
178
|
-
JSON.parse(entry)["Creative"]["Body"].should == $Body
|
179
|
-
JSON.parse(entry)["Creative"]["AdvertiserId"].should == $AdvertiserId
|
180
|
-
JSON.parse(entry)["CampaignId"].should == $CampaignId
|
181
|
-
JSON.parse(entry)["FlightId"].should == $FlightId
|
182
|
-
JSON.parse(entry)["Creative"]["AdTypeId"].should == $AdTypeId
|
183
|
-
JSON.parse(entry)["ZoneId"].should == $ZoneId
|
184
|
-
JSON.parse(entry)["SiteId"].should == $SiteId
|
185
|
-
#JSON.parse(entry)["SizeOverride"].should == $SizeOverride
|
186
|
-
#JSON.parse(entry)["PublisherAccountId"].should == $PublisherAccountId
|
187
|
-
#JSON.parse(entry)["Impressions"].should == $Impressions
|
188
|
-
JSON.parse(entry)["Percentage"].should == $Percentage
|
189
|
-
JSON.parse(entry)["DistributionType"].should == $DistributionType
|
190
|
-
JSON.parse(entry)["Creative"]["IsHTMLJS"].should == $IsHTMLJS
|
191
|
-
JSON.parse(entry)["Creative"]["ScriptBody"].should == $ScriptBody
|
192
|
-
JSON.parse(entry)["Creative"]["IsActive"].should == $IsActive
|
193
|
-
JSON.parse(entry)["Creative"]["Alt"].should == $Alt
|
194
|
-
JSON.parse(entry)["IsDeleted"].should == $IsDeleted
|
195
|
-
JSON.parse(entry)["Creative"]["IsSync"].should == $IsSync
|
127
|
+
creative_map = @creative_maps.create(new_creative)
|
128
|
+
creative_map[:creative][:title].should eq("Creative Title")
|
129
|
+
creative_map[:creative][:url].should eq("http://www.adzerk.com")
|
130
|
+
creative_map[:campaign_id].should eq(@campaign_id)
|
131
|
+
creative_map[:flight_id].should eq(@flight_id)
|
132
|
+
creative_map[:zone_id].should eq(@zone_id)
|
133
|
+
creative_map[:site_id].should eq(@site_id)
|
134
|
+
creative_map[:creative][:is_htmljs]
|
135
|
+
creative_map[:creative][:script_body].should eq("<html></html>")
|
136
|
+
$creative_id_id = creative_map[:creative][:id]
|
196
137
|
end
|
197
|
-
|
198
|
-
it "should
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
#JSON.parse(response.body)["SizeOverride"].should == $SizeOverride
|
211
|
-
#JSON.parse(response.body)["PublisherAccountId"].should == $PublisherAccountId
|
212
|
-
#JSON.parse(response.body)["Impressions"].should == $Impressions
|
213
|
-
JSON.parse(response.body)["Creative"]["IsHTMLJS"].should == $IsHTMLJS
|
214
|
-
JSON.parse(response.body)["Creative"]["ScriptBody"].should == $ScriptBody
|
215
|
-
JSON.parse(response.body)["Percentage"].should == $Percentage
|
216
|
-
JSON.parse(response.body)["DistributionType"].should == $DistributionType
|
217
|
-
JSON.parse(response.body)["Creative"]["IsActive"].should == $IsActive
|
218
|
-
JSON.parse(response.body)["Creative"]["Alt"].should == $Alt
|
219
|
-
JSON.parse(response.body)["IsDeleted"].should == $IsDeleted
|
220
|
-
JSON.parse(response.body)["Creative"]["IsSync"].should == $IsSync
|
221
|
-
@@creativeId = JSON.parse(response.body)["Creative"]["Id"]
|
138
|
+
|
139
|
+
it "should list all creatives maps for a flight" do
|
140
|
+
creative_maps = @creative_maps.list(@flight_id)
|
141
|
+
creative_map = creative_maps[:items].last
|
142
|
+
$map_id= creative_map[:id]
|
143
|
+
creative_map[:creative][:title].should eq("Creative Title")
|
144
|
+
creative_map[:creative][:url].should eq("http://www.adzerk.com")
|
145
|
+
creative_map[:campaign_id].should eq(@campaign_id)
|
146
|
+
creative_map[:flight_id].should eq(@flight_id)
|
147
|
+
creative_map[:zone_id].should eq(@zone_id)
|
148
|
+
creative_map[:site_id].should eq(@site_id)
|
149
|
+
creative_map[:creative][:is_htmljs]
|
150
|
+
creative_map[:creative][:script_body].should eq("<html></html>")
|
222
151
|
end
|
223
|
-
|
152
|
+
|
153
|
+
it "should get a specific creative map" do
|
154
|
+
creative_map = @creative_maps.get($map_id, @flight_id)
|
155
|
+
creative_map[:creative][:title].should eq("Creative Title")
|
156
|
+
creative_map[:creative][:url].should eq("http://www.adzerk.com")
|
157
|
+
creative_map[:campaign_id].should eq(@campaign_id)
|
158
|
+
creative_map[:flight_id].should eq(@flight_id)
|
159
|
+
creative_map[:zone_id].should eq(@zone_id)
|
160
|
+
creative_map[:site_id].should eq(@site_id)
|
161
|
+
creative_map[:creative][:is_htmljs]
|
162
|
+
creative_map[:creative][:script_body].should eq("<html></html>")
|
163
|
+
end
|
164
|
+
|
224
165
|
it "should update a specific creative" do
|
225
166
|
updated_creative = {
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
'Id' => @@creativeId
|
167
|
+
:id => $map_id,
|
168
|
+
:campaign_id => @campaign_id,
|
169
|
+
:flight_id => @flight_id,
|
170
|
+
:size_override => false,
|
171
|
+
:iframe => false,
|
172
|
+
:impressions => 200000,
|
173
|
+
:percentage => 50,
|
174
|
+
:site_id => @site_id,
|
175
|
+
:zone_id => @zone_id,
|
176
|
+
:is_active => true,
|
177
|
+
:is_deleted => false,
|
178
|
+
:creative => {
|
179
|
+
:id => $creative_id_id
|
240
180
|
}
|
241
181
|
}
|
242
|
-
|
243
|
-
|
244
|
-
JSON.parse(response.body)["Creative"]["Title"].should == $Title
|
245
|
-
JSON.parse(response.body)["Creative"]["Url"].should == $Url
|
246
|
-
JSON.parse(response.body)["Creative"]["Body"].should == $Body
|
247
|
-
JSON.parse(response.body)["Creative"]["AdvertiserId"].should == $AdvertiserId
|
248
|
-
JSON.parse(response.body)["CampaignId"].should == $CampaignId
|
249
|
-
JSON.parse(response.body)["FlightId"].should == $FlightId
|
250
|
-
JSON.parse(response.body)["Creative"]["AdTypeId"].should == $AdTypeId
|
251
|
-
JSON.parse(response.body)["ZoneId"].should == $zoneId
|
252
|
-
JSON.parse(response.body)["SiteId"].should == $SiteId
|
253
|
-
JSON.parse(response.body)["SizeOverride"].should == $SizeOverride
|
254
|
-
JSON.parse(response.body)["PublisherAccountId"].should == $PublisherAccountId
|
255
|
-
JSON.parse(response.body)["Impressions"].should == $Impressions + 100
|
256
|
-
JSON.parse(response.body)["Percentage"].should == $Percentage
|
257
|
-
JSON.parse(response.body)["Creative"]["IsActive"].should == $IsActive
|
258
|
-
JSON.parse(response.body)["Creative"]["Alt"].should == $Alt
|
259
|
-
JSON.parse(response.body)["IsDeleted"].should == $IsDeleted
|
260
|
-
JSON.parse(response.body)["Creative"]["IsSync"].should == $IsSync
|
182
|
+
creative_map = @creative_maps.update(updated_creative)
|
183
|
+
creative_map[:impressions].should eq(200000)
|
261
184
|
end
|
262
185
|
|
263
186
|
it "should update the scriptBody tag on a nested creative" do
|
264
187
|
updated_creative = {
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
'IsHTMLJS' => true,
|
280
|
-
'ScriptBody' => '<html></html>',
|
281
|
-
'Title' => 'test'
|
188
|
+
:id => $map_id,
|
189
|
+
:campaign_id => @campaign_id,
|
190
|
+
:flight_id => @flight_id,
|
191
|
+
:size_override => false,
|
192
|
+
:iframe => false,
|
193
|
+
:impressions => 200000,
|
194
|
+
:percentage => 50,
|
195
|
+
:site_id => @site_id,
|
196
|
+
:zone_id => @zone_id,
|
197
|
+
:is_active => true,
|
198
|
+
:is_deleted => false,
|
199
|
+
:creative => {
|
200
|
+
:id => $creative_id_id,
|
201
|
+
:script_body => '<html>New Body</html>',
|
282
202
|
}
|
283
203
|
}
|
284
|
-
|
285
|
-
|
204
|
+
creative_map = @creative_maps.update(updated_creative)
|
205
|
+
creative_map[:creative][:script_body].should eq('<html>New Body</html>')
|
286
206
|
end
|
287
|
-
|
207
|
+
|
288
208
|
it "should delete the creatives after creating it" do
|
289
|
-
response =
|
290
|
-
response.body.should == "
|
209
|
+
response = @creative_maps.delete($map_id, @flight_id)
|
210
|
+
response.body.should == "\"This creative map has been deleted\""
|
291
211
|
end
|
292
|
-
|
293
|
-
it "should not
|
294
|
-
|
295
|
-
|
296
|
-
'FlightId' => $FlightId,
|
297
|
-
'SizeOverride' => $SizeOverride,
|
298
|
-
'Iframe' => $Iframe,
|
299
|
-
'PublisherAccountId' => $PublisherAccountId,
|
300
|
-
'Impressions' => $Impressions,
|
301
|
-
'SiteId' => $SiteId,
|
302
|
-
'Percentage' => $Percentage,
|
303
|
-
'IsActive' => $IsActive,
|
304
|
-
'IsDeleted' => $IsDeleted
|
305
|
-
}
|
306
|
-
response = @@map.create(map)
|
307
|
-
response.body.scan(/This campaign is not part/).should_not == []
|
212
|
+
|
213
|
+
it "should not get a map in a different network" do
|
214
|
+
creative_map = @creative_maps.get(123, @flight_id)
|
215
|
+
creative_map[:message].should == "This flight is not part of your network"
|
308
216
|
end
|
309
|
-
|
310
|
-
it "should not
|
311
|
-
|
312
|
-
|
313
|
-
'FlightId' => '123',
|
314
|
-
'SizeOverride' => $SizeOverride,
|
315
|
-
'Iframe' => $Iframe,
|
316
|
-
'PublisherAccountId' => $PublisherAccountId,
|
317
|
-
'Impressions' => $Impressions,
|
318
|
-
'SiteId' => $SiteId,
|
319
|
-
'Percentage' => $Percentage,
|
320
|
-
'IsActive' => $IsActive,
|
321
|
-
'IsDeleted' => $IsDeleted
|
322
|
-
}
|
323
|
-
response = @@map.create(map)
|
324
|
-
response.body.scan(/This flight is not part/).should_not == []
|
217
|
+
|
218
|
+
it "should not get a map that's been deleted" do
|
219
|
+
creative_map = @creative_maps.get($map_id, @flight_id)
|
220
|
+
creative_map[:message].should == "This creative map has been deleted"
|
325
221
|
end
|
326
|
-
|
327
|
-
it "should
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
222
|
+
|
223
|
+
it "should not update a map that's in a different network" do
|
224
|
+
creative_map = @creative_maps.update(
|
225
|
+
:id => $map_id,
|
226
|
+
:campaign_id => @campaign_id,
|
227
|
+
:flight_id => 123,
|
228
|
+
:size_override => false,
|
229
|
+
:iframe => false,
|
230
|
+
:impressions => 200000,
|
231
|
+
:percentage => 50,
|
232
|
+
:site_id => @site_id,
|
233
|
+
:zone_id => @zone_id,
|
234
|
+
:is_active => true,
|
235
|
+
:is_deleted => false,
|
236
|
+
:creative => {
|
237
|
+
:id => $creative_id_id
|
341
238
|
}
|
342
|
-
|
343
|
-
|
344
|
-
response.body.scan(/Exception/).should == []
|
239
|
+
)
|
240
|
+
creative_map[:message].should == "This flight is not part of your network"
|
345
241
|
end
|
346
242
|
|
347
|
-
it "should not
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
243
|
+
it "should not update a map that's been deleted" do
|
244
|
+
creative_map = @creative_maps.update(
|
245
|
+
:id => $map_id,
|
246
|
+
:campaign_id => @campaign_id,
|
247
|
+
:flight_id => @flight_id,
|
248
|
+
:size_override => false,
|
249
|
+
:iframe => false,
|
250
|
+
:impressions => 200000,
|
251
|
+
:percentage => 50,
|
252
|
+
:site_id => @site_id,
|
253
|
+
:zone_id => @zone_id,
|
254
|
+
:is_active => true,
|
255
|
+
:is_deleted => false,
|
256
|
+
:creative => {
|
257
|
+
:id => $creative_id_id
|
361
258
|
}
|
362
|
-
|
363
|
-
|
364
|
-
response.body.scan(/That creative belongs to an advertiser/).should_not == []
|
259
|
+
)
|
260
|
+
creative_map[:message].should == "This creative map has been deleted"
|
365
261
|
end
|
366
262
|
|
367
|
-
it "should
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
'
|
387
|
-
|
388
|
-
|
389
|
-
|
263
|
+
it "should fail when creating a map for a campaign in a different network" do
|
264
|
+
creative_map = @creative_maps.create(
|
265
|
+
:campaign_id => 123,
|
266
|
+
:flight_id => @flight_id,
|
267
|
+
:size_override => false,
|
268
|
+
:iframe => false,
|
269
|
+
:impressions => 100000,
|
270
|
+
:percentage => 50,
|
271
|
+
:siteId => @site_id,
|
272
|
+
:zoneId => @zone_id,
|
273
|
+
:distributionType => 1,
|
274
|
+
:isActive => true,
|
275
|
+
:isDeleted => false,
|
276
|
+
:creative => {
|
277
|
+
:title => "Creative Title",
|
278
|
+
:url => "http://www.adzerk.com",
|
279
|
+
:body => "Test Body",
|
280
|
+
:advertiser_id => @advertiser_id,
|
281
|
+
:ad_type_id => 18,
|
282
|
+
'IsHTMLJS' => true,
|
283
|
+
:script_body => "<html></html>",
|
284
|
+
:is_active => true,
|
285
|
+
:alt => "alt text",
|
286
|
+
:is_deleted => false,
|
287
|
+
:is_sync => false
|
390
288
|
}
|
391
|
-
|
392
|
-
|
393
|
-
response.body.scan(/This site does not belong to your network/).should_not == []
|
289
|
+
)
|
290
|
+
creative_map[:message].should == "This campaign is not part of your network"
|
394
291
|
end
|
395
292
|
|
396
|
-
it "should
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
'PublisherAccountId' => $PublisherAccountId,
|
422
|
-
'Impressions' => $Impressions,
|
423
|
-
'Percentage' => $Percentage,
|
424
|
-
'SiteId' => $siteId,
|
425
|
-
'IsActive' => $IsActive,
|
426
|
-
'IsDeleted' => $IsDeleted,
|
427
|
-
'Creative' => {
|
428
|
-
'Id' => creativeId
|
293
|
+
it "should fail when creating a map for a site in a different network" do
|
294
|
+
creative_map = @creative_maps.create(
|
295
|
+
:campaign_id => @campaign_id,
|
296
|
+
:flight_id => @flight_id,
|
297
|
+
:size_override => false,
|
298
|
+
:iframe => false,
|
299
|
+
:impressions => 100000,
|
300
|
+
:percentage => 50,
|
301
|
+
:siteId => 123,
|
302
|
+
:zoneId => @zone_id,
|
303
|
+
:distributionType => 1,
|
304
|
+
:isActive => true,
|
305
|
+
:isDeleted => false,
|
306
|
+
:creative => {
|
307
|
+
:title => "Creative Title",
|
308
|
+
:url => "http://www.adzerk.com",
|
309
|
+
:body => "Test Body",
|
310
|
+
:advertiser_id => @advertiser_id,
|
311
|
+
:ad_type_id => 18,
|
312
|
+
'IsHTMLJS' => true,
|
313
|
+
:script_body => "<html></html>",
|
314
|
+
:is_active => true,
|
315
|
+
:alt => "alt text",
|
316
|
+
:is_deleted => false,
|
317
|
+
:is_sync => false
|
429
318
|
}
|
430
|
-
|
431
|
-
|
319
|
+
)
|
320
|
+
creative_map[:message].should == "This site does not belong to your network"
|
321
|
+
end
|
432
322
|
|
433
|
-
|
434
|
-
|
323
|
+
it "should fail when creating a map for a zone in a different network" do
|
324
|
+
creative_map = @creative_maps.create(
|
325
|
+
:campaign_id => @campaign_id,
|
326
|
+
:flight_id => @flight_id,
|
327
|
+
:size_override => false,
|
328
|
+
:iframe => false,
|
329
|
+
:impressions => 100000,
|
330
|
+
:percentage => 50,
|
331
|
+
:siteId => @site_id,
|
332
|
+
:zoneId => 11,
|
333
|
+
:distributionType => 1,
|
334
|
+
:isActive => true,
|
335
|
+
:isDeleted => false,
|
336
|
+
:creative => {
|
337
|
+
:title => "Creative Title",
|
338
|
+
:url => "http://www.adzerk.com",
|
339
|
+
:body => "Test Body",
|
340
|
+
:advertiser_id => @advertiser_id,
|
341
|
+
:ad_type_id => 18,
|
342
|
+
'IsHTMLJS' => true,
|
343
|
+
:script_body => "<html></html>",
|
344
|
+
:is_active => true,
|
345
|
+
:alt => "alt text",
|
346
|
+
:is_deleted => false,
|
347
|
+
:is_sync => false
|
348
|
+
}
|
349
|
+
)
|
350
|
+
creative_map[:message].should == "The site associated with that zone does not belong to your network"
|
435
351
|
end
|
436
352
|
|
437
353
|
end
|