adzerk 0.1.2 → 0.1.3

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.
@@ -12,6 +12,7 @@
12
12
  'report_api_spec.rb',
13
13
  'site_api_spec.rb',
14
14
  'priority_api_spec.rb',
15
+ 'zone_api_spec.rb',
15
16
  'channel_site_map_api_spec.rb'
16
17
  ]
17
18
 
@@ -3,6 +3,7 @@ require "json"
3
3
  require "net/http"
4
4
  require "../lib/Adzerk"
5
5
  require "../lib/adzerk/Site"
6
+ require "../lib/adzerk/Zone"
6
7
  require "../lib/adzerk/Publisher"
7
8
  require "../lib/adzerk/Channel"
8
9
  require "../lib/adzerk/Campaign"
@@ -0,0 +1,175 @@
1
+ # Create Campaign
2
+ # Create Flight
3
+ # Disable Campaign
4
+ # Re-enable Campaign
5
+ # Check in DB to see if flight has AddToBalancer == true
6
+
7
+
8
+ require './spec_helper.rb'
9
+
10
+ describe 'test for chris' do
11
+ @@map = $adzerk::CreativeMap.new
12
+ @@campaign = $adzerk::Campaign.new
13
+ @@flight = $adzerk::Flight.new
14
+ @@site = $adzerk::Site.new
15
+ @@advertiser = $adzerk::Advertiser.new
16
+ @@creative = $adzerk::Creative.new
17
+ @@channel = $adzerk::Channel.new
18
+ @@priority = $adzerk::Priority.new
19
+
20
+
21
+ before(:all) do
22
+ new_site = {
23
+ 'Title' => 'Test Site ' + rand(1000000).to_s,
24
+ 'Url' => 'http://www.adzerk.com'
25
+ }
26
+ response = @@site.create(new_site)
27
+ $siteId = JSON.parse(response.body)["Id"]
28
+
29
+ new_advertiser = {
30
+ 'Title' => "Test"
31
+ }
32
+ response = @@advertiser.create(new_advertiser)
33
+ $advertiserId = JSON.parse(response.body)["Id"]
34
+
35
+ new_channel = {
36
+ 'Title' => 'Test Channel ' + rand(1000000).to_s,
37
+ 'Commission' => '0',
38
+ 'Engine' => 'CPM',
39
+ 'Keywords' => 'test',
40
+ 'CPM' => '10.00',
41
+ 'AdTypes' => [1,2,3,4]
42
+ }
43
+ response = @@channel.create(new_channel)
44
+ $channelId = JSON.parse(response.body)["Id"]
45
+
46
+ new_priority = {
47
+ 'Name' => "High Priority Test",
48
+ 'ChannelId' => $channelId,
49
+ 'Weight' => 1,
50
+ 'IsDeleted' => false
51
+ }
52
+ response = @@priority.create(new_priority)
53
+ $priority_id = JSON.parse(response.body)["Id"].to_s
54
+
55
+ new_campaign = {
56
+ 'Name' => 'Test campaign ' + rand(1000000).to_s,
57
+ 'StartDate' => "1/1/2011",
58
+ 'EndDate' => "12/31/2011",
59
+ 'IsActive' => true,
60
+ 'Price' => '10.00',
61
+ 'AdvertiserId' => $advertiserId,
62
+ 'Flights' => [],
63
+ 'IsDeleted' => false
64
+ }
65
+ response = @@campaign.create(new_campaign)
66
+ $campaignId = JSON.parse(response.body)["Id"]
67
+ puts "CampaignId: " + $campaignId.to_s
68
+
69
+ new_flight = {
70
+ 'NoEndDate' => false,
71
+ 'PriorityId' => $priority_id,
72
+ 'Name' => 'Test flight ' + rand(1000000).to_s,
73
+ 'StartDate' => "1/1/2011",
74
+ 'EndDate' => "12/31/2011",
75
+ 'NoEndDate' => false,
76
+ 'Price' => '15.00',
77
+ 'OptionType' => 1,
78
+ 'Impressions' => 10000,
79
+ 'IsUnlimited' => false,
80
+ 'IsFullSpeed' => false,
81
+ 'Keywords' => "test, test2",
82
+ 'UserAgentKeywords' => nil,
83
+ 'WeightOverride' => nil,
84
+ 'CampaignId' => $campaignId,
85
+ 'IsActive' => true,
86
+ 'IsDeleted' => false
87
+ }
88
+ response = @@flight.create(new_flight)
89
+ $flightId = JSON.parse(response.body)["Id"]
90
+ puts "FlightId: " + $flightId.to_s
91
+ end
92
+
93
+ it "should disable the campaign" do
94
+ campaign = {
95
+ 'Id' => $campaignId,
96
+ 'IsActive' => false
97
+ }
98
+ response = @@campaign.update(campaign)
99
+ end
100
+
101
+ it "should enable the campaign" do
102
+ campaign = {
103
+ 'Id' => $campaignId,
104
+ 'IsActive' => true
105
+ }
106
+ response = @@campaign.update(campaign)
107
+ end
108
+
109
+ #it "should work" do
110
+ #update = {
111
+ #'Id' => 21897,
112
+ #'CampaignId' => 6789,
113
+ #'FlightId' => 13975,
114
+ #'SizeOverride' => nil,
115
+ #'Iframe' => nil,
116
+ #'DistributionType' => 1,
117
+ #'PublisherAccountId' => 2246,
118
+ #'Impressions' => 0,
119
+ #'Percentage' => 0,
120
+ #'SiteId' => 14499,
121
+ #'ZoneId' => 1921,
122
+ #'IsActive' => true,
123
+ #'IsDeleted' => nil,
124
+ #'Creative' => {
125
+ #'Id' => 14618,
126
+ #'ScriptBody' => 'Test4',
127
+ #'IsHTMLJS' => true,
128
+ #'Title' => 'HTML Test!'
129
+ #'Url' => 'http://adzerk.com'
130
+ #}
131
+ #}
132
+ #response = @@map.update(update)
133
+ #puts response.body
134
+ #end
135
+
136
+ #@@advertiser = $adzerk::Advertiser.new
137
+ #it "should update an advertiser" do
138
+ #updated_advertiser = {
139
+ #'Id' => 4194,
140
+ #'Title' => 'Advertiser Test',
141
+ #'IsDeleted' => nil,
142
+ #'IsActive' => true
143
+ #}
144
+ #response = @@advertiser.update(updated_advertiser)
145
+ #puts response.body
146
+ #end
147
+
148
+ #it "should" do
149
+ #r = @@flight.get("14023")
150
+ #puts r.body
151
+ #end
152
+
153
+ #it "should test Nick's creative issue" do
154
+ #create = {
155
+ #'Title' => "banner_5000",
156
+ #'ImageName' => '',
157
+ #'Url' => 'http:\/\/www.cnn.com',
158
+ #'Body' => "banner_5000",
159
+ #'Alt' => "banner_5000",
160
+ #'AdvertiserId' => $advertiserId,
161
+ #'AdvertiserId' => 3921,
162
+ #'AdTypeId' => 4,
163
+ #'SiteId' => 14749,
164
+ #'IsActive' => true,
165
+ #'IsDeleted' => false,
166
+ #'IsHTMLJS' => false,
167
+ #'IsSync' => false
168
+ #'ScriptBody' => ''
169
+ #}
170
+ #response = @@creative.create(create, '250x250.gif')
171
+ #puts response.body
172
+
173
+ #end
174
+
175
+ end
@@ -0,0 +1,89 @@
1
+ require './spec_helper.rb'
2
+
3
+ describe "Zone API" do
4
+
5
+ @@zone = $adzerk::Zone.new
6
+ @@site = $adzerk::Site.new
7
+
8
+ before(:all) do
9
+ new_site = {
10
+ 'Title' => 'Test Site ' + rand(1000000).to_s,
11
+ 'Url' => 'http://www.adzerk.com'
12
+ }
13
+ response = @@site.create(new_site)
14
+ $site_id = JSON.parse(response.body)["Id"]
15
+ end
16
+
17
+ it "should create a new zone" do
18
+ $name = 'Test Zone ' + rand(1000000).to_s
19
+ new_zone = {
20
+ 'Name' => $name,
21
+ 'SiteId' => $site_id,
22
+ 'IsDeleted' => false
23
+ }
24
+ response = @@zone.create(new_zone)
25
+ $zone_id = JSON.parse(response.body)["Id"].to_s
26
+ JSON.parse(response.body)["Name"].should == $name
27
+ JSON.parse(response.body)["SiteId"].should == $site_id
28
+ JSON.parse(response.body)["IsDeleted"].should == false
29
+ end
30
+
31
+ it "should list a specific zone" do
32
+ response = @@zone.get($zone_id)
33
+ response.body.should == '{"Id":' + $zone_id + ',"Name":"' + $name + '","SiteId":' + $site_id.to_s + ',"IsDeleted":false}'
34
+ end
35
+
36
+ it "should update a zone" do
37
+ $name = 'Test Zone ' + rand(1000000).to_s
38
+ updated_zone = {
39
+ 'Id' => $zone_id,
40
+ 'Name' => $name,
41
+ 'SiteId' => $site_id,
42
+ 'IsDeleted' => false
43
+ }
44
+ response = @@zone.update(updated_zone)
45
+ JSON.parse(response.body)["Id"].to_s.should == $zone_id
46
+ JSON.parse(response.body)["Name"].should == $name
47
+ JSON.parse(response.body)["SiteId"].should == $site_id
48
+ JSON.parse(response.body)["IsDeleted"].should == false
49
+ end
50
+
51
+ it "should list all zones" do
52
+ result = @@zone.list()
53
+ result.length.should > 0
54
+ result["Items"].last["Id"].to_s.should == $zone_id
55
+ result["Items"].last["Name"].should == $name
56
+ result["Items"].last["SiteId"].should == $site_id
57
+ result["Items"].last["IsDeleted"].should == false
58
+ end
59
+
60
+ it "should delete a new zone" do
61
+ response = @@zone.delete($zone_id)
62
+ response.body.should == 'OK'
63
+ end
64
+
65
+ it "should not list deleted zones" do
66
+ result = @@zone.list()
67
+ result["Items"].each do |r|
68
+ r["Id"].to_s.should_not == $zone_id
69
+ end
70
+ end
71
+
72
+ it "should not get individual deleted zones" do
73
+ response = @@zone.get($zone_id)
74
+ response.body.should == '{"Id":0,"SiteId":0}'
75
+ end
76
+
77
+ it "should not update deleted zones" do
78
+ $name = 'Test Zone ' + rand(1000000).to_s
79
+ updated_zone = {
80
+ 'Id' => $zone_id,
81
+ 'Name' => $name,
82
+ 'SiteId' => $site_id,
83
+ 'IsDeleted' => false
84
+ }
85
+ response = @@zone.update(updated_zone)
86
+ response.body.should == '{"Id":0,"SiteId":0}'
87
+ end
88
+
89
+ end
metadata CHANGED
@@ -1,32 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: adzerk
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Kacy Fortner
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-10 00:00:00 Z
12
+ date: 2012-06-26 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: Ruby library for the Adzerk API
22
15
  email: kacy@adzerk.com
