adzerk 0.12 → 0.17

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.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/lib/adzerk.rb +6 -0
  3. data/lib/adzerk/advertiser.rb +11 -0
  4. data/lib/adzerk/api_endpoint.rb +6 -5
  5. data/lib/adzerk/campaign.rb +15 -0
  6. data/lib/adzerk/category.rb +3 -3
  7. data/lib/adzerk/channel.rb +9 -0
  8. data/lib/adzerk/channel_site_map.rb +1 -1
  9. data/lib/adzerk/client.rb +92 -27
  10. data/lib/adzerk/creative.rb +2 -2
  11. data/lib/adzerk/creative_map.rb +7 -2
  12. data/lib/adzerk/creative_template.rb +30 -0
  13. data/lib/adzerk/day_parting.rb +23 -0
  14. data/lib/adzerk/errors.rb +0 -0
  15. data/lib/adzerk/flight.rb +25 -3
  16. data/lib/adzerk/geo_targeting.rb +0 -0
  17. data/lib/adzerk/instant_count.rb +21 -0
  18. data/lib/adzerk/invitation.rb +0 -0
  19. data/lib/adzerk/priority.rb +0 -0
  20. data/lib/adzerk/publisher.rb +14 -0
  21. data/lib/adzerk/reporting.rb +0 -0
  22. data/lib/adzerk/scheduled_reporting.rb +24 -0
  23. data/lib/adzerk/site_zone_targeting.rb +0 -0
  24. data/lib/adzerk/util.rb +7 -2
  25. data/lib/adzerk/version.rb +1 -1
  26. data/test/adtype_api_spec.rb +0 -0
  27. data/test/advertiser_api_spec.rb +8 -0
  28. data/test/campaign_api_spec.rb +19 -5
  29. data/test/category_api_spec.rb +7 -3
  30. data/test/channel_api_spec.rb +6 -1
  31. data/test/channel_site_map_api_spec.rb +0 -0
  32. data/test/creative_api_spec.rb +0 -0
  33. data/test/creative_map_api_spec.rb +10 -33
  34. data/test/creative_template_spec.rb +100 -0
  35. data/test/day_parting_api_spec.rb +102 -0
  36. data/test/flight_api_spec.rb +28 -1
  37. data/test/geo_targeting_api_spec.rb +1 -1
  38. data/test/instant_count_api_spec.rb +55 -0
  39. data/test/invitation_api_spec.rb +0 -0
  40. data/test/login_api_spec.rb +10 -3
  41. data/test/priority_api_spec.rb +0 -0
  42. data/test/publisher_api_spec.rb +0 -0
  43. data/test/rakefile.rb +0 -0
  44. data/test/report_api_spec.rb +2 -2
  45. data/test/scheduled_reporting_api_spec.rb +60 -0
  46. data/test/security_api_spec.rb +0 -0
  47. data/test/site_api_spec.rb +0 -0
  48. data/test/site_zone_targeting_api_spec.rb +1 -1
  49. data/test/spec_helper.rb +0 -0
  50. data/test/util_spec.rb +0 -0
  51. data/test/zone_api_spec.rb +0 -0
  52. metadata +17 -8
@@ -159,7 +159,8 @@ describe "Flight API" do
159
159
  :start_date => $flight_StartDate,
160
160
  :goal_type => $flight_GoalType,
161
161
  :impressions => $flight_Impressions,
162
- :is_companion => false)
162
+ :is_companion => false,
163
+ :end_date => $flight_EndDate)
163
164
  expect(flight[:name]).to eq("New Flight Name")
164
165
  expect(flight[:is_companion]).to be false
165
166
  end
@@ -169,6 +170,15 @@ describe "Flight API" do
169
170
  expect(flights.length).to be > 0
170
171
  end
171
172
 
173
+ it "should get flight instant counts" do
174
+ data = {
175
+ start: "2021-04-04",
176
+ end: "2021-04-20"
177
+ }
178
+ count = @flights.instant_counts($flight_id, data)
179
+ expect(count.length).to be > 0
180
+ end
181
+
172
182
  it "should delete a new flight" do
