epom 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +28 -0
  5. data/config/application.yml +41 -0
  6. data/lib/epom.rb +22 -0
  7. data/lib/epom/ad_unit_size.rb +15 -0
  8. data/lib/epom/advertiser.rb +45 -0
  9. data/lib/epom/auth.rb +31 -0
  10. data/lib/epom/banner.rb +525 -0
  11. data/lib/epom/banner_type.rb +15 -0
  12. data/lib/epom/campaign.rb +508 -0
  13. data/lib/epom/day_of_week.rb +11 -0
  14. data/lib/epom/epom_element.rb +61 -0
  15. data/lib/epom/limit_counters.rb +10 -0
  16. data/lib/epom/payment_model.rb +9 -0
  17. data/lib/epom/period_type.rb +9 -0
  18. data/lib/epom/placement.rb +56 -0
  19. data/lib/epom/placement_type.rb +7 -0
  20. data/lib/epom/publisher.rb +6 -0
  21. data/lib/epom/relation.rb +9 -0
  22. data/lib/epom/site.rb +84 -0
  23. data/lib/epom/version.rb +3 -0
  24. data/lib/epom/zone.rb +38 -0
  25. data/lib/tasks/epom_tasks.rake +4 -0
  26. data/test/IMG_5457-128x128.JPG +0 -0
  27. data/test/dummy/README.rdoc +28 -0
  28. data/test/dummy/Rakefile +6 -0
  29. data/test/dummy/app/assets/javascripts/application.js +13 -0
  30. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  31. data/test/dummy/app/controllers/application_controller.rb +5 -0
  32. data/test/dummy/app/helpers/application_helper.rb +2 -0
  33. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  34. data/test/dummy/bin/bundle +3 -0
  35. data/test/dummy/bin/rails +4 -0
  36. data/test/dummy/bin/rake +4 -0
  37. data/test/dummy/bin/setup +29 -0
  38. data/test/dummy/config.ru +4 -0
  39. data/test/dummy/config/application.rb +26 -0
  40. data/test/dummy/config/boot.rb +5 -0
  41. data/test/dummy/config/database.yml +25 -0
  42. data/test/dummy/config/environment.rb +5 -0
  43. data/test/dummy/config/environments/development.rb +41 -0
  44. data/test/dummy/config/environments/production.rb +79 -0
  45. data/test/dummy/config/environments/test.rb +42 -0
  46. data/test/dummy/config/initializers/assets.rb +11 -0
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  48. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +4 -0
  52. data/test/dummy/config/initializers/session_store.rb +3 -0
  53. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  54. data/test/dummy/config/locales/en.yml +23 -0
  55. data/test/dummy/config/routes.rb +56 -0
  56. data/test/dummy/config/secrets.yml +22 -0
  57. data/test/dummy/db/development.sqlite3 +0 -0
  58. data/test/dummy/db/schema.rb +16 -0
  59. data/test/dummy/db/test.sqlite3 +0 -0
  60. data/test/dummy/log/development.log +4 -0
  61. data/test/dummy/log/test.log +17350 -0
  62. data/test/dummy/public/404.html +67 -0
  63. data/test/dummy/public/422.html +67 -0
  64. data/test/dummy/public/500.html +66 -0
  65. data/test/dummy/public/favicon.ico +0 -0
  66. data/test/epom/advertiser_test.rb +85 -0
  67. data/test/epom/auth_test.rb +50 -0
  68. data/test/epom/banner_test.rb +194 -0
  69. data/test/epom/campaign_test.rb +65 -0
  70. data/test/epom/placement_test.rb +53 -0
  71. data/test/epom/site_test.rb +136 -0
  72. data/test/epom/zone_test.rb +67 -0
  73. data/test/epom_test.rb +38 -0
  74. data/test/logo-128x128.png +0 -0
  75. data/test/test.php +51 -0
  76. data/test/test.rb +21 -0
  77. data/test/test_helper.rb +55 -0
  78. metadata +256 -0