23
16
  executables: []
24
-
25
17
  extensions: []
26
-
27
18
  extra_rdoc_files: []
28
-
29
- files:
19
+ files:
30
20
  - lib/Adzerk.rb
31
21
  - lib/adzerk/Advertiser.rb
32
22
  - lib/adzerk/Campaign.rb
@@ -41,6 +31,7 @@ files:
41
31
  - lib/adzerk/Publisher.rb
42
32
  - lib/adzerk/Reporting.rb
43
33
  - lib/adzerk/Site.rb
34
+ - lib/adzerk/Zone.rb
44
35
  - test/advertiser_api_spec.rb
45
36
  - test/campaign_api_spec.rb
46
37
  - test/channel_api_security_spec.rb
@@ -48,6 +39,7 @@ files:
48
39
  - test/channel_site_map_api_spec.rb
49
40
  - test/creative_api_spec.rb
50
41
  - test/creative_map_api_spec.rb
42
+ - test/delivery-test.rb
51
43
  - test/flight_api_spec.rb
52
44
  - test/invitation_api_spec.rb
53
45
  - test/login_api_spec.rb
@@ -58,38 +50,30 @@ files:
58
50
  - test/site_api_spec.rb
59
51
  - test/spec_helper.rb
60
52
  - test/test.rb
53
+ - test/test2.rb
54
+ - test/zone_api_spec.rb
61
55
  homepage: http://adzerk.com
62
56
  licenses: []
63
-
64
57
  post_install_message:
65
58
  rdoc_options: []
66
-
67
- require_paths:
59
+ require_paths:
68
60
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
61
+ required_ruby_version: !ruby/object:Gem::Requirement
70
62
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
68
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 3
84
- segments:
85
- - 0
86
- version: "0"
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
87
73
  requirements: []
88
-
89
74
  rubyforge_project:
90
- rubygems_version: 1.8.6
75
+ rubygems_version: 1.8.10
91
76
  signing_key:
92
77
  specification_version: 3
93
78
  summary: Adzerk API
94
79
  test_files: []
95
-