173
183
  response = @flights.delete($flight_id)
174
184
  expect(response.body).to eq('"Successfully deleted"')
@@ -249,4 +259,21 @@ describe "Flight API" do
249
259
  )
250
260
  }.to raise_error "This campaign is not part of your network"
251
261
  end
262
+
263
+ it "should list countries" do
264
+ response = @flights.countries()
265
+ expect(response.length).to be > 0
266
+ end
267
+
268
+ it "should list metro codes for region" do
269
+ region_code = "MN"
270
+ response = @flights.regions(region_code)
271
+ expect(response.length).to be > 0
272
+ end
273
+
274
+ it "should list regions for a country" do
275
+ country_code = "US"
276
+ response = @flights.list_regions_for_country(country_code)
277
+ expect(response.length).to be > 0
278
+ end
252
279
  end
@@ -112,7 +112,7 @@ describe "GeoTargeting API" do
112
112
  it "should error when deleting a geotargeting that does not exist" do
113
113
  expect {
114
114
  @geotargetings.delete($flight_id, 1)
115
- }.to raise_error "Couldn't find network for model: PassLocation, id: 1"
115
+ }.to raise_error "This PassLocation does not exist in your network."
116
116
  end
117
117
 
118
118
  it "should check if a flight is not a part of your network" do
@@ -0,0 +1,55 @@
1
+ require 'pp'
2
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
+
4
+ describe "Instant Count API" do
5
+ before(:all) do
6
+ client = Adzerk::Client.new(API_KEY)
7
+ @instant_counts = client.instant_counts
8
+ @advertisers = client.advertisers
9
+ @campaigns = client.campaigns
10
+
11
+ advertiser = @advertisers.create(:title => "test")
12
+ @advertiser_id = advertiser[:id]
13
+
14
+ campaign = @campaigns.
15
+ create(:name => 'Test campaign ' + rand(1000000).to_s,
16
+ :start_date => "1/1/2011",
17
+ :end_date => "12/31/2011",
18
+ :is_active => false,
19
+ :price => '10.00',
20
+ :advertiser_id => @advertiser_id,
21
+ :flights => [],
22
+ :is_deleted => false)
23
+ @campaign_id = campaign[:id]
24
+ end
25
+
26
+ after(:all) do
27
+ @campaigns.delete(@campaign_id)
28
+ @advertisers.delete(@advertiser_id)
29
+ end
30
+
31
+ it "should fetch bulk instant counts" do
32
+ advertiser_id = @advertiser_id
33
+ campaign_id = @campaign_id
34
+
35
+ counts = @instant_counts.bulk({
36
+ :advertisers => [advertiser_id],
37
+ :campaigns => [campaign_id]
38
+ })
39
+
40
+ expect(counts).to have_key(:advertisers)
41
+ expect(counts[:advertisers]).to have_key(advertiser_id.to_s.to_sym)
42
+
43
+ expect(counts).to have_key(:campaigns)
44
+ expect(counts[:campaigns]).to have_key(campaign_id.to_s.to_sym)
45
+ end
46
+
47
+ it "should get network instant counts" do
48
+ data = {
49
+ start: "2021-04-04",
50
+ end: "2021-04-20"
51
+ }
52
+ count = @instant_counts.network_counts(data)
53
+ expect(count.length).to be > 0
54
+ end
55
+ end
File without changes
@@ -1,5 +1,9 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
+ def random_email
4
+ "test@email-#{rand(1000000)}.com"
5
+ end
6
+
3
7
  describe "Login_API" do
4
8
 
5
9
  before do
@@ -7,13 +11,14 @@ describe "Login_API" do
7
11
  end
8
12
 
9
13
  it "should create a new login" do
10
- email = "test@email_#{rand(1000000)}.com"
14
+ email = random_email()
11
15
  login = @logins.create(:email => email,
12
16
  :password => '1234567',
13
17
  :name => "John Doe")