@@ -0,0 +1,15 @@
1
+ module Epom
2
+ class BannerType
3
+ LOCAL_FILE = 'LOCAL_FILE'
4
+ EXTERNAL_FILE = 'EXTERNAL_FILE'
5
+ CODE = 'CODE'
6
+ MOBILE_ADVERTISING_NETWORK = 'MOBILE_ADVERTISING_NETWORK'
7
+ APPLICATION_ADVERTISING_NETWORK = 'APPLICATION_ADVERTISING_NETWORK'
8
+ LOCAL_VIDEO = 'LOCAL_VIDEO'
9
+ EXTERNAL_VIDEO = 'EXTERNAL_VIDEO'
10
+ URL = 'URL'
11
+ VAST_2_0_TAG_URL = 'VAST_2_0_TAG_URL'
12
+ TEMPLATE = 'TEMPLATE'
13
+ OPENRTB_DSP = 'OPENRTB_DSP'
14
+ end
15
+ end
@@ -0,0 +1,508 @@
1
+ require 'epom/epom_element'
2
+
3
+ module Epom
4
+ class Campaign < EpomElement
5
+
6
+ def self.extended_methods
7
+ {
8
+ :create_campaign => {
9
+ :url => '/rest-api/campaign/create.do',
10
+ :body_parameters => [:name, :advertiserId, :description, :active, :ctrOptimization, :weight, :allowNewPlacementsAutolinking, :autolinkCategories, :hash, :timestamp, :username],
11
+ :method => :post
12
+ },
13
+ :delete_campaign => {
14
+ :url => '/rest-api/campaign/CAMPAIGN_ID/delete.do',
15
+ :url_parameters => [:campaignId],
16
+ :body_parameters => [:hash, :timestamp, :username],
17
+ :method => :post
18
+ },
19
+ :get_banners_for_campaign => {
20
+ :url => '/rest-api/campaign/CAMPAIGN_ID/banners.do',
21
+ :url_parameters => [:campaignId],
22
+ :body_parameters => [:hash, :timestamp, :username],
23
+ :method => :get
24
+ },
25
+ :update_campaign => {
26
+ :url => '/rest-api/campaign/CAMPAIGN_ID/update.do',
27
+ :url_parameters => [:campaignId],
28
+ :body_parameters => [:name, :advertiserId, :description, :active, :ctrOptimization, :weight, :allowNewPlacementsAutolinking, :autolinkCategories, :hash, :timestamp, :username],
29
+ :method => :post
30
+ },
31
+
32
+ ###########################
33
+ # Campaign Capping API
34
+ ###########################
35
+
36
+ :get_action_capping => {
37
+ :url => '/rest-api/campaign/CAMPAIGN_ID/actionCapping.do',
38
+ :url_parameters => [:campaignId],
39
+ :body_parameters => [:hash, :timestamp, :username],
40
+ :method => :get
41
+ },
42
+ :get_click_capping => {
43
+ :url => '/rest-api/campaign/CAMPAIGN_ID/clickCapping.do',
44
+ :url_parameters => [:campaignId],
45
+ :body_parameters => [:hash, :timestamp, :username],
46
+ :method => :get
47
+ },
48
+ :get_frequency_capping => {
49
+ :url => '/rest-api/campaign/CAMPAIGN_ID/frequencyCapping.do',
50
+ :url_parameters => [:campaignId],
51
+ :body_parameters => [:hash, :timestamp, :username],
52
+ :method => :get
53
+ },
54
+
55
+ :remove_action_capping => {
56
+ :url => '/rest-api/campaign/CAMPAIGN_ID/actionCapping.do',
57
+ :url_parameters => [:campaignId],
58
+ :body_parameters => [:hash, :timestamp, :username],
59
+ :method => :delete
60
+ },
61
+ :remove_click_capping => {
62
+ :url => '/rest-api/campaign/CAMPAIGN_ID/clickCapping.do',
63
+ :url_parameters => [:campaignId],
64
+ :body_parameters => [:hash, :timestamp, :username],
65
+ :method => :delete
66
+ },
67
+ :remove_frequency_capping => {
68
+ :url => '/rest-api/campaign/CAMPAIGN_ID/frequencyCapping.do',
69
+ :url_parameters => [:campaignId],
70
+ :body_parameters => [:hash, :timestamp, :username],
71
+ :method => :delete
72
+ },
73
+
74
+ :set_action_capping => {
75
+ :url => '/rest-api/campaign/CAMPAIGN_ID/actionCapping/set.do',
76
+ :url_parameters => [:campaignId],
77
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
78
+ :method => :post
79
+ },
80
+ :set_click_capping => {
81
+ :url => '/rest-api/campaign/CAMPAIGN_ID/clickCapping/set.do',
82
+ :url_parameters => [:campaignId],
83
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
84
+ :method => :post
85
+ },
86
+ :set_frequency_capping => {
87
+ :url => '/rest-api/campaign/CAMPAIGN_ID/frequencyCapping/set.do',
88
+ :url_parameters => [:campaignId],
89
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
90
+ :method => :post
91
+ },
92
+
93
+ :update_action_capping => {
94
+ :url => '/rest-api/campaign/CAMPAIGN_ID/frequencyCapping/update.do',
95
+ :url_parameters => [:campaignId],
96
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
97
+ :method => :post
98
+ },
99
+ :update_click_capping => {
100
+ :url => '/rest-api/campaign/CAMPAIGN_ID/clickCapping/update.do',
101
+ :url_parameters => [:campaignId],
102
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
103
+ :method => :post
104
+ },
105
+ :update_frequency_capping => {
106
+ :url => '/rest-api/campaign/CAMPAIGN_ID/frequencyCapping/update.do',
107
+ :url_parameters => [:campaignId],
108
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
109
+ :method => :post
110
+ },
111
+
112
+ ###########################
113
+ # Campaign Limits API
114
+ ###########################
115
+
116
+ :disable_limits => {
117
+ :url => '/rest-api/campaign/CAMPAIGN_ID/limits.do',
118
+ :url_parameters => [:campaignId],
119
+ :body_parameters => [:hash, :timestamp, :username],
120
+ :method => :delete
121
+ },
122
+ :get_limits => {
123
+ :url => '/rest-api/campaign/CAMPAIGN_ID/limits.do',
124
+ :url_parameters => [:campaignId],
125
+ :body_parameters => [:hash, :timestamp, :username],
126
+ :method => :get
127
+ },
128
+ :reset_limits => {
129
+ :url => '/rest-api/campaign/CAMPAIGN_ID/limits/reset.do',
130
+ :url_parameters => [:campaignId],
131
+ :body_parameters => [:limitCounters, :limitCounters, :hash, :timestamp, :username],
132
+ :method => :delete
133
+ },
134
+ :set_limits => {
135
+ :url => '/rest-api/campaign/CAMPAIGN_ID/limits/set.do',
136
+ :url_parameters => [:campaignId],
137
+ :body_parameters => [:totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :dailyBudget, :startDate, :endDate, :totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :dailyBudget, :hash, :timestamp, :username],
138
+ :method => :post
139
+ },
140
+ :update_limits => {
141
+ :url => '/rest-api/campaign/CAMPAIGN_ID/limits/update.do',
142
+ :url_parameters => [:campaignId],
143
+ :body_parameters => [:totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :dailyBudget, :startDate, :endDate, :totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :dailyBudget, :hash, :timestamp, :username],
144
+ :method => :post
145
+ },
146
+
147
+
148
+ ###########################
149
+ # Campaign Targeting API
150
+ ###########################
151
+
152
+ :create_browser_target => {
153
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/browser/create.do',
154
+ :url_parameters => [:campaignId],
155
+ :body_parameters => [:browser, :relation, :browserVersion, :rule, :hash, :timestamp, :username],
156
+ :method => :post
157
+ },
158
+ :create_channel_target => {
159
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/channel/create.do',
160
+ :url_parameters => [:campaignId],
161
+ :body_parameters => [:channel, :rule, :hash, :timestamp, :username],
162
+ :method => :post
163
+ },
164
+ :create_cookie_value_target => {
165
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/cookie/create.do',
166
+ :url_parameters => [:campaignId],
167
+ :body_parameters => [:cookieName, :cookieValue, :rule, :hash, :timestamp, :username],
168
+ :method => :post
169
+ },
170
+ :create_country_target => {
171
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/country/create.do',
172
+ :url_parameters => [:campaignId],
173
+ :body_parameters => [:countryCode, :rule, :hash, :timestamp, :username],
174
+ :method => :post
175
+ },
176
+ :create_custom_parameter_target => {
177
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/custom/create.do',
178
+ :url_parameters => [:campaignId],
179
+ :body_parameters => [:expression, :rule, :hash, :timestamp, :username],
180
+ :method => :post
181
+ },
182
+ :create_day_of_week_target => {
183
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/dayofweek/create.do',
184
+ :url_parameters => [:campaignId],
185
+ :body_parameters => [:dayOfWeek, :rule, :hash, :timestamp, :username],
186
+ :method => :post
187
+ },
188
+ :create_device_format_target => {
189
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/deviceformat/create.do',
190
+ :url_parameters => [:campaignId],
191
+ :body_parameters => [:deviceFormat, :rule, :hash, :timestamp, :username],
192
+ :method => :post
193
+ },
194
+ :create_device_target => {
195
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/device/create.do',
196
+ :url_parameters => [:campaignId],
197
+ :body_parameters => [:device, :rule, :hash, :timestamp, :username],
198
+ :method => :post
199
+ },
200
+ :create_device_vendor_target => {
201
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/devicevendor/create.do',
202
+ :url_parameters => [:campaignId],
203
+ :body_parameters => [:deviceVendor, :rule, :hash, :timestamp, :username],
204
+ :method => :post
205
+ },
206
+ :create_domain_target => {
207
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/domain/create.do',
208
+ :url_parameters => [:campaignId],
209
+ :body_parameters => [:domain, :rule, :hash, :timestamp, :username],
210
+ :method => :post
211
+ },
212
+ :create_ip_range_target => {
213
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/iprange/create.do',
214
+ :url_parameters => [:campaignId],
215
+ :body_parameters => [:ipFrom, :ipTo, :rule, :hash, :timestamp, :username],
216
+ :method => :post
217
+ },
218
+ :create_language_target => {
219
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/language/create.do',
220
+ :url_parameters => [:campaignId],
221
+ :body_parameters => [:languageCode, :rule, :hash, :timestamp, :username],
222
+ :method => :post
223
+ },
224
+ :create_location_target => {
225
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/location/create.do',
226
+ :url_parameters => [:campaignId],
227
+ :body_parameters => [:countryCode, :regionName, :cityName, :rule, :hash, :timestamp, :username],
228
+ :method => :post
229
+ },
230
+ :create_mobile_carrier_target => {
231
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/mobilecarrier/create.do',
232
+ :url_parameters => [:campaignId],
233
+ :body_parameters => [:mobileCarriers, :rule, :hash, :timestamp, :username],
234
+ :method => :post
235
+ },
236
+ :create_os_target => {
237
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/os/create.do',
238
+ :url_parameters => [:campaignId],
239
+ :body_parameters => [:operatingSystem, :rule, :hash, :timestamp, :username],
240
+ :method => :post
241
+ },
242
+ :create_screen_resolution_target => {
243
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/resolution/create.do',
244
+ :url_parameters => [:campaignId],
245
+ :body_parameters => [:relation, :screenWidth, :screenHeight, :rule, :hash, :timestamp, :username],
246
+ :method => :post
247
+ },
248
+ :create_time_range_target => {
249
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/timerange/create.do',
250
+ :url_parameters => [:campaignId],
251
+ :body_parameters => [:timeFrom, :timeTo, :rule, :hash, :timestamp, :username],
252
+ :method => :post
253
+ },
254
+ :create_wifi_traffic_target => {
255
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/wifi/create.do',
256
+ :url_parameters => [:campaignId],
257
+ :body_parameters => [:rule, :hash, :timestamp, :username],
258
+ :method => :post
259
+ },
260
+ :disable_targeting => {
261
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/disable.do',
262
+ :url_parameters => [:campaignId],
263
+ :body_parameters => [:hash, :timestamp, :username],
264
+ :method => :post
265
+ },
266
+ :enable_targeting => {
267
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/enable.do',
268
+ :url_parameters => [:campaignId],
269
+ :body_parameters => [:hash, :timestamp, :username],
270
+ :method => :post
271
+ },
272
+
273
+ :get_browsers => {
274
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/browsers/values.do',
275
+ :url_parameters => [:campaignId],
276
+ :body_parameters => [:hash, :timestamp, :username],
277
+ :method => :get
278
+ },
279
+ :get_chrome_browsers => {
280
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/browsers/chrome/values.do',
281
+ :url_parameters => [:campaignId],
282
+ :body_parameters => [:hash, :timestamp, :username],
283
+ :method => :get
284
+ },
285
+ :get_firefox_browsers => {
286
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/browsers/firefox/values.do',
287
+ :url_parameters => [:campaignId],
288
+ :body_parameters => [:hash, :timestamp, :username],
289
+ :method => :get
290
+ },
291
+ :get_ie_browsers => {
292
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/browsers/ie/values.do',
293
+ :url_parameters => [:campaignId],
294
+ :body_parameters => [:hash, :timestamp, :username],
295
+ :method => :get
296
+ },
297
+ :get_safari_browsers => {
298
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/browsers/safari/values.do',
299
+ :url_parameters => [:campaignId],
300
+ :body_parameters => [:hash, :timestamp, :username],
301
+ :method => :get
302
+ },
303
+
304
+ :get_country_regions => {
305
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/country/region/values.do',
306
+ :url_parameters => [:campaignId],
307
+ :body_parameters => [:countryCode, :hash, :timestamp, :username],
308
+ :method => :get
309
+ },
310
+ :get_device_format_values => {
311
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/device/format/values.do',
312
+ :url_parameters => [:campaignId],
313
+ :body_parameters => [:hash, :timestamp, :username],
314
+ :method => :get
315
+ },
316
+ :get_device_values => {
317
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/device/values.do',
318
+ :url_parameters => [:campaignId],
319
+ :body_parameters => [:hash, :timestamp, :username],
320
+ :method => :get
321
+ },
322
+ :get_device_vendor_values => {
323
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/device/vendor/values.do',
324
+ :url_parameters => [:campaignId],
325
+ :body_parameters => [:hash, :timestamp, :username],
326
+ :method => :get
327
+ },
328
+ :get_languages => {
329
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/language/values.do',
330
+ :url_parameters => [:campaignId],
331
+ :body_parameters => [:hash, :timestamp, :username],
332
+ :method => :get
333
+ },
334
+ :get_mobile_carriers => {
335
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/mobilecarriers/values.do',
336
+ :url_parameters => [:campaignId],
337
+ :body_parameters => [:hash, :timestamp, :username],
338
+ :method => :get
339
+ },
340
+ :get_os_values => {
341
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/os/values.do',
342
+ :url_parameters => [:campaignId],
343
+ :body_parameters => [:hash, :timestamp, :username],
344
+ :method => :get
345
+ },
346
+ :get_os_versions_by_os_name => {
347
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/os/OS_NAME/versions.do',
348
+ :url_parameters => [:campaignId, :osName],
349
+ :body_parameters => [:hash, :timestamp, :username],
350
+ :method => :get
351
+ },
352
+ :get_regions_cities => {
353
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/country/region/city/values.do',
354
+ :url_parameters => [:campaignId],
355
+ :body_parameters => [:countryCode, :regionName, :hash, :timestamp, :username],
356
+ :method => :get
357
+ },
358
+ :get_screen_resolution_values => {
359
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/resolution/values.do',
360
+ :url_parameters => [:campaignId],
361
+ :body_parameters => [:hash, :timestamp, :username],
362
+ :method => :get
363
+ },
364
+ :get_targeting => {
365
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/TARGET_ID.do',
366
+ :url_parameters => [:campaignId, :targetId],
367
+ :body_parameters => [:hash, :timestamp, :username],
368
+ :method => :get
369
+ },
370
+ :get_targetings => {
371
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targetings.do',
372
+ :url_parameters => [:campaignId],
373
+ :body_parameters => [:hash, :timestamp, :username],
374
+ :method => :get
375
+ },
376
+ :get_targeting_types => {
377
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/types.do',
378
+ :url_parameters => [:campaignId],
379
+ :body_parameters => [:hash, :timestamp, :username],
380
+ :method => :get
381
+ },
382
+ :remove_targeting => {
383
+ :url => '/rest-api/campaign/CAMPAIGN_ID/targeting/TARGET_ID/delete.do',
384
+ :url_parameters => [:campaignId, :targetId],
385
+ :body_parameters => [:hash, :timestamp, :username],
386
+ :method => :delete
387
+ },
388
+
389
+ ###########################
390
+ # Campaign Adjusted CPM API
391
+ ###########################
392
+
393
+ :add_fixed_cpm_country_pricing => {
394
+ :url => '/rest-api/campaign/CAMPAIGN_ID/adjustedCpm/value.do',
395
+ :url_parameters => [:campaignId],
396
+ :body_parameters => [:value, :countryCode, :date, :hash, :timestamp, :username],
397
+ :method => :put
398
+ },
399
+ :adjusted_cpm_country_trigger => {
400
+ :url => '/rest-api/campaign/CAMPAIGN_ID/adjustedCpm/value.do',
401
+ :url_parameters => [:campaignId],
402
+ :body_parameters => [:enable, :hash, :timestamp, :username],
403
+ :method => :post
404
+ },
405
+ :adjusted_cpm_list => {
406
+ :url => '/rest-api/campaign/CAMPAIGN_ID/adjustedCpm/value.do',
407
+ :url_parameters => [:campaignId],
408
+ :body_parameters => [:hash, :timestamp, :username],
409
+ :method => :get
410
+ },
411
+
412
+
413
+ ###########################
414
+ # Campaign Action Management API
415
+ ###########################
416
+
417
+ :create_action => {
418
+ :url => '/rest-api/campaign/CAMPAIGN_ID/action/create.do',
419
+ :url_parameters => [:campaignId],
420
+ :body_parameters => [:name, :clickToConversionTimeFrame, :clickToConversionTimeFramePeriodType, :viewToConversionTimeFrame, :viewToConversionTimeFramePeriodType, :hash, :timestamp, :username],
421
+ :method => :post
422
+ },
423
+ :get_action => {
424
+ :url => '/rest-api/campaign/CAMPAIGN_ID/action/ACTION_KEY.do',
425
+ :url_parameters => [:campaignId, :actionKey],
426
+ :body_parameters => [:hash, :timestamp, :username],
427
+ :method => :get
428
+ },
429
+ :get_actions => {
430
+ :url => '/rest-api/campaign/CAMPAIGN_ID/actions.do',
431
+ :url_parameters => [:campaignId],
432
+ :body_parameters => [:hash, :timestamp, :username],
433
+ :method => :get
434
+ },
435
+ :remove_action => {
436
+ :url => '/rest-api/campaign/CAMPAIGN_ID/action/ACTION_KEY/delete.do',
437
+ :url_parameters => [:campaignId, :actionKey],
438
+ :body_parameters => [:hash, :timestamp, :username],
439
+ :method => :delete
440
+ },
441
+ :update_action => {
442
+ :url => '/rest-api/campaign/CAMPAIGN_ID/action/ACTION_KEY/update.do',
443
+ :url_parameters => [:campaignId, :actionKey],
444
+ :body_parameters => [:name, :clickToConversionTimeFrame, :clickToConversionTimeFramePeriodType, :viewToConversionTimeFrame, :viewToConversionTimeFramePeriodType, :hash, :timestamp, :username],
445
+ :method => :post
446
+ },
447
+ :disable_campaign_country_pricing => {
448
+ :url => '/rest-api/campaigns/CAMPAIGN_ID/pricing/COUNTRY_CODE.do',
449
+ :url_parameters => [:campaignId, :countryCode],
450
+ :body_parameters => [:hash, :timestamp, :username],
451
+ :method => :delete
452
+ },
453
+ :disable_campaign_pricing => {
454
+ :url => '/rest-api/campaigns/CAMPAIGN_ID/pricing.do',
455
+ :url_parameters => [:campaignId],
456
+ :body_parameters => [:hash, :timestamp, :username],
457
+ :method => :delete
458
+ },
459
+
460
+ :get_campaign => {
461
+ :url => '/rest-api/campaign/CAMPAIGN_ID.do',
462
+ :url_parameters => [:campaignId],
463
+ :body_parameters => [:hash, :timestamp, :username],
464
+ :method => :get
465
+ },
466
+ :get_campaign_pricing => {
467
+ :url => '/rest-api/campaign/CAMPAIGN_ID/pricing.do',
468
+ :url_parameters => [:campaignId],
469
+ :body_parameters => [:hash, :timestamp, :username],
470
+ :method => :get
471
+ },
472
+ :get_campaigns => {
473
+ :url => '/rest-api/campaigns.do',
474
+ :body_parameters => [:hash, :timestamp, :username],
475
+ :method => :get
476
+ },
477
+ :update_campaign_country_pricing => {
478
+ :url => '/rest-api/campaign/CAMPAIGN_ID/pricing/COUNTRY_CODE.do',
479
+ :url_parameters => [:campaignId, :countryCode],
480
+ :body_parameters => [:price, :hash, :timestamp, :username],
481
+ :method => :post
482
+ },
483
+ :update_campaign_country_pricing_batch => {
484
+ :url => '/rest-api/campaign/CAMPAIGN_ID/pricing/batch.do',
485
+ :url_parameters => [:campaignId],
486
+ :body_parameters => [:countryPrices, :hash, :timestamp, :username],
487
+ :method => :post
488
+ },
489
+ :update_campaign_pricing => {
490
+ :url => '/rest-api/campaign/CAMPAIGN_ID/pricing.do',
491
+ :url_parameters => [:campaignId],
492
+ :body_parameters => [:hash, :timestamp, :username],
493
+ :method => :post
494
+ },
495
+ }
496
+ end
497
+
498
+ def self.replace_params_in_url(url, url_params)
499
+ url.gsub!('CAMPAIGN_ID', url_params[:campaignId]) if url.include?('CAMPAIGN_ID')
500
+ url.gsub!('OS_NAME', url_params[:osName]) if url.include?('OS_NAME')
501
+ url.gsub!('TARGET_ID', url_params[:targetId]) if url.include?('TARGET_ID')
502
+ url.gsub!('ACTION_KEY', url_params[:actionKey]) if url.include?('ACTION_KEY')
503
+ url.gsub!('COUNTRY_CODE', url_params[:countryCode]) if url.include?('COUNTRY_CODE')
504
+ url
505
+ end
506
+
507
+ end
508
+ end