adzerk 0.4 → 0.5
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 +4 -4
- data/lib/adzerk.rb +1 -0
- data/lib/adzerk/client.rb +1 -1
- data/lib/adzerk/priority.rb +8 -0
- data/lib/adzerk/version.rb +1 -1
- data/test/creative_map_api_spec.rb +5 -0
- data/test/flight_api_spec.rb +32 -4
- data/test/login_api_spec.rb +1 -3
- data/test/priority_api_spec.rb +8 -1
- data/test/spec_helper.rb +4 -2
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9b0de334492f30ebc133781cae4adbd34ba6879
|
4
|
+
data.tar.gz: 7b60133c1cb10c5adafad6cd6ce32a5f8f20b77f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cffc3e1988161f9a52c78e88da13c2cc0991db3ae794533bd8acbaaaf7e0d1607a7dd6f64272ea51d7d7be6b456a20fc7a016381edfaa790503c42dfc740422f
|
7
|
+
data.tar.gz: 1e10384ba550636c69fcd08c65744053bf1e5ea86e98c5d2ac11ca3574ff2f5626616e24c0ede2bb3662c2ff729e2c135cab9f0047d8da1575369353ee24414d
|
data/lib/adzerk.rb
CHANGED
data/lib/adzerk/client.rb
CHANGED
@@ -22,7 +22,7 @@ module Adzerk
|
|
22
22
|
@zones = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'zone')
|
23
23
|
@campaigns = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'campaign')
|
24
24
|
@channels = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'channel')
|
25
|
-
@priorities = Adzerk::
|
25
|
+
@priorities = Adzerk::Priority.new(:client => self, :endpoint => 'priority')
|
26
26
|
@advertisers = Adzerk::Advertiser.new(:client => self, :endpoint => 'advertiser')
|
27
27
|
@publishers = Adzerk::Publisher.new(:client => self, :endpoint => 'publisher')
|
28
28
|
@creatives = Adzerk::Creative.new(:client => self, :endpoint => 'creative')
|
data/lib/adzerk/version.rb
CHANGED
@@ -85,6 +85,7 @@ describe "Creative Flight API" do
|
|
85
85
|
$DistributionType = 1
|
86
86
|
$IsMapActive = true
|
87
87
|
$IsMapDeleted = false
|
88
|
+
$CustomTargeting = '$keywords contains "bjork"'
|
88
89
|
|
89
90
|
$Title = 'Test creative ' + rand(1000000).to_s
|
90
91
|
$Url = "http://adzerk.com"
|
@@ -111,6 +112,7 @@ describe "Creative Flight API" do
|
|
111
112
|
:distributionType => $DistributionType,
|
112
113
|
:isActive => $IsMapActive,
|
113
114
|
:isDeleted => $IsMapDeleted,
|
115
|
+
:custom_targeting => $CustomTargeting,
|
114
116
|
:creative => {
|
115
117
|
:title => $Title,
|
116
118
|
:url => $Url,
|
@@ -139,6 +141,7 @@ describe "Creative Flight API" do
|
|
139
141
|
expect(creative_map[:distribution_type]).to eq($DistributionType)
|
140
142
|
expect(creative_map[:is_active]).to eq($IsMapActive)
|
141
143
|
expect(creative_map[:is_deleted]).to eq($IsMapDeleted)
|
144
|
+
expect(creative_map[:custom_targeting]).to eq($CustomTargeting)
|
142
145
|
|
143
146
|
expect(creative_map[:creative][:title]).to eq($Title)
|
144
147
|
expect(creative_map[:creative][:url]).to eq($Url)
|
@@ -169,6 +172,7 @@ describe "Creative Flight API" do
|
|
169
172
|
expect(creative_map[:distribution_type]).to eq($DistributionType)
|
170
173
|
expect(creative_map[:is_active]).to eq($IsMapActive)
|
171
174
|
expect(creative_map[:is_deleted]).to eq($IsMapDeleted)
|
175
|
+
expect(creative_map[:custom_targeting]).to eq($CustomTargeting)
|
172
176
|
|
173
177
|
expect(creative_map[:creative][:title]).to eq($Title)
|
174
178
|
expect(creative_map[:creative][:url]).to eq($Url)
|
@@ -195,6 +199,7 @@ describe "Creative Flight API" do
|
|
195
199
|
expect(creative_map[:distribution_type]).to eq($DistributionType)
|
196
200
|
expect(creative_map[:is_active]).to eq($IsMapActive)
|
197
201
|
expect(creative_map[:is_deleted]).to eq($IsMapDeleted)
|
202
|
+
expect(creative_map[:custom_targeting]).to eq($CustomTargeting)
|
198
203
|
|
199
204
|
expect(creative_map[:creative][:title]).to eq($Title)
|
200
205
|
expect(creative_map[:creative][:url]).to eq($Url)
|
data/test/flight_api_spec.rb
CHANGED
@@ -2,7 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe "Flight API" do
|
4
4
|
|
5
|
-
|
6
5
|
before(:all) do
|
7
6
|
new_advertiser = {
|
8
7
|
'Title' => "Test"
|
@@ -80,11 +79,12 @@ describe "Flight API" do
|
|
80
79
|
:campaign_id => $flight_CampaignId,
|
81
80
|
:is_active => $flight_IsActive,
|
82
81
|
:is_deleted => $flight_IsDeleted,
|
83
|
-
:goal_type => $flight_GoalType
|
82
|
+
:goal_type => $flight_GoalType,
|
83
|
+
:is_companion => true
|
84
84
|
}
|
85
85
|
flight = @flights.create(new_flight)
|
86
86
|
$flight_id = flight[:id].to_s
|
87
|
-
expect(flight[:no_end_date]).to
|
87
|
+
expect(flight[:no_end_date]).to be false
|
88
88
|
expect(flight[:priority_id]).to eq($priority_id.to_i)
|
89
89
|
expect(flight[:name]).to eq($flight_Name)
|
90
90
|
# JSON.parse(response.body)["StartDate"].should == "/Date(1293840000000+0000)/"
|
@@ -101,6 +101,31 @@ describe "Flight API" do
|
|
101
101
|
expect(flight[:is_active]).to eq($flight_IsActive)
|
102
102
|
expect(flight[:is_deleted]).to eq($flight_IsDeleted)
|
103
103
|
expect(flight[:goal_type]).to eq($flight_GoalType)
|
104
|
+
expect(flight[:is_companion]).to be true
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should fail to create a flight without a goal type" do
|
108
|
+
flight_without_goal_type = {
|
109
|
+
:no_end_date => false,
|
110
|
+
:priority_id => $priority_id,
|
111
|
+
:name => $flight_Name,
|
112
|
+
:start_date => $flight_StartDate,
|
113
|
+
:end_date => $flight_EndDate,
|
114
|
+
:no_end_date => $flight_NoEndDate,
|
115
|
+
:price => $flight_Price,
|
116
|
+
:option_type => $flight_OptionType,
|
117
|
+
:impressions => $flight_Impressions,
|
118
|
+
:is_unlimited => $flight_IsUnlimited,
|
119
|
+
:is_full_speed => $flight_IsFullSpeed,
|
120
|
+
:keywords => $flight_Keywords,
|
121
|
+
:user_agent_keywords => $flight_UserAgentKeywords,
|
122
|
+
:weight_override => $flight_WeightOverride,
|
123
|
+
:campaign_id => $flight_CampaignId,
|
124
|
+
:is_active => $flight_IsActive,
|
125
|
+
:is_deleted => $flight_IsDeleted
|
126
|
+
}
|
127
|
+
|
128
|
+
expect { @flights.create flight_without_goal_type }.to raise_error
|
104
129
|
end
|
105
130
|
|
106
131
|
it "should list a specific flight" do
|
@@ -119,6 +144,7 @@ describe "Flight API" do
|
|
119
144
|
expect(flight[:is_active]).to eq($flight_IsActive)
|
120
145
|
expect(flight[:is_deleted]).to eq($flight_IsDeleted)
|
121
146
|
expect(flight[:goal_type]).to eq($flight_GoalType)
|
147
|
+
expect(flight[:is_companion]).to be true
|
122
148
|
end
|
123
149
|
|
124
150
|
it "should update a flight" do
|
@@ -127,8 +153,10 @@ describe "Flight API" do
|
|
127
153
|
:name => "New Flight Name",
|
128
154
|
:priority_id => $priority_id,
|
129
155
|
:start_date => $flight_StartDate,
|
130
|
-
:goal_type => $flight_GoalType
|
156
|
+
:goal_type => $flight_GoalType,
|
157
|
+
:is_companion => false)
|
131
158
|
expect(flight[:name]).to eq("New Flight Name")
|
159
|
+
expect(flight[:is_companion]).to be false
|
132
160
|
end
|
133
161
|
|
134
162
|
it "should list all flights" do
|
data/test/login_api_spec.rb
CHANGED
data/test/priority_api_spec.rb
CHANGED
@@ -31,6 +31,7 @@ describe "Priority API" do
|
|
31
31
|
expect($priority_channel_id.to_f).to eq(priority[:channel_id])
|
32
32
|
expect($priority_weight).to eq(priority[:weight])
|
33
33
|
expect($priority_is_deleted).to eq(priority[:is_deleted])
|
34
|
+
expect(priority[:selection_algorithm]).to eq(0) # default (Lottery)
|
34
35
|
end
|
35
36
|
|
36
37
|
it "should list a specific priority" do
|
@@ -39,7 +40,7 @@ describe "Priority API" do
|
|
39
40
|
expect($priority_channel_id.to_f).to eq(priority[:channel_id])
|
40
41
|
expect($priority_weight).to eq(priority[:weight])
|
41
42
|
expect($priority_is_deleted).to eq(priority[:is_deleted])
|
42
|
-
priority
|
43
|
+
expect(priority[:selection_algorithm]).to eq(0)
|
43
44
|
end
|
44
45
|
|
45
46
|
it "should update a priority" do
|
@@ -54,6 +55,11 @@ describe "Priority API" do
|
|
54
55
|
expect($priority_channel_id.to_f).to eq(priority[:channel_id])
|
55
56
|
expect(priority[:weight]).to eq(2)
|
56
57
|
expect($priority_is_deleted).to eq(priority[:is_deleted])
|
58
|
+
expect(priority[:selection_algorithm]).to eq(0)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should not allow selection algorithm to be updated" do
|
62
|
+
expect { @priorities.update(selection_algorithm: 1) }.to raise_error
|
57
63
|
end
|
58
64
|
|
59
65
|
it "should list all priorities" do
|
@@ -65,6 +71,7 @@ describe "Priority API" do
|
|
65
71
|
expect($priority_channel_id.to_f).to eq(priority[:channel_id])
|
66
72
|
expect(priority[:weight]).to eq(2)
|
67
73
|
expect($priority_is_deleted).to eq(priority[:is_deleted])
|
74
|
+
expect(priority[:selection_algorithm]).to eq(0)
|
68
75
|
end
|
69
76
|
|
70
77
|
it "should delete a new priority" do
|
data/test/spec_helper.rb
CHANGED
@@ -4,8 +4,10 @@ require "net/http"
|
|
4
4
|
$:.push File.expand_path("../lib", __FILE__)
|
5
5
|
require "adzerk"
|
6
6
|
|
7
|
-
API_KEY = ENV['ADZERK_API_KEY']
|
8
|
-
|
7
|
+
API_KEY = ENV['ADZERK_API_KEY']
|
8
|
+
raise "The ADZERK_API_KEY environment variable must be set." unless API_KEY
|
9
|
+
|
10
|
+
API_HOST = ENV['ADZERK_API_HOST'] || 'http://api.adzerk.net/v1/'
|
9
11
|
# $adzerk = Adzerk.new(API_KEY)
|
10
12
|
|
11
13
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adzerk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kacy Fortner
|
8
|
+
- James Jeffers
|
9
|
+
- James Avery
|
10
|
+
- Nate Kohari
|
11
|
+
- Rafael Chacon
|
12
|
+
- Sean Chaney
|
13
|
+
- Brec Carson
|
14
|
+
- Sam Lehman
|
15
|
+
- Dave Yarwood
|
8
16
|
autorequire:
|
9
17
|
bindir: bin
|
10
18
|
cert_chain: []
|
11
|
-
date:
|
19
|
+
date: 2015-03-07 00:00:00.000000000 Z
|
12
20
|
dependencies:
|
13
21
|
- !ruby/object:Gem::Dependency
|
14
22
|
name: rspec
|
@@ -67,7 +75,7 @@ dependencies:
|
|
67
75
|
- !ruby/object:Gem::Version
|
68
76
|
version: 3.2.8
|
69
77
|
description: Ruby library for the Adzerk API
|
70
|
-
email:
|
78
|
+
email: engineering@adzerk.com
|
71
79
|
executables: []
|
72
80
|
extensions: []
|
73
81
|
extra_rdoc_files: []
|
@@ -84,6 +92,7 @@ files:
|
|
84
92
|
- lib/adzerk/flight.rb
|
85
93
|
- lib/adzerk/geo_targeting.rb
|
86
94
|
- lib/adzerk/invitation.rb
|
95
|
+
- lib/adzerk/priority.rb
|
87
96
|
- lib/adzerk/publisher.rb
|
88
97
|
- lib/adzerk/reporting.rb
|
89
98
|
- lib/adzerk/site_zone_targeting.rb
|
@@ -130,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
139
|
version: '0'
|
131
140
|
requirements: []
|
132
141
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.4.6
|
134
143
|
signing_key:
|
135
144
|
specification_version: 4
|
136
145
|
summary: Adzerk API
|