epom 0.5 → 0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d1aeea62d6468a7d47e5314bbef87b6cf5ce482
4
- data.tar.gz: e9bf1571c0b1ac4000e66cb89fb90fa731472bb4
3
+ metadata.gz: ed69de199b68aea53df358588b94aea650b6b63a
4
+ data.tar.gz: 15b29962c1fb8d4480128df1fd78063a4021392c
5
5
  SHA512:
6
- metadata.gz: a228bba67baa29469feb6f2b70b61481c5b2a2c959dc2399f7d1003b2dd3f931eae44a9294f6efecf77aa839ca4c34f7654186d58a3a4002d3dd6d0097191ea5
7
- data.tar.gz: a47aa911961301f457e4bc2bfd2df08e6da06d0c413f175728fe1ac6d30f44db58ceda62fb2a7d042a2be5f8cd9d1e22a63878488032603825e39eeea5222e9a
6
+ metadata.gz: 77aa0de3c99ddb2251ea8812aaaf02e41a9fe588cfac82e7b0b0b5a7bbd3a2d7af930802de56ad8fcf51dc6cb7e1beaf634bd00f2899aefd3f3a27c7ee596db9
7
+ data.tar.gz: 7714e088ae212df1832a9567c474898a3a441e3ec2c80cdd827e6cdc6aa09c132031b19eca673fa685620d677b96ddf9055b500366ba2c32fee83a97224ac8ac
@@ -0,0 +1,21 @@
1
+ require 'epom/epom_element'
2
+
3
+ module Epom
4
+ class AdUnit < EpomElement
5
+
6
+ def self.extended_methods
7
+ {
8
+ :get_ad_unit_list => {
9
+ :url => '/rest-api/adunit/list.do',
10
+ :body_parameters => [:hash, :timestamp, :username],
11
+ :method => :get
12
+ }
13
+ }
14
+ end
15
+
16
+ def self.replace_params_in_url(url, url_params)
17
+ url
18
+ end
19
+
20
+ end
21
+ end
@@ -32,7 +32,11 @@ module Epom
32
32
  :body_parameters => [:name, :contactName, :contactEmail, :description, :categoryId, :hash, :timestamp, :username],
33
33
  :method => :put
34
34
  },
35
-
35
+ :get_advertisers_tree => {
36
+ :url => '/rest-api/advertisers-tree.do',
37
+ :body_parameters => [:hash, :timestamp, :username],
38
+ :method => :get
39
+ },
36
40
  }
37
41
  end
38
42
 
data/lib/epom/banner.rb CHANGED
@@ -508,6 +508,12 @@ module Epom
508
508
  :url_parameters => [:bannerId],
509
509
  :body_parameters => [:price, :paymentModel, :hash, :timestamp, :username],
510
510
  :method => :post
511
+ },
512
+ :get_linked_banners_for_placement => {
513
+ :url => '/rest-api/banner/placement/PLACEMENT_ID/banners.do',
514
+ :url_parameters => [:placementId],
515
+ :body_parameters => [:hash, :timestamp, :username],
516
+ :method => :get
511
517
  }
512
518
  }
513
519
  end
@@ -518,6 +524,7 @@ module Epom
518
524
  url.gsub!('OS_NAME', url_params[:osName]) if url.include?('OS_NAME')
519
525
  url.gsub!('TARGET_ID', url_params[:targetId]) if url.include?('TARGET_ID')
520
526
  url.gsub!('COUNTRY_CODE', url_params[:countryCode]) if url.include?('COUNTRY_CODE')
527
+ url.gsub!('PLACEMENT_ID', url_params[:placementId]) if url.include?('PLACEMENT_ID')
521
528
  url
522
529
  end
523
530
 
