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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bdc77d58fcb671ae9ef7fe6009b10d5c25773d01
4
+ data.tar.gz: ea7c3eb911dcf818053a8e3e2c72b291c69b306d
5
+ SHA512:
6
+ metadata.gz: 4e55fe6a6de94e50d095e65213a114a6c8eb44ab4436a737bdf6126e3c927bf03afcd94e92e3661337869d51e56b0268a26dced53de8a3018b65f3b6f947bf82
7
+ data.tar.gz: 4fb64db525700b2d868bb9dd770ddf1365be37aa598dec88f107129cb368db0df994ed125dae205285b2ece28a7d444d23efd6b612526d2c49dff49d0979dc1a
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Pedro Quintero
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Epom
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Epom'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ Bundler::GemHelper.install_tasks
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'lib'
23
+ t.libs << 'test'
24
+ t.pattern = 'test/**/*_test.rb'
25
+ t.verbose = false
26
+ end
27
+
28
+ task default: :test
@@ -0,0 +1,41 @@
1
+ # Add configuration values here, as shown below.
2
+ #
3
+ # pusher_app_id: "2954"
4
+ # pusher_key: 7381a978f7dd7f9a1117
5
+ # pusher_secret: abdc3b896a0ffb85d373
6
+ # stripe_api_key: sk_test_2J0l093xOyW72XUYJHE4Dv2r
7
+ # stripe_publishable_key: pk_test_ro9jV5SNwGb1yYlQfzG17LHK
8
+ #
9
+ # production:
10
+ # stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H
11
+ # stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU
12
+
13
+ # proxy_address: 10.6.56.19
14
+ # proxy_port: 808
15
+
16
+ proxy_address: proxy-trab.uh.cu
17
+ proxy_port: 3128
18
+ proxy_user: adrian.chang@rect.uh.cu
19
+ proxy_password: arielchang
20
+
21
+ public_key: 2d2012203d6311e3
22
+ private_key: 4e457bc03d6311e3
23
+
24
+ username: kewelta
25
+ password: kewelta
26
+
27
+ advertiser_id: 680
28
+ campaign_id: 1247
29
+ banner_id: 2157
30
+
31
+ site_id: 721
32
+ zone_id: 814
33
+ placement_id: 1384
34
+
35
+ banner_type: LOCAL_FILE
36
+ target_id: 3929
37
+ os_name: UNSPECIFIED
38
+ placement_type: SITE_PLACEMENT
39
+ country_code: US
40
+ region_name: New York
41
+ action_key: cd6091a6b570ac1a0f5d9e0d396220fb-526-1247
data/lib/epom.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'httmultiparty'
2
+ require 'digest'
3
+
4
+ require 'epom/advertiser'
5
+ require 'epom/auth'
6
+ require 'epom/banner'
7
+ require 'epom/campaign'
8
+ require 'epom/epom_element'
9
+ require 'epom/placement'
10
+ require 'epom/publisher'
11
+ require 'epom/site'
12
+ require 'epom/zone'
13
+
14
+ module Epom
15
+
16
+ def self.create_hash(*args)
17
+ md5 = Digest::MD5.new
18
+ md5 << args.join
19
+ md5.hexdigest
20
+ end
21
+
22
+ end
@@ -0,0 +1,15 @@
1
+ module Epom
2
+ class AdUnitSize
3
+ MEDIUM_RECTANGLE = 'MEDIUM_RECTANGLE' #300×250
4
+ RECTANGLE = 'RECTANGLE' #180×50
5
+ LEADERBOARD = 'LEADERBOARD' #728×90
6
+ FULL_BANNER = 'FULL_BANNER' #468×60
7
+ SKYSCRAPER = 'SKYSCRAPER' #120×600
8
+ WIDE_SKYSCRAPER = 'WIDE_SKYSCRAPER' #160×600
9
+ HALF_PAGE_AD = 'HALF_PAGE_AD' #300×600
10
+ BUTTON_2 = 'BUTTON_2' #120×60
11
+ MICRO_BAR = 'MICRO_BAR' #88×31
12
+ XXL_BOX = 'XXL_BOX' #468×648
13
+ CUSTOM_SITE_BANNER_SIZE = 'CUSTOM_SITE_BANNER_SIZE' #specified by user
14
+ end
15
+ end
@@ -0,0 +1,45 @@
1
+ require 'epom/epom_element'
2
+
3
+ module Epom
4
+ class Advertiser < EpomElement
5
+
6
+ def self.extended_methods
7
+ {
8
+ :delete_advertiser => {
9
+ :url => '/rest-api/advertisers/ADVERTISER_ID/delete.do',
10
+ :url_parameters => [:advertiserId],
11
+ :body_parameters => [:hash, :timestamp, :username],
12
+ :method => :delete
13
+ },
14
+ :get_advertiser_permissions_for_user => {
15
+ :url => '/rest-api/advertiserShares.do',
16
+ :body_parameters => [:hash, :timestamp, :username],
17
+ :method => :get
18
+ },
19
+ :get_campaigns_for_advertiser => {
20
+ :url => '/rest-api/advertiser/ADVERTISER_ID/campaigns.do',
21
+ :url_parameters => [:advertiserId],
22
+ :body_parameters => [:hash, :timestamp, :username],
23
+ :method => :get
24
+ },
25
+ :update_advertiser => {
26
+ :url => '/rest-api/advertisers/update.do',
27
+ :body_parameters => [:id, :name, :contactName, :contactEmail, :description, :categoryId, :hash, :timestamp, :username],
28
+ :method => :put
29
+ },
30
+ :create_advertiser => {
31
+ :url => '/rest-api/advertisers/update.do',
32
+ :body_parameters => [:name, :contactName, :contactEmail, :description, :categoryId, :hash, :timestamp, :username],
33
+ :method => :put
34
+ },
35
+
36
+ }
37
+ end
38
+
39
+ def self.replace_params_in_url(url, urlp_arams)
40
+ url.gsub!('ADVERTISER_ID', urlp_arams[:advertiserId].to_s) if url.include?('ADVERTISER_ID')
41
+ url
42
+ end
43
+
44
+ end
45
+ end
data/lib/epom/auth.rb ADDED
@@ -0,0 +1,31 @@
1
+ require 'epom/epom_element'
2
+
3
+ module Epom
4
+ class Auth < EpomElement
5
+
6
+ def self.extended_methods
7
+ {
8
+ :get_authentication_token => {
9
+ :url => '/rest-api/auth/token.do',
10
+ :body_parameters => [:username, :password],
11
+ :method => :post
12
+ },
13
+ :register_user => {
14
+ :url => '/rest-api/register-user/KEY/HASH/TIMESTAMP.do',
15
+ :url_parameters => [:key, :hash, :timestamp],
16
+ :body_parameters => [:username, :password, :email, :role, :phone, :firstName, :lastName, :websiteUrl, :company, :country, :state, :enable_market_integration],
17
+ :method => :post
18
+ }
19
+ }
20
+ end
21
+
22
+ def self.replace_params_in_url(url, url_params)
23
+ url.gsub!('TOKEN', url_params[:token]) if url.include?('TOKEN')
24
+ url.gsub!('KEY', url_params[:key]) if url.include?('KEY')
25
+ url.gsub!('HASH', url_params[:hash]) if url.include?('HASH')
26
+ url.gsub!('TIMESTAMP', url_params[:timestamp].to_s) if url.include?('TIMESTAMP')
27
+ url
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,525 @@
1
+ require 'epom/epom_element'
2
+ require 'epom/banner_type'
3
+ require 'epom/placement_type'
4
+ require 'epom/ad_unit_size'
5
+
6
+ module Epom
7
+ class Banner < EpomElement
8
+
9
+ def self.extended_methods
10
+ {
11
+ :create_banner => {
12
+ :url => '/rest-api/banner/create.do',
13
+ :body_parameters => [:placementType, :campaignId, :active, :name, :allowNewPlacementsAutoLinking, :autolinkCategories, :weight, :adUnitId, :adUnitHeight, :adUnitWidth, :bannerType, :flashBannerLink, :imageBannerLink, :videoFileLink, :flashFile, :imageFile, :videoFile, :templateId, :thirdTrackingCode, :code, :url, :inStreamVideoType, :mobileAdvertisingNetwork, :mobileAdvertisingNetworkParameters, :applicationOperatingSystem, :applicationAdCategory, :applicationAdvertisingNetwork, :applicationAdvertisingNetworkParameters, :hash, :timestamp, :username],
14
+ :method => :post
15
+ },
16
+ :delete_banner => {
17
+ :url => '/rest-api/banner/BANNER_ID/delete.do',
18
+ :url_parameters => [:bannerId],
19
+ :body_parameters => [:hash, :timestamp, :username],
20
+ :method => :delete
21
+ },
22
+ :get_ad_unit_values_by_banner_type => {
23
+ :url => '/rest-api/banners/BANNER_TYPE/adunit/values.do',
24
+ :url_parameters => [:bannerType],
25
+ :body_parameters => [:hash, :timestamp, :username],
26
+ :method => :get
27
+ },
28
+ :get_banner_ad_unit_values => {
29
+ :url => '/rest-api/banner/adunit/values.do',
30
+ :body_parameters => [:placementType, :hash, :timestamp, :username],
31
+ :method => :get
32
+ },
33
+ :get_banner_pricing => {
34
+ :url => '/rest-api/banner/BANNER_ID/pricing.do',
35
+ :url_parameters => [:bannerId],
36
+ :body_parameters => [:hash, :timestamp, :username],
37
+ :method => :get
38
+ },
39
+ :get_mobile_networks => {
40
+ :url => '/rest-api/banner/mobilenetworks.do',
41
+ :body_parameters => [:hash, :timestamp, :username],
42
+ :method => :get
43
+ },
44
+ :get_placements_for_banner => {
45
+ :url => '/rest-api/banner/BANNER_ID/placements.do',
46
+ :url_parameters => [:bannerId],
47
+ :body_parameters => [:hash, :timestamp, :username],
48
+ :method => :get
49
+ },
50
+ :update_banners_urls_batch => {
51
+ :url => '/rest-api/banner/BANNER_ID/placements.do',
52
+ :url_parameters => [:bannerId],
53
+ :body_parameters => [:hash, :timestamp, :username],
54
+ :method => :post
55
+ },
56
+
57
+ #######################
58
+ #Banner Capping API
59
+ #######################
60
+
61
+ :get_action_capping => {
62
+ :url => '/rest-api/banner/BANNER_ID/actionCapping.do',
63
+ :url_parameters => [:bannerId],
64
+ :body_parameters => [:hash, :timestamp, :username],
65
+ :method => :get
66
+ },
67
+ :get_click_capping => {
68
+ :url => '/rest-api/banner/BANNER_ID/clickCapping.do',
69
+ :url_parameters => [:bannerId],
70
+ :body_parameters => [:hash, :timestamp, :username],
71
+ :method => :get
72
+ },
73
+ :get_frequency_capping => {
74
+ :url => '/rest-api/banner/BANNER_ID/frequencyCapping.do',
75
+ :url_parameters => [:bannerId],
76
+ :body_parameters => [:hash, :timestamp, :username],
77
+ :method => :get
78
+ },
79
+
80
+ :remove_action_capping => {
81
+ :url => '/rest-api/banner/BANNER_ID/actionCapping.do',
82
+ :url_parameters => [:bannerId],
83
+ :body_parameters => [:hash, :timestamp, :username],
84
+ :method => :delete
85
+ },
86
+ :remove_click_capping => {
87
+ :url => '/rest-api/banner/BANNER_ID/clickCapping.do',
88
+ :url_parameters => [:bannerId],
89
+ :body_parameters => [:hash, :timestamp, :username],
90
+ :method => :delete
91
+ },
92
+ :remove_frequency_capping => {
93
+ :url => '/rest-api/banner/BANNER_ID/frequencyCapping.do',
94
+ :url_parameters => [:bannerId],
95
+ :body_parameters => [:hash, :timestamp, :username],
96
+ :method => :delete
97
+ },
98
+
99
+ :set_action_capping => {
100
+ :url => '/rest-api/banner/BANNER_ID/actionCapping/set.do',
101
+ :url_parameters => [:bannerId],
102
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
103
+ :method => :post
104
+ },
105
+ :set_click_capping => {
106
+ :url => '/rest-api/banner/BANNER_ID/clickCapping/set.do',
107
+ :url_parameters => [:bannerId],
108
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
109
+ :method => :post
110
+ },
111
+ :set_frequency_capping => {
112
+ :url => '/rest-api/banner/BANNER_ID/frequencyCapping/set.do',
113
+ :url_parameters => [:bannerId],
114
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
115
+ :method => :post
116
+ },
117
+
118
+ :update_action_capping => {
119
+ :url => '/rest-api/banner/BANNER_ID/actionCapping/update.do',
120
+ :url_parameters => [:bannerId],
121
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
122
+ :method => :post
123
+ },
124
+ :update_click_capping => {
125
+ :url => '/rest-api/banner/BANNER_ID/clickCapping/update.do',
126
+ :url_parameters => [:bannerId],
127
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
128
+ :method => :post
129
+ },
130
+ :update_frequency_capping => {
131
+ :url => '/rest-api/banner/BANNER_ID/frequencyCapping/update.do',
132
+ :url_parameters => [:bannerId],
133
+ :body_parameters => [:amount, :period, :periodType, :evenDistribution, :hash, :timestamp, :username],
134
+ :method => :post
135
+ },
136
+
137
+ #######################
138
+ #Banner Limits API
139
+ #######################
140
+
141
+ :disable_limits => {
142
+ :url => '/rest-api/banner/BANNER_ID/limits.do',
143
+ :url_parameters => [:bannerId],
144
+ :body_parameters => [:hash, :timestamp, :username],
145
+ :method => :delete
146
+ },
147
+ :get_limits => {
148
+ :url => '/rest-api/banner/BANNER_ID/limits.do',
149
+ :url_parameters => [:bannerId],
150
+ :body_parameters => [:hash, :timestamp, :username],
151
+ :method => :get
152
+ },
153
+ :reset_limits => {
154
+ :url => '/rest-api/banner/BANNER_ID/limits/reset.do',
155
+ :url_parameters => [:bannerId],
156
+ :body_parameters => [:limitCounters, :hash, :timestamp, :username],
157
+ :method => :post
158
+ },
159
+ :set_limits => {
160
+ :url => '/rest-api/banner/BANNER_ID/limits/set.do',
161
+ :url_parameters => [:bannerId],
162
+ :body_parameters => [:totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :startDate, :endDate, :totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :dailyBudget, :hash, :timestamp, :username],
163
+ :method => :post
164
+ },
165
+ :update_limits => {
166
+ :url => '/rest-api/banner/BANNER_ID/limits/update.do',
167
+ :url_parameters => [:bannerId],
168
+ :body_parameters => [:totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :startDate, :endDate, :totalImpressionsLimit, :totalClicksLimit, :totalBudgetLimit, :dailyImpressionsLimit, :dailyClicksLimit, :dailyBudgetLimit, :totalImpressions, :totalClicks, :totalBudget, :dailyImpressions, :dailyClicks, :dailyBudget, :hash, :timestamp, :username],
169
+ :method => :post
170
+ },
171
+
172
+ #######################
173
+ #Banner Targeting API
174
+ #######################
175
+
176
+ :create_browser_target => {
177
+ :url => '/rest-api/banner/BANNER_ID/targeting/create.do',
178
+ :url_parameters => [:bannerId],
179
+ :body_parameters => [:rule, :browser, :relation, :browserVersion, :hash, :timestamp, :username],
180
+ :method => :post
181
+ },
182
+ :create_channel_target => {
183
+ :url => '/rest-api/banner/BANNER_ID/targeting/channel/create.do',
184
+ :url_parameters => [:bannerId],
185
+ :body_parameters => [:channel, :rule, :hash, :timestamp, :username],
186
+ :method => :post
187
+ },
188
+ :create_cookie_value_target => {
189
+ :url => '/rest-api/banner/BANNER_ID/targeting/cookie/create.do',
190
+ :url_parameters => [:bannerId],
191
+ :body_parameters => [:cookieName, :cookieValue, :rule, :hash, :timestamp, :username],
192
+ :method => :post
193
+ },
194
+ :create_country_target => {
195
+ :url => '/rest-api/banner/BANNER_ID/targeting/country/create.do',
196
+ :url_parameters => [:bannerId],
197
+ :body_parameters => [:countryCode, :rule, :hash, :timestamp, :username],
198
+ :method => :post
199
+ },
200
+ :create_custom_parameter_target => {
201
+ :url => '/rest-api/banner/BANNER_ID/targeting/custom/create.do',
202
+ :url_parameters => [:bannerId],
203
+ :body_parameters => [:expression, :rule, :hash, :timestamp, :username],
204
+ :method => :post
205
+ },
206
+ :create_day_of_week_target => {
207
+ :url => '/rest-api/banner/BANNER_ID/targeting/dayofweek/create.do',
208
+ :url_parameters => [:bannerId],
209
+ :body_parameters => [:dayOfWeek, :rule, :hash, :timestamp, :username],
210
+ :method => :post
211
+ },
212
+ :create_device_format_target => {
213
+ :url => '/rest-api/banner/BANNER_ID/targeting/deviceformat/create.do',
214
+ :url_parameters => [:bannerId],
215
+ :body_parameters => [:deviceFormat, :rule, :hash, :timestamp, :username],
216
+ :method => :post
217
+ },
218
+ :create_device_target => {
219
+ :url => '/rest-api/banner/BANNER_ID/targeting/mobilecarrier/create.do',
220
+ :url_parameters => [:bannerId],
221
+ :body_parameters => [:deviceFormat, :rule, :hash, :timestamp, :username],
222
+ :method => :post
223
+ },
224
+ :create_device_vendor_target => {
225
+ :url => '/rest-api/banner/BANNER_ID/targeting/devicevendor/create.do',
226
+ :url_parameters => [:bannerId],
227
+ :body_parameters => [:deviceVendor, :rule, :hash, :timestamp, :username],
228
+ :method => :post
229
+ },
230
+ :create_domain_target => {
231
+ :url => '/rest-api/banner/BANNER_ID/targeting/domain/create.do',
232
+ :url_parameters => [:bannerId],
233
+ :body_parameters => [:domain, :rule, :hash, :timestamp, :username],
234
+ :method => :post
235
+ },
236
+ :create_ip_range_target => {
237
+ :url => '/rest-api/banner/BANNER_ID/targeting/iprange/create.do',
238
+ :url_parameters => [:bannerId],
239
+ :body_parameters => [:ipFrom, :ipTo, :rule, :hash, :timestamp, :username],
240
+ :method => :post
241
+ },
242
+ :create_language_target => {
243
+ :url => '/rest-api/banner/BANNER_ID/targeting/language/create.do',
244
+ :url_parameters => [:bannerId],
245
+ :body_parameters => [:languageCode, :rule, :hash, :timestamp, :username],
246
+ :method => :post
247
+ },
248
+ :create_location_target => {
249
+ :url => '/rest-api/banner/BANNER_ID/targeting/location/create.do',
250
+ :url_parameters => [:bannerId],
251
+ :body_parameters => [:countryCode, :regionName, :cityName, :rule, :hash, :timestamp, :username],
252
+ :method => :post
253
+ },
254
+ :create_mobile_carrier_target => {
255
+ :url => '/rest-api/banner/BANNER_ID/targeting/mobilecarrier/create.do',
256
+ :url_parameters => [:bannerId],
257
+ :body_parameters => [:mobileCarriers, :rule, :hash, :timestamp, :username],
258
+ :method => :post
259
+ },
260
+ :create_os_target => {
261
+ :url => '/rest-api/banner/BANNER_ID/targeting/os/create.do',
262
+ :url_parameters => [:bannerId],
263
+ :body_parameters => [:operatingSystem, :rule, :hash, :timestamp, :username],
264
+ :method => :post
265
+ },
266
+ :create_screen_resolution_target => {
267
+ :url => '/rest-api/banner/BANNER_ID/targeting/os/create.do',
268
+ :url_parameters => [:bannerId],
269
+ :body_parameters => [:relation, :screenWidth, :screenHeight, :rule, :hash, :timestamp, :username],
270
+ :method => :post
271
+ },
272
+ :create_time_range_target => {
273
+ :url => '/rest-api/banner/BANNER_ID/targeting/timerange/create.do',
274
+ :url_parameters => [:bannerId],
275
+ :body_parameters => [:timeFrom, :timeTo, :rule, :hash, :timestamp, :username],
276
+ :method => :post
277
+ },
278
+ :create_wifi_traffic_target => {
279
+ :url => '/rest-api/banner/BANNER_ID/targeting/wifi/create.do',
280
+ :url_parameters => [:bannerId],
281
+ :body_parameters => [:rule, :hash, :timestamp, :username],
282
+ :method => :post
283
+ },
284
+
285
+ :disable_targeting => {
286
+ :url => '/rest-api/banner/BANNER_ID/targeting/disable.do',
287
+ :url_parameters => [:bannerId],
288
+ :body_parameters => [:hash, :timestamp, :username],
289
+ :method => :post
290
+ },
291
+ :enable_targeting => {
292
+ :url => '/rest-api/banner/BANNER_ID/targeting/enable.do',
293
+ :url_parameters => [:bannerId],
294
+ :body_parameters => [:hash, :timestamp, :username],
295
+ :method => :post
296
+ },
297
+
298
+ :get_browsers => {
299
+ :url => '/rest-api/banner/BANNER_ID/targeting/browsers/values.do',
300
+ :url_parameters => [:bannerId],
301
+ :body_parameters => [:hash, :timestamp, :username],
302
+ :method => :get
303
+ },
304
+ :get_chrome_browsers => {
305
+ :url => '/rest-api/banner/BANNER_ID/targeting/browsers/chrome/values.do',
306
+ :url_parameters => [:bannerId],
307
+ :body_parameters => [:hash, :timestamp, :username],
308
+ :method => :get
309
+ },
310
+ :get_firefox_browsers => {
311
+ :url => '/rest-api/banner/BANNER_ID/targeting/browsers/firefox/values.do',
312
+ :url_parameters => [:bannerId],
313
+ :body_parameters => [:hash, :timestamp, :username],
314
+ :method => :get
315
+ },
316
+ :get_ie_browsers => {
317
+ :url => '/rest-api/banner/BANNER_ID/targeting/browsers/ie/values.do',
318
+ :url_parameters => [:bannerId],
319
+ :body_parameters => [:hash, :timestamp, :username],
320
+ :method => :get
321
+ },
322
+ :get_safari_browsers => {
323
+ :url => '/rest-api/banner/BANNER_ID/targeting/browsers/safari/values.do',
324
+ :url_parameters => [:bannerId],
325
+ :body_parameters => [:hash, :timestamp, :username],
326
+ :method => :get
327
+ },
328
+
329
+ :get_country_regions => {
330
+ :url => '/rest-api/banner/BANNER_ID/targeting/country/region/values.do',
331
+ :url_parameters => [:bannerId],
332
+ :body_parameters => [:countryCode, :hash, :timestamp, :username],
333
+ :method => :get
334
+ },
335
+ :get_device_format_values => {
336
+ :url => '/rest-api/banner/BANNER_ID/targeting/device/format/values.do',
337
+ :url_parameters => [:bannerId],
338
+ :body_parameters => [:hash, :timestamp, :username],
339
+ :method => :get
340
+ },
341
+ :get_device_values => {
342
+ :url => '/rest-api/banner/BANNER_ID/targeting/device/values.do',
343
+ :url_parameters => [:bannerId],
344
+ :body_parameters => [:hash, :timestamp, :username],
345
+ :method => :get
346
+ },
347
+ :get_device_vendor_values => {
348
+ :url => '/rest-api/banner/BANNER_ID/targeting/device/vendor/values.do',
349
+ :url_parameters => [:bannerId],
350
+ :body_parameters => [:hash, :timestamp, :username],
351
+ :method => :get
352
+ },
353
+ :get_languages => {
354
+ :url => '/rest-api/banner/BANNER_ID/targeting/language/values.do',
355
+ :url_parameters => [:bannerId],
356
+ :body_parameters => [:hash, :timestamp, :username],
357
+ :method => :get
358
+ },
359
+ :get_mobile_carriers => {
360
+ :url => '/rest-api/banner/BANNER_ID/targeting/mobilecarriers/values.do',
361
+ :url_parameters => [:bannerId],
362
+ :body_parameters => [:hash, :timestamp, :username],
363
+ :method => :get
364
+ },
365
+ :get_os_values => {
366
+ :url => '/rest-api/banner/BANNER_ID/targeting/os/values.do',
367
+ :url_parameters => [:bannerId],
368
+ :body_parameters => [:hash, :timestamp, :username],
369
+ :method => :get
370
+ },
371
+ :get_os_versions_by_os_name => {
372
+ :url => '/rest-api/banner/BANNER_ID/targeting/os/OS_NAME/versions.do',
373
+ :url_parameters => [:bannerId, :osName],
374
+ :body_parameters => [:hash, :timestamp, :username],
375
+ :method => :get
376
+ },
377
+ :get_region_cities => {
378
+ :url => '/rest-api/banner/BANNER_ID/targeting/country/region/city/values.do',
379
+ :url_parameters => [:bannerId],
380
+ :body_parameters => [:countryCode, :regionName, :hash, :timestamp, :username],
381
+ :method => :get
382
+ },
383
+ :get_screen_resolution_values => {
384
+ :url => '/rest-api/banner/BANNER_ID/targeting/resolution/values.do',
385
+ :url_parameters => [:bannerId],
386
+ :body_parameters => [:hash, :timestamp, :username],
387
+ :method => :get
388
+ },
389
+ :get_targeting => {
390
+ :url => '/rest-api/banner/BANNER_ID/targeting/TARGET_ID.do',
391
+ :url_parameters => [:bannerId, :targetId],
392
+ :body_parameters => [:hash, :timestamp, :username],
393
+ :method => :get
394
+ },
395
+ :get_targetings => {
396
+ :url => '/rest-api/banner/BANNER_ID/targetings.do',
397
+ :url_parameters => [:bannerId],
398
+ :body_parameters => [:hash, :timestamp, :username],
399
+ :method => :get
400
+ },
401
+ :get_targeting_types => {
402
+ :url => '/rest-api/banner/BANNER_ID/targeting/types.do',
403
+ :url_parameters => [:bannerId],
404
+ :body_parameters => [:hash, :timestamp, :username],
405
+ :method => :get
406
+ },
407
+
408
+ :remove_targeting => {
409
+ :url => '/rest-api/banner/BANNER_ID/targeting/TARGET_ID/delete.do',
410
+ :url_parameters => [:bannerId, :targetId],
411
+ :body_parameters => [:hash, :timestamp, :username],
412
+ :method => :delete
413
+ },
414
+
415
+ #############################
416
+ #Banner Placement Linking API
417
+ #############################
418
+
419
+ :create_or_update_banner_placements => {
420
+ :url => '/rest-api/banners/BANNER_ID/placements.do',
421
+ :url_parameters => [:bannerId],
422
+ :body_parameters => [:ids, :hash, :timestamp, :username],
423
+ :method => :put
424
+ },
425
+ :delete_banner_placements => {
426
+ :url => '/rest-api/banners/BANNER_ID/placements.do',
427
+ :url_parameters => [:bannerId],
428
+ :body_parameters => [:removeIds, :hash, :timestamp, :username],
429
+ :method => :delete
430
+ },
431
+ :get_banner_placements_list => {
432
+ :url => '/rest-api/banners/BANNER_ID/placements.do',
433
+ :url_parameters => [:bannerId],
434
+ :body_parameters => [:hash, :timestamp, :username],
435
+ :method => :get
436
+ },
437
+ :disable_banner_country_pricing => {
438
+ :url => '/rest-api/banner/BANNER_ID/pricing/COUNTRY_CODE.do',
439
+ :url_parameters => [:bannerId, :countryCode],
440
+ :body_parameters => [:hash, :timestamp, :username],
441
+ :method => :delete
442
+ },
443
+ :disable_banner_frequency_capping => {
444
+ :url => '/rest-api/banner/BANNER_ID/capping/frequency.do',
445
+ :url_parameters => [:bannerId],
446
+ :body_parameters => [:hash, :timestamp, :username],
447
+ :method => :delete
448
+ },
449
+ :disable_banner_pricing => {
450
+ :url => '/rest-api/banner/BANNER_ID/pricing.do',
451
+ :url_parameters => [:bannerId],
452
+ :body_parameters => [:hash, :timestamp, :username],
453
+ :method => :delete
454
+ },
455
+
456
+ :get_advertising_categories => {
457
+ :url => '/rest-api/categories/advertising.do',
458
+ :body_parameters => [:hash, :timestamp, :username],
459
+ :method => :get
460
+ },
461
+ :get_banner => {
462
+ :url => '/rest-api/banner/BANNER_ID.do',
463
+ :url_parameters => [:bannerId],
464
+ :body_parameters => [:hash, :timestamp, :username],
465
+ :method => :get
466
+ },
467
+ :get_banners => {
468
+ :url => '/rest-api/banners.do',
469
+ :body_parameters => [:campaignId, :advertisingCategories, :hash, :timestamp, :username],
470
+ :method => :get
471
+ },
472
+ :get_banners_urls => {
473
+ :url => '/rest-api/banners/urls.do',
474
+ :body_parameters => [:bannerIds, :advertisingCategories, :hash, :timestamp, :username],
475
+ :method => :get
476
+ },
477
+ :get_publishing_categories => {
478
+ :url => '/rest-api/categories/publishing.do',
479
+ :body_parameters => [:hash, :timestamp, :username],
480
+ :method => :get
481
+ },
482
+ :update_banner => {
483
+ :url => '/rest-api/banner/BANNER_ID/update.do',
484
+ :url_parameters => [:bannerId],
485
+ :body_parameters => [:active, :allowNewPlacementsAutoLinking, :autolinkCategories, :hash, :timestamp, :username],
486
+ :method => :post
487
+ },
488
+ :update_banner_country_pricing => {
489
+ :url => '/rest-api/banner/{BANNER_ID}/pricing/COUNTRY_CODE.do',
490
+ :url_parameters => [:bannerId, :countryCode],
491
+ :body_parameters => [:active, :allowNewPlacementsAutoLinking, :autolinkCategories, :hash, :timestamp, :username],
492
+ :method => :post
493
+ },
494
+ :update_banner_country_pricing_batch => {
495
+ :url => '/rest-api/banner/BANNER_ID/pricing/batch',
496
+ :url_parameters => [:bannerId],
497
+ :body_parameters => [:countryPrices, :hash, :timestamp, :username],
498
+ :method => :post
499
+ },
500
+ :update_banner_frequency_capping => {
501
+ :url => '/rest-api/banner/BANNER_ID/capping/frequency.do',
502
+ :url_parameters => [:bannerId],
503
+ :body_parameters => [:amount, :periodType, :flat, :period, :hash, :timestamp, :username],
504
+ :method => :post
505
+ },
506
+ :update_banner_pricing => {
507
+ :url => '/rest-api/banner/BANNER_ID/pricing.do',
508
+ :url_parameters => [:bannerId],
509
+ :body_parameters => [:price, :paymentModel, :hash, :timestamp, :username],
510
+ :method => :post
511
+ }
512
+ }
513
+ end
514
+
515
+ def self.replace_params_in_url(url, url_params)
516
+ url.gsub!('BANNER_ID', url_params[:bannerId].to_s) if url.include?("BANNER_ID")
517
+ url.gsub!('BANNER_TYPE', url_params[:bannerType]) if url.include?('BANNER_TYPE')
518
+ url.gsub!('OS_NAME', url_params[:osName]) if url.include?('OS_NAME')
519
+ url.gsub!('TARGET_ID', url_params[:targetId]) if url.include?('TARGET_ID')
520
+ url.gsub!('COUNTRY_CODE', url_params[:countryCode]) if url.include?('COUNTRY_CODE')
521
+ url
522
+ end
523
+
524
+ end
525
+ end