14
18
  $login_id = login[:id]
15
19
  expect(login[:email]).to eq(email)
16
- expect(login[:password]).to eq("1234567")
20
+ # Password is redacted in the response.
21
+ expect(login[:password]).to eq("")
17
22
  expect(login[:name]).to eq("John Doe")
18
23
  end
19
24
 
@@ -28,8 +33,10 @@ describe "Login_API" do
28
33
  end
29
34
 
30
35
  it "should update a login" do
36
+ new_email = random_email()
31
37
  login = @logins.update(:id => $login_id,
32
- :name => "New Name")
38
+ :name => "New Name",
39
+ :email => new_email)
33
40
  expect(login[:name]).to eq("New Name")
34
41
  end
35
42
 
File without changes
File without changes
data/test/rakefile.rb CHANGED
File without changes
@@ -6,7 +6,7 @@ describe "Report API" do
6
6
  @reports = Adzerk::Client.new(API_KEY).reports
7
7
 
8
8
  $new_report = {
9
- :start_date => "1/15/2011",
9
+ :start_date => "01/15/2011",
10
10
  :end_date => "12/31/2011",
11
11
  :group_by => ['month'],
12
12
  'Top30countries' => false,
@@ -36,7 +36,7 @@ describe "Report API" do
36
36
  end
37
37
 
38
38
  it "should return a status of 1 if the report isn't ready yet" do
39
- bigger_report = $new_report.update(start_date: "1/1/2014", end_date: "10/1/2018")
39
+ bigger_report = $new_report.update(start_date: "01/01/2014", end_date: "10/01/2018")
40
40
  report_id = @reports.create_queued_report(bigger_report)[:id]
41
41
  # immediately poll for the result
42
42
  response = @reports.retrieve_queued_report(report_id)
@@ -0,0 +1,60 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Reporting API" do
4
+ before(:all) do
5
+ client = Adzerk::Client.new(API_KEY)
6
+ @scheduled_reports = client.scheduled_reports
7
+ end
8
+
9
+ it "should create a scheduled report" do
10
+ $name = 'Test Report' + rand(1000000).to_s
11
+ $login_id = 25218
12
+ $kickoff_date = '2020-02-02T00:00:00'
13
+ $scheduling_window = 1
14
+ $recurrence_type = 2
15
+ data = {
16
+ :name => $name,
17
+ :login_id => $login_id,
18
+ :kickoff_date => $kickoff_date,
19
+ :scheduling_window => $scheduling_window,
20
+ :recurrence_type => $recurrence_type,
21
+ :criteria => {
22
+ :start_date_iso => '2020-01-01T00:00:00',
23
+ :end_date_iso => '2020-11-23T23:59:59',
24
+ :group_by => ['month'],
25
+ :parameters => [{
26
+ :country_code => 'US'
27
+ }],
28
+ },
29
+ :emails => ['cbensel@kevel.co'],
30
+ :show_events => true,
31
+ :show_click_bucketing => true,
32
+ :show_revenue => true,
33
+ :show_conversions => true,
34
+ }
35
+
36
+ response = @scheduled_reports.create(data)
37
+ expect($name).to eq(response[:name])
38
+ expect($login_id).to eq(response[:login_id])
39
+ expect($kickoff_date).to eq(response[:kickoff_date])
40
+ expect($scheduling_window).to eq(response[:scheduling_window])
41
+ expect($recurrence_type).to eq(response[:recurrence_type])
42
+ $report_id = response[:id]
43
+ end
44
+
45
+ it "should get a single report" do
46
+ response = @scheduled_reports.get($report_id)
47
+ expect($report_id).to eq(response[:id])
48
+ expect($name).to eq(response[:name])
49
+ end
50
+
51
+ it "should list all reports for account" do
52
+ response = @scheduled_reports.list()
53
+ expect(response.length).to be > 0
54
+ end
55
+
56
+ it "should delete a report" do
57
+ response = @scheduled_reports.delete($report_id)
58
+ expect(response).to eq('Successfully deleted')
59
+ end
60
+ end
File without changes
File without changes
@@ -127,7 +127,7 @@ describe "SiteZoneTargeting API" do
127
127
  it "should error when deleting a sitezone targeting that does not exist" do
128
128
  expect {
129
129
  @sitezonetargeting.delete($flight_id,1)
130
- }.to raise_error "Couldn't find network for model: PassSiteMap, id: 1"
130
+ }.to raise_error "This PassSiteMap does not exist in your network."
131
131
  end