@@ -0,0 +1,26 @@
1
+ require 'epom/epom_element'
2
+
3
+ module Epom
4
+ class Category < EpomElement
5
+
6
+ def self.extended_methods
7
+ {
8
+ :get_advertising_categories => {
9
+ :url => '/rest-api/categories/advertising.do',
10
+ :body_parameters => [:hash, :timestamp, :username],
11
+ :method => :get
12
+ },
13
+ :get_publishing_categories => {
14
+ :url => '/rest-api/categories/publishing.do',
15
+ :body_parameters => [:hash, :timestamp, :username],
16
+ :method => :get
17
+ },
18
+ }
19
+ end
20
+
21
+ def self.replace_params_in_url(url, url_params)
22
+ url
23
+ end
24
+
25
+ end
26
+ end
data/lib/epom/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Epom
2
- VERSION = '0.5'
2
+ VERSION = '0.6'
3
3
  end
data/lib/epom.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  require 'httmultiparty'
2
2
  require 'digest'
3
3
 
4
+ require 'epom/ad_unit'
4
5
  require 'epom/advertiser'
5
6
  require 'epom/auth'
6
7
  require 'epom/banner'
7
8
  require 'epom/campaign'
9
+ require 'epom/category'
8
10
  require 'epom/epom_element'
9
11
  require 'epom/placement'
10
12
  require 'epom/publisher'
@@ -0,0 +1,29 @@
1
+ require 'test_helper'
2
+ require 'epom/ad_unit'
3
+
4
+ class AdUnitTest < ActiveSupport::TestCase
5
+ test "truth" do
6
+ assert_kind_of Class, Epom::AdUnit
7
+ end
8
+
9
+ test "get_ad_unit_list" do
10
+ timestamp = Time.now.to_i * 1000
11
+ url_params = {
12
+ }
13
+ body_params = {
14
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
15
+ :timestamp => timestamp,
16
+ :username => ENV['username'],
17
+ }
18
+
19
+ response = Epom::AdUnit.get_ad_unit_list(url_params, body_params)
20
+ assert_instance_of Array, response
21
+ if response.count > 0
22
+ first = response[0]
23
+ assert_instance_of Fixnum, first['id']
24
+ assert_instance_of Fixnum, first['height']
25
+ assert_instance_of Fixnum, first['width']
26
+ assert_instance_of String, first['name']
27
+ end
28
+ end
29
+ end
@@ -103,6 +103,27 @@ class AdvertiserTest < ActiveSupport::TestCase
103
103
  response['id']
104
104
  end
105
105
 
106
+ test "get_advertisers_tree" do
107
+ timestamp = Time.now.to_i * 1000
108
+ body_params = {
109
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
110
+ :timestamp => timestamp,
111
+ :username => ENV['username']
112
+ }
113
+ url_params = {
114
+ }
115
+
116
+ response = Epom::Advertiser.get_advertisers_tree(url_params, body_params)
117
+ assert_instance_of Array, response
118
+ if response.count > 0
119
+ first = response[0]
120
+ assert_instance_of Fixnum, first['id']
121
+ assert_instance_of Array, first['category']
122
+ assert_instance_of String, first['name']
123
+ assert_instance_of Array, first['campaigns']
124
+ end
125
+ end
126
+
106
127
  test "replace_params_in_url" do
107
128
  assert_equal "/rest-api/advertiser/#{ENV['advertiser_id']}/campaigns.do", Epom::Advertiser.replace_params_in_url('/rest-api/advertiser/ADVERTISER_ID/campaigns.do', {:advertiserId => ENV['advertiser_id']})
108
129
  end
@@ -6,33 +6,14 @@ class BannerTest < ActiveSupport::TestCase
6
6
  assert_kind_of Class, Epom::Banner
7
7
  end
8
8
 
9
- test "get_os_values" do
9
+ #TODO: create banner with LOCAL_FILE
10
+ test "create_banner" do
10
11
  timestamp = Time.now.to_i * 1000
