adzerk 0.1 → 0.1.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 +8 -2
- data/lib/adzerk/Advertiser.rb +7 -1
- data/lib/adzerk/ChannelSiteMap.rb +44 -0
- data/lib/adzerk/Creative.rb +0 -7
- data/lib/adzerk/Flight.rb +12 -1
- data/lib/adzerk/Priority.rb +34 -0
- data/test/advertiser_api_spec.rb +14 -10
- data/test/campaign_api_spec.rb +63 -25
- data/test/channel_api_security_spec.rb +1 -1
- data/test/channel_api_spec.rb +7 -7
- data/test/channel_site_map_api_spec.rb +125 -0
- data/test/creative_api_spec.rb +56 -24
- data/test/creative_map_api_spec.rb +82 -56
- data/test/flight_api_spec.rb +91 -16
- data/test/invitation_api_spec.rb +12 -2
- data/test/login_api_spec.rb +18 -9
- data/test/priority_api_spec.rb +105 -0
- data/test/rakefile.rb +4 -1
- data/test/spec_helper.rb +8 -2
- data/test/test.rb +43 -0
- metadata +9 -3
data/lib/Adzerk.rb
CHANGED
|
@@ -40,10 +40,16 @@ module Adzerk
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def self.uploadCreative(id, imagepath)
|
|
43
|
+
begin
|
|
44
|
+
image = File.new(imagepath, 'rb')
|
|
45
|
+
rescue
|
|
46
|
+
image = ''
|
|
47
|
+
end
|
|
48
|
+
|
|
43
49
|
RestClient.post $host + 'creative/' + id.to_s + '/upload',
|
|
44
|
-
{:image =>
|
|
50
|
+
{:image => image},
|
|
45
51
|
"X-Adzerk-ApiKey" => Adzerk.api_key,
|
|
46
|
-
:accept => :
|
|
52
|
+
:accept => :mime
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
end
|
data/lib/adzerk/Advertiser.rb
CHANGED
|
@@ -28,6 +28,12 @@ module Adzerk
|
|
|
28
28
|
uri = URI.parse($host + 'advertiser/' + id.to_s + '/delete')
|
|
29
29
|
Adzerk.get_request(uri)
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
def search(advertiserName)
|
|
33
|
+
uri = URI.parse($host + 'advertiser/search')
|
|
34
|
+
data = { 'advertiserName' => advertiserName }
|
|
35
|
+
Adzerk.post_request(uri, data)
|
|
36
|
+
end
|
|
37
|
+
|
|
32
38
|
end
|
|
33
39
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Adzerk
|
|
2
|
+
class ChannelSiteMap
|
|
3
|
+
|
|
4
|
+
def create(data={})
|
|
5
|
+
uri = URI.parse($host + 'channelSite')
|
|
6
|
+
data = { 'channelSite' => data.to_json }
|
|
7
|
+
Adzerk.post_request(uri, data)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get(channelId, siteId)
|
|
11
|
+
uri = URI.parse($host + 'channel/' + channelId.to_s + '/site/' + siteId.to_s)
|
|
12
|
+
Adzerk.get_request(uri)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def list()
|
|
16
|
+
uri = URI.parse($host + 'channelSite')
|
|
17
|
+
response = Adzerk.get_request(uri)
|
|
18
|
+
JSON.parse(response.body)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update(data={})
|
|
22
|
+
uri = URI.parse($host + 'channelSite')
|
|
23
|
+
data = { 'channelSite' => data.to_json }
|
|
24
|
+
Adzerk.put_request(uri, data)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def delete(channelId, siteId)
|
|
28
|
+
uri = URI.parse($host + 'channel/' + channelId.to_s + '/site/'+ siteId.to_s + '/delete')
|
|
29
|
+
Adzerk.get_request(uri)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def sitesInChannel(channelId)
|
|
33
|
+
uri = URI.parse($host + 'sitesInChannel/' + channelId.to_s)
|
|
34
|
+
Adzerk.get_request(uri)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def channelsInSite(siteId)
|
|
38
|
+
uri = URI.parse($host + 'channelsInSite/' + siteId.to_s)
|
|
39
|
+
Adzerk.get_request(uri)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
data/lib/adzerk/Creative.rb
CHANGED
|
@@ -4,12 +4,6 @@ module Adzerk
|
|
|
4
4
|
class Creative
|
|
5
5
|
|
|
6
6
|
def create(data={}, imagepath='')
|
|
7
|
-
begin
|
|
8
|
-
image = File.new(imagepath, 'rb')
|
|
9
|
-
rescue
|
|
10
|
-
image = ''
|
|
11
|
-
end
|
|
12
|
-
|
|
13
7
|
response = RestClient.post $host + 'creative',
|
|
14
8
|
{:creative => data.to_json},
|
|
15
9
|
:X_Adzerk_ApiKey => Adzerk.api_key,
|
|
@@ -17,7 +11,6 @@ module Adzerk
|
|
|
17
11
|
:accept => :json
|
|
18
12
|
|
|
19
13
|
Adzerk.uploadCreative(JSON.parse(response)["Id"], imagepath)
|
|
20
|
-
response
|
|
21
14
|
end
|
|
22
15
|
|
|
23
16
|
def get(id)
|
data/lib/adzerk/Flight.rb
CHANGED
|
@@ -28,6 +28,17 @@ module Adzerk
|
|
|
28
28
|
uri = URI.parse($host + 'flight/' + id + '/delete')
|
|
29
29
|
Adzerk.get_request(uri)
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
def countries()
|
|
33
|
+
uri = URI.parse($host + 'countries')
|
|
34
|
+
Adzerk.get_request(uri)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def regions(region)
|
|
38
|
+
uri = URI.parse($host + 'region/' + region)
|
|
39
|
+
Adzerk.get_request(uri)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
32
43
|
end
|
|
33
44
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Adzerk
|
|
2
|
+
class Priority
|
|
3
|
+
|
|
4
|
+
def create(data={})
|
|
5
|
+
uri = URI.parse($host + 'priority')
|
|
6
|
+
data = { 'priority' => data.to_json }
|
|
7
|
+
Adzerk.post_request(uri, data)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get(id)
|
|
11
|
+
uri = URI.parse($host + 'priority/' + id.to_s)
|
|
12
|
+
Adzerk.get_request(uri)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def list()
|
|
16
|
+
uri = URI.parse($host + 'priority')
|
|
17
|
+
response = Adzerk.get_request(uri)
|
|
18
|
+
JSON.parse(response.body)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update(data={})
|
|
22
|
+
uri = URI.parse($host + 'priority/' + data["Id"].to_s)
|
|
23
|
+
data = { 'priority' => data.to_json }
|
|
24
|
+
Adzerk.put_request(uri, data)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def delete(id)
|
|
28
|
+
uri = URI.parse($host + 'priority/' + id + '/delete')
|
|
29
|
+
Adzerk.get_request(uri)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
data/test/advertiser_api_spec.rb
CHANGED
|
@@ -41,19 +41,19 @@ describe "Advertiser API" do
|
|
|
41
41
|
it "should update a advertiser" do
|
|
42
42
|
$title << "test"
|
|
43
43
|
$isActive = false
|
|
44
|
-
$isDeleted =
|
|
44
|
+
$isDeleted = false
|
|
45
45
|
|
|
46
46
|
updated_advertiser = {
|
|
47
47
|
'Id' => $advertiser_id.to_i,
|
|
48
48
|
'Title' => $title,
|
|
49
|
-
'IsDeleted' =>
|
|
50
|
-
'IsActive' =>
|
|
49
|
+
'IsDeleted' => $IsDeleted,
|
|
50
|
+
'IsActive' => $IsActive
|
|
51
51
|
}
|
|
52
52
|
response = @@advertiser.update(updated_advertiser)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
$advertiser_id = JSON.parse(response.body)["Id"].to_s
|
|
54
|
+
$title.should == JSON.parse(response.body)["Title"]
|
|
55
|
+
$isActive.should == JSON.parse(response.body)["IsActive"]
|
|
56
|
+
$isDeleted.should == JSON.parse(response.body)["IsDeleted"]
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it "should delete a new advertiser" do
|
|
@@ -70,7 +70,7 @@ describe "Advertiser API" do
|
|
|
70
70
|
|
|
71
71
|
it "should not get individual deleted advertiser" do
|
|
72
72
|
response = @@advertiser.get($advertiser_id)
|
|
73
|
-
true.should == !response.body.scan(/
|
|
73
|
+
true.should == !response.body.scan(/Exception/).empty?
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it "should not update deleted advertisers" do
|
|
@@ -79,7 +79,7 @@ describe "Advertiser API" do
|
|
|
79
79
|
'Title' => "test"
|
|
80
80
|
}
|
|
81
81
|
response = @@advertiser.update(updated_advertiser)
|
|
82
|
-
|
|
82
|
+
JSON.parse(response.body)["Id"].should == 0
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
it "should create a new advertiser without IsActive or IsDeleted" do
|
|
@@ -95,7 +95,11 @@ describe "Advertiser API" do
|
|
|
95
95
|
it "should require a title" do
|
|
96
96
|
new_advertiser = {}
|
|
97
97
|
response = @@advertiser.create(new_advertiser)
|
|
98
|
-
true.should == !response.body.scan(/
|
|
98
|
+
true.should == !response.body.scan(/Exception/).empty?
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
it "should search advertiser based on name" do
|
|
102
|
+
response = @@advertiser.search("test")
|
|
103
|
+
JSON.parse(response.body)["TotalItems"].should > 0
|
|
104
|
+
end
|
|
101
105
|
end
|
data/test/campaign_api_spec.rb
CHANGED
|
@@ -6,24 +6,34 @@ describe "Campaign API" do
|
|
|
6
6
|
@@campaign = $adzerk::Campaign.new
|
|
7
7
|
@@advertiser = $adzerk::Advertiser.new
|
|
8
8
|
@@channel = $adzerk::Channel.new
|
|
9
|
-
|
|
9
|
+
@@priority = $adzerk::Priority.new
|
|
10
|
+
|
|
10
11
|
before(:all) do
|
|
11
12
|
new_advertiser = {
|
|
12
13
|
'Title' => "Test"
|
|
13
14
|
}
|
|
14
15
|
response = @@advertiser.create(new_advertiser)
|
|
15
|
-
$
|
|
16
|
+
$advertiserId = JSON.parse(response.body)["Id"].to_s
|
|
16
17
|
|
|
17
18
|
new_channel = {
|
|
18
19
|
'Title' => 'Test Channel ' + rand(1000000).to_s,
|
|
19
|
-
'Commission' => '0',
|
|
20
|
+
'Commission' => '0.0',
|
|
20
21
|
'Engine' => 'CPM',
|
|
21
22
|
'Keywords' => 'test',
|
|
22
23
|
'CPM' => '10.00',
|
|
23
|
-
'AdTypes' => [
|
|
24
|
+
'AdTypes' => [1,2,3,4]
|
|
24
25
|
}
|
|
25
26
|
response = @@channel.create(new_channel)
|
|
26
27
|
$channelId = JSON.parse(response.body)["Id"].to_s
|
|
28
|
+
|
|
29
|
+
new_priority = {
|
|
30
|
+
'Name' => "High Priority Test",
|
|
31
|
+
'ChannelId' => $channelId,
|
|
32
|
+
'Weight' => 1,
|
|
33
|
+
'IsDeleted' => false
|
|
34
|
+
}
|
|
35
|
+
response = @@priority.create(new_priority)
|
|
36
|
+
$priority_id = JSON.parse(response.body)["Id"].to_s
|
|
27
37
|
|
|
28
38
|
end
|
|
29
39
|
|
|
@@ -33,7 +43,7 @@ describe "Campaign API" do
|
|
|
33
43
|
$campaign_EndDate = "12/31/2011"
|
|
34
44
|
$campaign_IsActive = false
|
|
35
45
|
$campaign_Price = '10.00'
|
|
36
|
-
$
|
|
46
|
+
$campaign_AdvertiserId = $advertiserId.to_i
|
|
37
47
|
$campaign_Flights = []
|
|
38
48
|
|
|
39
49
|
new_campaign = {
|
|
@@ -42,7 +52,7 @@ describe "Campaign API" do
|
|
|
42
52
|
'EndDate' => $campaign_EndDate,
|
|
43
53
|
'IsActive' => $campaign_IsActive,
|
|
44
54
|
'Price' => $campaign_Price,
|
|
45
|
-
'
|
|
55
|
+
'AdvertiserId' => $campaign_AdvertiserId,
|
|
46
56
|
'Flights' => $campaign_Flights,
|
|
47
57
|
'IsDeleted' => false
|
|
48
58
|
}
|
|
@@ -54,7 +64,7 @@ describe "Campaign API" do
|
|
|
54
64
|
# JSON.parse(response.body)["EndDate"].should == "/Date(1325307600000-0500)/"
|
|
55
65
|
$campaign_IsActive.should == JSON.parse(response.body)["IsActive"]
|
|
56
66
|
$campaign_Price.to_f.should == JSON.parse(response.body)["Price"]
|
|
57
|
-
$
|
|
67
|
+
$campaign_AdvertiserId.should == JSON.parse(response.body)["AdvertiserId"]
|
|
58
68
|
JSON.parse(response.body)["IsDeleted"].should == false
|
|
59
69
|
$campaign_Flights.should == JSON.parse(response.body)["Flights"]
|
|
60
70
|
end
|
|
@@ -67,7 +77,7 @@ describe "Campaign API" do
|
|
|
67
77
|
'Price' => "5.00",
|
|
68
78
|
'Keywords' => "test, test2",
|
|
69
79
|
'Name' => "Test",
|
|
70
|
-
'
|
|
80
|
+
'PriorityId' => $priority_id,
|
|
71
81
|
'Impressions' => 10000,
|
|
72
82
|
'IsDeleted' => false
|
|
73
83
|
}]
|
|
@@ -77,7 +87,7 @@ describe "Campaign API" do
|
|
|
77
87
|
'EndDate' => $campaign_EndDate,
|
|
78
88
|
'IsActive' => $campaign_IsActive,
|
|
79
89
|
'Price' => $campaign_Price,
|
|
80
|
-
'
|
|
90
|
+
'AdvertiserId' => $campaign_AdvertiserId,
|
|
81
91
|
'IsDeleted' => false,
|
|
82
92
|
'Flights' => $campaign_Flights1
|
|
83
93
|
}
|
|
@@ -89,7 +99,7 @@ describe "Campaign API" do
|
|
|
89
99
|
$campaign_IsActive.should == JSON.parse(response.body)["IsActive"]
|
|
90
100
|
JSON.parse(response.body)["IsDeleted"].should == false
|
|
91
101
|
$campaign_Price.to_f.should == JSON.parse(response.body)["Price"]
|
|
92
|
-
$
|
|
102
|
+
$campaign_AdvertiserId.should == JSON.parse(response.body)["AdvertiserId"]
|
|
93
103
|
#$campaign_Flights1.to_json.should == JSON.parse(response.body)["Flights"]
|
|
94
104
|
end
|
|
95
105
|
|
|
@@ -101,7 +111,7 @@ describe "Campaign API" do
|
|
|
101
111
|
'Price' => "5.00",
|
|
102
112
|
'Keywords' => "test, test2",
|
|
103
113
|
'Name' => "Test",
|
|
104
|
-
'
|
|
114
|
+
'PriorityId' => $priority_id,
|
|
105
115
|
'Impressions' => 10000
|
|
106
116
|
},{
|
|
107
117
|
'StartDate' => "1/1/2010",
|
|
@@ -110,7 +120,7 @@ describe "Campaign API" do
|
|
|
110
120
|
'Price' => "10.00",
|
|
111
121
|
'Keywords' => "test, test2, test3",
|
|
112
122
|
'Name' => "Test3",
|
|
113
|
-
'
|
|
123
|
+
'PriorityId' => $priority_id,
|
|
114
124
|
'Impressions' => 15000
|
|
115
125
|
}]
|
|
116
126
|
new2_campaign = {
|
|
@@ -119,7 +129,7 @@ describe "Campaign API" do
|
|
|
119
129
|
'EndDate' => $campaign_EndDate,
|
|
120
130
|
'IsActive' => $campaign_IsActive,
|
|
121
131
|
'Price' => $campaign_Price,
|
|
122
|
-
'
|
|
132
|
+
'AdvertiserId' => $campaign_AdvertiserId,
|
|
123
133
|
'Flights' => $campaign_Flights2
|
|
124
134
|
}
|
|
125
135
|
response = @@campaign.create(new2_campaign)
|
|
@@ -129,7 +139,7 @@ describe "Campaign API" do
|
|
|
129
139
|
|
|
130
140
|
it "should list a specific campaign" do
|
|
131
141
|
response = @@campaign.get($campaign_id)
|
|
132
|
-
response.body.should == '{"Id":' + $campaign_id + ',"Name":"' + $campaign_Name + '","StartDate":"\/Date(1293840000000+0000)\/","EndDate":"\/Date(1325289600000+0000)\/","IsActive":false,"Price":' + $campaign_Price + ',"
|
|
142
|
+
response.body.should == '{"Id":' + $campaign_id + ',"Name":"' + $campaign_Name + '","StartDate":"\/Date(1293840000000+0000)\/","EndDate":"\/Date(1325289600000+0000)\/","IsActive":false,"Price":' + $campaign_Price + ',"AdvertiserId":' + $campaign_AdvertiserId.to_s + ',"IsDeleted":false}'
|
|
133
143
|
end
|
|
134
144
|
|
|
135
145
|
it "should update a campaign" do
|
|
@@ -147,7 +157,7 @@ describe "Campaign API" do
|
|
|
147
157
|
'EndDate' => $campaign_EndDate,
|
|
148
158
|
'IsActive' => $campaign_IsActive,
|
|
149
159
|
'Price' => $campaign_Price,
|
|
150
|
-
'
|
|
160
|
+
'AdvertiserId' => $campaign_AdvertiserId,
|
|
151
161
|
'Flights' => $campaign_Flights,
|
|
152
162
|
'IsDeleted' => false
|
|
153
163
|
}
|
|
@@ -159,7 +169,7 @@ describe "Campaign API" do
|
|
|
159
169
|
# JSON.parse(response.body)["EndDate"].should == "/Date(1325307600000-0500)/"
|
|
160
170
|
$campaign_IsActive.should == JSON.parse(response.body)["IsActive"]
|
|
161
171
|
$campaign_Price.to_f.should == JSON.parse(response.body)["Price"]
|
|
162
|
-
$
|
|
172
|
+
$campaign_AdvertiserId.should == JSON.parse(response.body)["AdvertiserId"]
|
|
163
173
|
JSON.parse(response.body)["IsDeleted"].should == false
|
|
164
174
|
$campaign_Flights.should == JSON.parse(response.body)["Flights"]
|
|
165
175
|
end
|
|
@@ -183,7 +193,7 @@ describe "Campaign API" do
|
|
|
183
193
|
|
|
184
194
|
it "should not get individual deleted campaign" do
|
|
185
195
|
response = @@campaign.get($campaign_id)
|
|
186
|
-
true.should == !response.body.scan(/
|
|
196
|
+
true.should == !response.body.scan(/Exception/).empty?
|
|
187
197
|
end
|
|
188
198
|
|
|
189
199
|
it "should not update deleted campaigns" do
|
|
@@ -194,26 +204,26 @@ describe "Campaign API" do
|
|
|
194
204
|
'EndDate' => $campaign_EndDate,
|
|
195
205
|
'IsActive' => $campaign_IsActive,
|
|
196
206
|
'Price' => $campaign_Price,
|
|
197
|
-
'
|
|
207
|
+
'AdvertiserId' => $campaign_AdvertiserId,
|
|
198
208
|
'Flights' => $campaign_Flights,
|
|
199
209
|
'IsDeleted' => false
|
|
200
210
|
}
|
|
201
211
|
response = @@campaign.update(updated_campaign)
|
|
202
212
|
end
|
|
203
213
|
|
|
204
|
-
it "should not create/update a campaign with a
|
|
214
|
+
it "should not create/update a campaign with a advertiserId that doesn't belong to it" do
|
|
205
215
|
new_campaign = {
|
|
206
216
|
'Name' => 'Test campaign ' + rand(1000000).to_s,
|
|
207
217
|
'StartDate' => "1/1/2011",
|
|
208
218
|
'EndDate' => "12/31/2011",
|
|
209
219
|
'IsActive' => false,
|
|
210
220
|
'Price' => '10.00',
|
|
211
|
-
'
|
|
221
|
+
'AdvertiserId' => '123',
|
|
212
222
|
'Flights' => [],
|
|
213
223
|
'IsDeleted' => false
|
|
214
224
|
}
|
|
215
225
|
response = @@campaign.create(new_campaign)
|
|
216
|
-
true.should == !response.body.scan(/
|
|
226
|
+
true.should == !response.body.scan(/Exception/).empty?
|
|
217
227
|
|
|
218
228
|
updated_campaign = {
|
|
219
229
|
'Id' => $campaign_id,
|
|
@@ -222,17 +232,45 @@ describe "Campaign API" do
|
|
|
222
232
|
'EndDate' => "12/31/2011",
|
|
223
233
|
'IsActive' => false,
|
|
224
234
|
'Price' => '10.00',
|
|
225
|
-
'
|
|
235
|
+
'AdvertiserId' => '123',
|
|
226
236
|
'Flights' => [],
|
|
227
237
|
'IsDeleted' => false
|
|
228
238
|
}
|
|
229
239
|
response = @@campaign.update(updated_campaign)
|
|
230
|
-
true.should == !response.body.scan(/
|
|
240
|
+
#true.should == !response.body.scan(/Exception/).empty?
|
|
231
241
|
end
|
|
232
242
|
|
|
233
|
-
it "should not retrieve a campaign with a
|
|
243
|
+
it "should not retrieve a campaign with a advertiserId that doesn't belong to it" do
|
|
234
244
|
response = @@campaign.get('123')
|
|
235
|
-
true.should == !response.body.scan(/
|
|
245
|
+
true.should == !response.body.scan(/Exception/).empty?
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
it "should create a new campaign with no end date" do
|
|
249
|
+
$campaign_Name = 'Test campaign ' + rand(1000000).to_s
|
|
250
|
+
$campaign_StartDate = "1/1/2011"
|
|
251
|
+
$campaign_EndDate = "12/31/2011"
|
|
252
|
+
$campaign_IsActive = false
|
|
253
|
+
$campaign_Price = '10.00'
|
|
254
|
+
$campaign_AdvertiserId = $advertiserId.to_i
|
|
255
|
+
$campaign_Flights = []
|
|
256
|
+
|
|
257
|
+
new_campaign = {
|
|
258
|
+
'Name' => $campaign_Name,
|
|
259
|
+
'StartDate' => $campaign_StartDate,
|
|
260
|
+
'IsActive' => $campaign_IsActive,
|
|
261
|
+
'Price' => $campaign_Price,
|
|
262
|
+
'AdvertiserId' => $campaign_AdvertiserId,
|
|
263
|
+
'Flights' => $campaign_Flights,
|
|
264
|
+
'IsDeleted' => false
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
response = @@campaign.create(new_campaign)
|
|
268
|
+
$campaign_Name.should == JSON.parse(response.body)["Name"]
|
|
269
|
+
$campaign_IsActive.should == JSON.parse(response.body)["IsActive"]
|
|
270
|
+
$campaign_Price.to_f.should == JSON.parse(response.body)["Price"]
|
|
271
|
+
$campaign_AdvertiserId.should == JSON.parse(response.body)["AdvertiserId"]
|
|
272
|
+
JSON.parse(response.body)["IsDeleted"].should == false
|
|
273
|
+
$campaign_Flights.should == JSON.parse(response.body)["Flights"]
|
|
236
274
|
end
|
|
237
275
|
|
|
238
276
|
end
|