132
132
 
133
133
  it "should check if a flight is not a part of your network" do
data/test/spec_helper.rb CHANGED
File without changes
data/test/util_spec.rb CHANGED
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adzerk
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.17'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kacy Fortner
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2017-04-14 00:00:00.000000000 Z
20
+ date: 2021-04-30 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rspec
@@ -39,14 +39,14 @@ dependencies:
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 12.0.0
42
+ version: 12.3.3
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 12.0.0
49
+ version: 12.3.3
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: json
52
52
  requirement: !ruby/object:Gem::Requirement
@@ -81,14 +81,14 @@ dependencies:
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '3.2'
84
+ version: '5.1'
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '3.2'
91
+ version: '5.1'
92
92
  description: Ruby library for the Adzerk API
93
93
  email: engineering@adzerk.com
94
94
  executables: []
@@ -98,18 +98,24 @@ files:
98
98
  - lib/adzerk.rb
99
99
  - lib/adzerk/advertiser.rb
100
100
  - lib/adzerk/api_endpoint.rb
101
+ - lib/adzerk/campaign.rb
101
102
  - lib/adzerk/category.rb
103
+ - lib/adzerk/channel.rb
102
104
  - lib/adzerk/channel_site_map.rb
103
105
  - lib/adzerk/client.rb
104
106
  - lib/adzerk/creative.rb
105
107
  - lib/adzerk/creative_map.rb
108
+ - lib/adzerk/creative_template.rb
109
+ - lib/adzerk/day_parting.rb
106
110
  - lib/adzerk/errors.rb
107
111
  - lib/adzerk/flight.rb
108
112
  - lib/adzerk/geo_targeting.rb
113
+ - lib/adzerk/instant_count.rb
109
114
  - lib/adzerk/invitation.rb
110
115
  - lib/adzerk/priority.rb
111
116
  - lib/adzerk/publisher.rb
112
117
  - lib/adzerk/reporting.rb
118
+ - lib/adzerk/scheduled_reporting.rb
113
119
  - lib/adzerk/site_zone_targeting.rb
114
120
  - lib/adzerk/util.rb
115
121
  - lib/adzerk/version.rb
@@ -121,14 +127,18 @@ files:
121
127
  - test/channel_site_map_api_spec.rb
122
128
  - test/creative_api_spec.rb
123
129
  - test/creative_map_api_spec.rb
130
+ - test/creative_template_spec.rb
131
+ - test/day_parting_api_spec.rb
124
132
  - test/flight_api_spec.rb
125
133
  - test/geo_targeting_api_spec.rb
134
+ - test/instant_count_api_spec.rb
126
135
  - test/invitation_api_spec.rb
127
136
  - test/login_api_spec.rb
128
137
  - test/priority_api_spec.rb
129
138
  - test/publisher_api_spec.rb
130
139
  - test/rakefile.rb
131
140
  - test/report_api_spec.rb
141
+ - test/scheduled_reporting_api_spec.rb
132
142
  - test/security_api_spec.rb
133
143
  - test/site_api_spec.rb
134
144
  - test/site_zone_targeting_api_spec.rb
@@ -154,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
164
  - !ruby/object:Gem::Version
155
165
  version: '0'
156
166
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.5.1
167
+ rubygems_version: 3.1.2
159
168
  signing_key:
160
169
  specification_version: 4
161
170
  summary: Adzerk API