11
- url_params = {
12
- :bannerId => ENV['banner_id']
13
- }
14
12
  body_params = {
13
+ :campaignId => ENV['campaign_id'],
15
14
  :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
16
15
  :timestamp => timestamp,
17
16
  :username => ENV['username'],
18
- }
19
-
20
- response = Epom::Banner.get_os_values(url_params, body_params)
21
- assert_instance_of Array, response
22
- if response.count > 0
23
- first = response[0]
24
- assert_instance_of String, first
25
- end
26
- end
27
-
28
- #TODO: create banner with LOCAL_FILE
29
- test "create_banner" do
30
- timestamp = Time.now.to_i * 1000
31
- body_params = {
32
- :campaignId => ENV['campaign_id'],
33
- :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
34
- :timestamp => timestamp,
35
- :username => ENV['username'],
36
17
  :weight => 1,
37
18
  :imageBannerLink => "http://beachgrooves.com/wp-content/uploads/2014/07/BeachGrooves-Logos-website2.png",
38
19
  :url => "http://www.example.com",
@@ -46,13 +27,32 @@ class BannerTest < ActiveSupport::TestCase
46
27
  # :imageFile => File.new('test/IMG_5457-128x128.JPG')
47
28
  }
48
29
 
49
- response = Epom::Banner.create_banner({}, body_params)
30
+ response = Epom::Banner.create_banner({}, body_params)
50
31
  assert_instance_of Hash, response
51
32
  assert_instance_of Fixnum, response['id']
52
33
  assert_instance_of Fixnum, response['campaignId']
53
34
  assert_equal ENV['campaign_id'].to_i, response['campaignId']
54
35
  end
55
36
 
37
+ test "get_os_values" do
38
+ timestamp = Time.now.to_i * 1000
39
+ url_params = {
40
+ :bannerId => ENV['banner_id']
41
+ }
42
+ body_params = {
43
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
44
+ :timestamp => timestamp,
45
+ :username => ENV['username'],
46
+ }
47
+
48
+ response = Epom::Banner.get_os_values(url_params, body_params)
49
+ assert_instance_of Array, response
50
+ if response.count > 0
51
+ first = response[0]
52
+ assert_instance_of String, first
53
+ end
54
+ end
55
+
56
56
  test "get_banner_ad_unit_values" do
57
57
  timestamp = Time.now.to_i * 1000
58
58
  body_params = {
@@ -88,6 +88,7 @@ class BannerTest < ActiveSupport::TestCase
88
88
  assert_instance_of Hash, response
89
89
  assert_instance_of Fixnum, response['id']
90
90
  assert_instance_of String, response['paymentModel']
91
+ response
91
92
  end
92
93
 
93
94
  test "get_placements_for_banner" do
@@ -133,62 +134,371 @@ class BannerTest < ActiveSupport::TestCase
133
134
  end
134
135
  end
135
136
 
136
- test "get_advertising_categories" do
137
+ test "get_banner" do
137
138
  timestamp = Time.now.to_i * 1000
138
139
  body_params = {
139
140
  :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
140
141
  :timestamp => timestamp,
141
142
  :username => ENV['username'],
142
143
  }
144
+ url_params = {
145
+ :bannerId => ENV['banner_id']
146
+ }
147
+
148
+ response = Epom::Banner.get_banner(url_params, body_params)
149
+ assert_instance_of Hash, response
150
+ assert_instance_of Fixnum, response['campaignId']
151
+ assert_instance_of String, response['url']
152
+ assert_instance_of String, response['name']
153
+ assert_instance_of String, response['bannerType']
154
+ assert_instance_of Fixnum, response['adUnitId']
155
+ assert_instance_of String, response['placementType']
156
+ end
157
+
158
+ #######################
159
+ #Banner Capping API
160
+ #######################
161
+
162
+ test "get_click_capping" do
163
+ timestamp = Time.now.to_i * 1000
164
+ url_params = {
165
+ :bannerId => ENV['banner_id']
166
+ }
167
+ body_params = {
168
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
169
+ :timestamp => timestamp,
170
+ :username => ENV['username'],
171
+ }
143
172
 
144
- response = Epom::Banner.get_advertising_categories({}, body_params)
173
+ response = Epom::Banner.get_click_capping(url_params, body_params)
145
174
  assert_instance_of Array, response
146
175
  if response.count > 0
147
176
  first = response[0]
148
- assert_instance_of Hash, first
149
- assert_instance_of Fixnum, first['id']
150
- assert_instance_of String, first['name']
151
- end
177
+ assert_instance_of Fixnum, first['amount']
178
+ assert_instance_of String, first['periodType']
179
+ assert_instance_of Fixnum, first['period']
180
+ end
181
+ response
152
182
  end
153
183
 
154
- test "get_banner" do
184
+ test "get_frequency_capping" do
155
185
  timestamp = Time.now.to_i * 1000
186
+ url_params = {
187
+ :bannerId => ENV['banner_id']
188
+ }
156
189
  body_params = {
157
190
  :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
158
191
  :timestamp => timestamp,
159
192
  :username => ENV['username'],
160
193
  }
194
+
195
+ response = Epom::Banner.get_frequency_capping(url_params, body_params)
196
+ assert_instance_of Array, response
197
+ if response.count > 0
198
+ first = response[0]
199
+ assert_instance_of Fixnum, first['amount']
200
+ assert_instance_of String, first['periodType']
201
+ assert_instance_of Fixnum, first['period']
202
+ end
203
+ response
204
+ end
205
+
206
+ test "set_click_capping" do
207
+ timestamp = Time.now.to_i * 1000
161
208
  url_params = {
162
209
  :bannerId => ENV['banner_id']
163
210
  }
211
+ body_params = {
212
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
213
+ :timestamp => timestamp,
214
+ :username => ENV['username'],
215
+ :amount => [1,2,3,4,5,6,7].sample,
216
+ :evenDistribution => true,
217
+ :periodType => 'HOUR',
218
+ :period => 2
219
+ }
164
220
 
165
- response = Epom::Banner.get_banner(url_params, body_params)
221
+ response = Epom::Banner.set_click_capping(url_params, body_params)
222
+
223
+ click_cappings = test_get_click_capping()
224
+ click_capping = click_cappings.find { |cc| cc['amount'] == body_params[:amount] }
225
+ assert_instance_of Hash, click_capping
226
+ assert_equal true, click_capping['evenDistribution']
227
+ assert_equal 'HOUR', click_capping['periodType']
228
+ assert_equal 2, click_capping['period']
229
+ end
230
+
231
+ test "set_frequency_capping" do
232
+ timestamp = Time.now.to_i * 1000
233
+ url_params = {
234
+ :bannerId => ENV['banner_id']
235
+ }
236
+ body_params = {
237
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
238
+ :timestamp => timestamp,
239
+ :username => ENV['username'],
240
+ :amount => [1,2,3,4,5,6,7].sample,
241
+ :evenDistribution => true,
242
+ :periodType => 'HOUR',
243
+ :period => 2
244
+ }
245
+
246
+ response = Epom::Banner.set_frequency_capping(url_params, body_params)
247
+
248
+ frequency_cappings = test_get_frequency_capping()
249
+ frequency_capping = frequency_cappings.find { |cc| cc['amount'] == body_params[:amount] }
250
+ assert_instance_of Hash, frequency_capping
251
+ assert_equal true, frequency_capping['evenDistribution']
252
+ assert_equal 'HOUR', frequency_capping['periodType']
253
+ assert_equal 2, frequency_capping['period']
254
+ end
255
+
256
+ #######################
257
+ #Banner Limits API
258
+ #######################
259
+
260
+ test "get_limits" do
261
+ timestamp = Time.now.to_i * 1000
262
+ url_params = {
263
+ :bannerId => ENV['banner_id']
264
+ }
265
+ body_params = {
266
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
267
+ :timestamp => timestamp,
268
+ :username => ENV['username'],
269
+ }
270
+
271
+ response = Epom::Banner.get_limits(url_params, body_params)
166
272
  assert_instance_of Hash, response
167
- assert_instance_of Fixnum, response['campaignId']
168
- assert_instance_of String, response['url']
169
- assert_instance_of String, response['name']
170
- assert_instance_of String, response['bannerType']
171
- assert_instance_of Fixnum, response['adUnitId']
172
- assert_instance_of String, response['placementType']
273
+ response
173
274
  end
174
275
 
175
- test "get_publishing_categories" do
276
+ test "set_limits" do
176
277
  timestamp = Time.now.to_i * 1000
278
+ url_params = {
279
+ :bannerId => ENV['banner_id'],
280
+ }
177
281
  body_params = {
178
282
  :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
179
283
  :timestamp => timestamp,
180
284
  :username => ENV['username'],
285
+ :totalImpressionsLimit => 100,
286
+ :dailyImpressionsLimit => 20,
287
+ :totalClicksLimit => 50,
288
+ :dailyClicksLimit => 10,
289
+ :totalBudgetLimit => 50,
290
+ :dailyBudgetLimit => 10,
291
+ :startDate => DateTime.now.strftime('%Y-%m-%d-%H-%M'),
292
+ :endDate => Date.tomorrow.strftime('%Y-%m-%d-%H-%M'),
181
293
  }
182
294
 
183
- response = Epom::Banner.get_publishing_categories({}, body_params)
295
+ response = Epom::Banner.set_limits(url_params, body_params)
296
+
297
+ limit = test_get_limits()
298
+ assert_instance_of Hash, limit
299
+ assert_equal body_params[:totalImpressionsLimit], limit['totalImpressionsLimit']
300
+ assert_equal body_params[:dailyImpressionsLimit], limit['dailyImpressionsLimit']
301
+ assert_equal body_params[:totalClicksLimit], limit['totalClicksLimit']
302
+ assert_equal body_params[:dailyClicksLimit], limit['dailyClicksLimit']
303
+ assert_equal body_params[:totalBudgetLimit], limit['totalBudgetLimit']
304
+ assert_equal body_params[:dailyBudgetLimit], limit['dailyBudgetLimit']
305
+ assert_equal body_params[:startDate], limit['startDate']
306
+ assert_equal body_params[:endDate], limit['endDate']
307
+ end
308
+
309
+ test "create_cookie_value_target" do
310
+ timestamp = Time.now.to_i * 1000
311
+ url_params = {
312
+ :bannerId => ENV['banner_id'],
313
+ }
314
+ body_params = {
315
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
316
+ :timestamp => timestamp,
317
+ :username => ENV['username'],
318
+ :cookieName => 'age',
319
+ :cookieValue => '20',
320
+ :rule => 'INCLUDE'
321
+ }
322
+
323
+ response = Epom::Banner.create_cookie_value_target(url_params, body_params)
324
+ assert_instance_of Hash, response
325
+ assert_instance_of Fixnum, response['id']
326
+ assert_equal body_params[:cookieName], response['cookieName']
327
+ assert_equal body_params[:cookieValue], response['cookieValue']
328
+ end
329
+
330
+ test "create_country_target" do
331
+ timestamp = Time.now.to_i * 1000
332
+ url_params = {
333
+ :bannerId => ENV['banner_id'],
334
+ }
335
+ body_params = {
336
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
337
+ :timestamp => timestamp,
338
+ :username => ENV['username'],
339
+ :countryCode => ENV['country_code'],
340
+ :rule => 'INCLUDE'
341
+ }
342
+
343
+ response = Epom::Banner.create_country_target(url_params, body_params)
344
+ assert_instance_of Hash, response
345
+ assert_instance_of Fixnum, response['id']
346
+ assert_equal 'COUNTRY', response['type']
347
+ end
348
+
349
+ test "create_custom_parameter_target" do
350
+ timestamp = Time.now.to_i * 1000
351
+ url_params = {
352
+ :bannerId => ENV['banner_id'],
353
+ }
354
+ body_params = {
355
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
356
+ :timestamp => timestamp,
357
+ :username => ENV['username'],
358
+ :expression => "($p1==1 || $p1=='a') && ($p2>=12 && $p2<=22)",
359
+ :rule => 'INCLUDE'
360
+ }
361
+
362
+ response = Epom::Banner.create_custom_parameter_target(url_params, body_params)
363
+ assert_instance_of Hash, response
364
+ assert_instance_of Fixnum, response['id']
365
+ assert_equal 'CUSTOM', response['type']
366
+ end
367
+
368
+ test "create_language_target" do
369
+ timestamp = Time.now.to_i * 1000
370
+ url_params = {
371
+ :bannerId => ENV['banner_id'],
372
+ }
373
+ body_params = {
374
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
375
+ :timestamp => timestamp,
376
+ :username => ENV['username'],
377
+ :languageCode => 'en',
378
+ :rule => 'INCLUDE'
379
+ }
380
+
381
+ response = Epom::Banner.create_language_target(url_params, body_params)
382
+ assert_instance_of Hash, response
383
+ assert_instance_of Fixnum, response['id']
384
+ assert_equal 'LANGUAGE', response['type']
385
+ end
386
+
387
+ test "disable_targeting" do
388
+ timestamp = Time.now.to_i * 1000
389
+ url_params = {
390
+ :bannerId => ENV['banner_id'],
391
+ }
392
+ body_params = {
393
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
394
+ :timestamp => timestamp,
395
+ :username => ENV['username'],
396
+ }
397
+
398
+ response = Epom::Banner.disable_targeting(url_params, body_params)
399
+ assert_not_instance_of Fixnum, response
400
+ end
401
+
402
+ test "enable_targeting" do
403
+ timestamp = Time.now.to_i * 1000
404
+ url_params = {
405
+ :bannerId => ENV['banner_id'],
406
+ }
407
+ body_params = {
408
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
409
+ :timestamp => timestamp,
410
+ :username => ENV['username'],
411
+ }
412
+
413
+ response = Epom::Banner.enable_targeting(url_params, body_params)
414
+ assert_not_instance_of Fixnum, response
415
+ end
416
+
417
+ #############################
418
+ #Banner Placement Linking API
419
+ #############################
420
+
421
+ test "get_banner_placements_list" do
422
+ timestamp = Time.now.to_i * 1000
423
+ url_params = {
424
+ :bannerId => ENV['banner_id'],
425
+ }
426
+ body_params = {
427
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
428
+ :timestamp => timestamp,
429
+ :username => ENV['username'],
430
+ }
431
+
432
+ response = Epom::Banner.get_banner_placements_list(url_params, body_params)
433
+ assert_instance_of Array, response
434
+ if response.count > 0
435
+ first = response[0]
436
+ assert_instance_of Fixnum, first['id']
437
+ assert_instance_of String, first['name']
438
+ end
439
+ response
440
+ end
441
+
442
+ test "create_or_update_banner_placements" do
443
+ timestamp = Time.now.to_i * 1000
444
+ url_params = {
445
+ :bannerId => ENV['banner_id'],
446
+ }
447
+ body_params = {
448
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
449
+ :timestamp => timestamp,
450
+ :username => ENV['username'],
451
+ :ids => ENV['placement_id']
452
+ }
453
+
454
+ response = Epom::Banner.create_or_update_banner_placements(url_params, body_params)
455
+ assert_instance_of Hash, response
456
+ assert response['success']
457
+ end
458
+
459
+ test "update_banner_pricing" do
460
+ timestamp = Time.now.to_i * 1000
461
+ url_params = {
462
+ :bannerId => ENV['banner_id'],
463
+ }
464
+ body_params = {
465
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
466
+ :timestamp => timestamp,
467
+ :username => ENV['username'],
468
+ :price => [2.1, 1.2, 3.4].sample,
469
+ # :paymentModel => 'CPM'
470
+ }
471
+
472
+ response = Epom::Banner.update_banner_pricing(url_params, body_params)
473
+ assert_not_instance_of Fixnum, response
474
+
475
+ pricing = test_get_banner_pricing()
476
+ assert_instance_of Hash, pricing
477
+ assert_instance_of Float, pricing['price']
478
+ assert_equal body_params[:price], pricing['price']
479
+ end
480
+
481
+ test "get_linked_banners_for_placement" do
482
+ timestamp = Time.now.to_i * 1000
483
+ url_params = {
484
+ :placementId => ENV['placement_id'],
485
+ }
486
+ body_params = {
487
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
488
+ :timestamp => timestamp,
489
+ :username => ENV['username'],
490
+ }
491
+
492
+ response = Epom::Banner.get_linked_banners_for_placement(url_params, body_params)
184
493
  assert_instance_of Array, response
185
494
  if response.count > 0
186
495
  first = response[0]
187
496
  assert_instance_of Hash, first
497
+ assert_instance_of Fixnum, first['campaignId']
188
498
  assert_instance_of Fixnum, first['id']
189
499
  assert_instance_of String, first['name']
190
500
  end
191
- end
501
+ end
192
502
 
193
503
  define_get_tests_auto(Epom::Banner)
194
504
  end
@@ -0,0 +1,44 @@
1
+ require 'test_helper'
2
+ require 'epom/category'
3
+
4
+ class CategoryTest < ActiveSupport::TestCase
5
+ test "truth" do
6
+ assert_kind_of Class, Epom::Category
7
+ end
8
+
9
+ test "get_publishing_categories" do
10
+ timestamp = Time.now.to_i * 1000
11
+ body_params = {
12
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
13
+ :timestamp => timestamp,
14
+ :username => ENV['username'],
15
+ }
16
+
17
+ response = Epom::Category.get_publishing_categories({}, body_params)
18
+ assert_instance_of Array, response
19
+ if response.count > 0
20
+ first = response[0]
21
+ assert_instance_of Hash, first
22
+ assert_instance_of Fixnum, first['id']
23
+ assert_instance_of String, first['name']
24
+ end
25
+ end
26
+
27
+ test "get_advertising_categories" do
28
+ timestamp = Time.now.to_i * 1000
29
+ body_params = {
30
+ :hash => Epom.create_hash(Epom.create_hash(ENV['password']), timestamp),
31
+ :timestamp => timestamp,
32
+ :username => ENV['username'],
33
+ }
34
+
35
+ response = Epom::Category.get_advertising_categories({}, body_params)
36
+ assert_instance_of Array, response
37
+ if response.count > 0
38
+ first = response[0]
39
+ assert_instance_of Hash, first
40
+ assert_instance_of Fixnum, first['id']
41
+ assert_instance_of String, first['name']
42
+ end
43
+ end
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epom
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Quintero
@@ -105,6 +105,7 @@ files:
105
105
  - README.rdoc
106
106
  - Rakefile
107
107
  - lib/epom.rb
108
+ - lib/epom/ad_unit.rb
108
109
  - lib/epom/ad_unit_size.rb
109
110
  - lib/epom/advertiser.rb
110
111
  - lib/epom/analytic.rb
@@ -112,6 +113,7 @@ files:
112
113
  - lib/epom/banner.rb
113
114
  - lib/epom/banner_type.rb
114
115
  - lib/epom/campaign.rb
116
+ - lib/epom/category.rb
115
117
  - lib/epom/day_of_week.rb
116
118
  - lib/epom/epom_element.rb
117
119
  - lib/epom/limit_counters.rb
@@ -160,11 +162,13 @@ files:
160
162
  - test/dummy/public/422.html
161
163
  - test/dummy/public/500.html
162
164
  - test/dummy/public/favicon.ico
165
+ - test/epom/ad_unit_test.rb
163
166
  - test/epom/advertiser_test.rb
164
167
  - test/epom/analytic_test.rb
165
168
  - test/epom/auth_test.rb
166
169
  - test/epom/banner_test.rb
167
170
  - test/epom/campaign_test.rb
171
+ - test/epom/category_test.rb
168
172
  - test/epom/placement_test.rb
169
173
  - test/epom/site_test.rb
170
174
  - test/epom/zone_test.rb
@@ -207,11 +211,13 @@ test_files:
207
211
  - test/epom/zone_test.rb
208
212
  - test/epom/site_test.rb
209
213
  - test/epom/placement_test.rb
214
+ - test/epom/category_test.rb
210
215
  - test/epom/campaign_test.rb
211
216
  - test/epom/banner_test.rb
212
217
  - test/epom/auth_test.rb
213
218
  - test/epom/analytic_test.rb
214
219
  - test/epom/advertiser_test.rb
220
+ - test/epom/ad_unit_test.rb
215
221
  - test/dummy/config.ru
216
222
  - test/dummy/Rakefile
217
223
  - test/dummy/README.rdoc