neuron-client 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/README.md +11 -8
  2. data/lib/neuron-client/api.rb +5 -0
  3. data/lib/neuron-client/model/ad.rb +142 -0
  4. data/lib/neuron-client/model/ad_calculations.rb +325 -0
  5. data/lib/neuron-client/model/ad_zone.rb +45 -0
  6. data/lib/neuron-client/model/base.rb +233 -18
  7. data/lib/neuron-client/model/blocked_referer.rb +20 -0
  8. data/lib/neuron-client/model/blocked_user_agent.rb +21 -0
  9. data/lib/neuron-client/model/geo_target.rb +36 -0
  10. data/lib/neuron-client/model/pixel.rb +22 -0
  11. data/lib/neuron-client/model/report.rb +35 -0
  12. data/lib/neuron-client/model/s3_file.rb +30 -0
  13. data/lib/neuron-client/model/zone.rb +64 -0
  14. data/lib/neuron-client/model/zone_calculations.rb +37 -0
  15. data/lib/neuron-client/schema/ad.rb +406 -0
  16. data/lib/neuron-client/schema/ad_zone.rb +49 -0
  17. data/lib/neuron-client/schema/blocked_referer.rb +52 -0
  18. data/lib/neuron-client/schema/blocked_user_agent.rb +64 -0
  19. data/lib/neuron-client/schema/common.rb +220 -0
  20. data/lib/neuron-client/schema/event.rb +17 -0
  21. data/lib/neuron-client/schema/geo_target.rb +33 -0
  22. data/lib/neuron-client/schema/pixel.rb +39 -0
  23. data/lib/neuron-client/schema/report.rb +59 -0
  24. data/lib/neuron-client/schema/s3_file.rb +87 -0
  25. data/lib/neuron-client/schema/zone.rb +214 -0
  26. data/lib/neuron-client/version.rb +1 -1
  27. data/lib/neuron-client.rb +24 -59
  28. data/neuron-client.gemspec +3 -0
  29. data/spec/lib/admin_connection_spec.rb +234 -0
  30. data/spec/lib/api_spec.rb +41 -63
  31. data/spec/lib/model/ad_calculations_spec.rb +1146 -0
  32. data/spec/lib/model/ad_spec.rb +253 -0
  33. data/spec/lib/model/ad_zone_spec.rb +15 -0
  34. data/spec/lib/model/base_spec.rb +5 -83
  35. data/spec/lib/model/blocked_referer_spec.rb +36 -0
  36. data/spec/lib/model/blocked_user_agent_spec.rb +36 -0
  37. data/spec/lib/model/geo_target_spec.rb +28 -0
  38. data/spec/lib/model/pixel_spec.rb +36 -0
  39. data/spec/lib/model/report_spec.rb +17 -0
  40. data/spec/lib/{s3_file_spec.rb → model/s3_file_spec.rb} +6 -5
  41. data/spec/lib/model/zone_calculations_spec.rb +49 -0
  42. data/spec/lib/model/zone_spec.rb +155 -0
  43. data/spec/lib/schema/ad_spec.rb +515 -0
  44. data/spec/lib/schema/ad_zone_spec.rb +149 -0
  45. data/spec/lib/schema/blocked_referer_spec.rb +136 -0
  46. data/spec/lib/schema/blocked_user_agent_spec.rb +147 -0
  47. data/spec/lib/schema/geo_target_spec.rb +92 -0
  48. data/spec/lib/schema/pixel_spec.rb +125 -0
  49. data/spec/lib/schema/report_spec.rb +129 -0
  50. data/spec/lib/schema/s3_file_spec.rb +164 -0
  51. data/spec/lib/schema/zone_spec.rb +243 -0
  52. data/spec/spec_helper.rb +2 -1
  53. metadata +141 -121
  54. data/lib/neuron-client/model/admin/ad.rb +0 -22
  55. data/lib/neuron-client/model/admin/ad_zone.rb +0 -15
  56. data/lib/neuron-client/model/admin/base.rb +0 -91
  57. data/lib/neuron-client/model/admin/blocked_referer.rb +0 -12
  58. data/lib/neuron-client/model/admin/blocked_user_agent.rb +0 -12
  59. data/lib/neuron-client/model/admin/geo_target.rb +0 -16
  60. data/lib/neuron-client/model/admin/pixel.rb +0 -12
  61. data/lib/neuron-client/model/admin/report.rb +0 -15
  62. data/lib/neuron-client/model/admin/s3_file.rb +0 -12
  63. data/lib/neuron-client/model/admin/zone.rb +0 -15
  64. data/lib/neuron-client/model/common/ad.rb +0 -42
  65. data/lib/neuron-client/model/common/ad_calculations.rb +0 -329
  66. data/lib/neuron-client/model/common/ad_zone.rb +0 -17
  67. data/lib/neuron-client/model/common/base.rb +0 -67
  68. data/lib/neuron-client/model/common/blocked_referer.rb +0 -16
  69. data/lib/neuron-client/model/common/blocked_user_agent.rb +0 -16
  70. data/lib/neuron-client/model/common/geo_target.rb +0 -16
  71. data/lib/neuron-client/model/common/pixel.rb +0 -18
  72. data/lib/neuron-client/model/common/report.rb +0 -21
  73. data/lib/neuron-client/model/common/s3_file.rb +0 -16
  74. data/lib/neuron-client/model/common/zone.rb +0 -22
  75. data/lib/neuron-client/model/common/zone_calculations.rb +0 -41
  76. data/lib/neuron-client/model/membase/ad.rb +0 -49
  77. data/lib/neuron-client/model/membase/ad_zone.rb +0 -11
  78. data/lib/neuron-client/model/membase/blocked_referer.rb +0 -20
  79. data/lib/neuron-client/model/membase/blocked_user_agent.rb +0 -20
  80. data/lib/neuron-client/model/membase/geo_target.rb +0 -11
  81. data/lib/neuron-client/model/membase/pixel.rb +0 -22
  82. data/lib/neuron-client/model/membase/report.rb +0 -11
  83. data/lib/neuron-client/model/membase/s3_file.rb +0 -11
  84. data/lib/neuron-client/model/membase/zone.rb +0 -30
  85. data/lib/neuron-client/model/models.rb +0 -15
  86. data/spec/lib/model/admin/ad_spec.rb +0 -34
  87. data/spec/lib/model/admin/ad_zone_spec.rb +0 -19
  88. data/spec/lib/model/admin/base_spec.rb +0 -11
  89. data/spec/lib/model/admin/blocked_referer_spec.rb +0 -11
  90. data/spec/lib/model/admin/blocked_user_agent_spec.rb +0 -11
  91. data/spec/lib/model/admin/geo_target_spec.rb +0 -30
  92. data/spec/lib/model/admin/report_spec.rb +0 -21
  93. data/spec/lib/model/admin/s3_spec.rb +0 -11
  94. data/spec/lib/model/admin/zone_spec.rb +0 -21
  95. data/spec/lib/model/common/ad_calculations_spec.rb +0 -1151
  96. data/spec/lib/model/common/ad_spec.rb +0 -11
  97. data/spec/lib/model/common/ad_zone_spec.rb +0 -11
  98. data/spec/lib/model/common/base_spec.rb +0 -11
  99. data/spec/lib/model/common/blocked_referer_spec.rb +0 -11
  100. data/spec/lib/model/common/blocked_user_agent_spec.rb +0 -11
  101. data/spec/lib/model/common/geo_target_spec.rb +0 -11
  102. data/spec/lib/model/common/report_spec.rb +0 -11
  103. data/spec/lib/model/common/s3_spec.rb +0 -11
  104. data/spec/lib/model/common/zone_calculations_spec.rb +0 -54
  105. data/spec/lib/model/common/zone_spec.rb +0 -11
  106. data/spec/lib/model/membase/ad_spec.rb +0 -54
  107. data/spec/lib/model/membase/ad_zone_spec.rb +0 -11
  108. data/spec/lib/model/membase/base_spec.rb +0 -11
  109. data/spec/lib/model/membase/blocked_referer_spec.rb +0 -34
  110. data/spec/lib/model/membase/blocked_user_agent_spec.rb +0 -34
  111. data/spec/lib/model/membase/geo_target_spec.rb +0 -11
  112. data/spec/lib/model/membase/pixel_spec.rb +0 -34
  113. data/spec/lib/model/membase/report_spec.rb +0 -11
  114. data/spec/lib/model/membase/s3_spec.rb +0 -11
  115. data/spec/lib/model/membase/zone_spec.rb +0 -32
  116. data/spec/lib/old_spec.rb +0 -437
@@ -0,0 +1,406 @@
1
+ module Neuron
2
+ module Schema
3
+ class Ad
4
+ include Common
5
+
6
+ SCHEMA = self.new
7
+
8
+ def index
9
+ @@index ||=
10
+ set_of(object_type("ad",
11
+ :id => id,
12
+ :name => nullable_string
13
+ ))
14
+ end
15
+
16
+ def create
17
+ @@create ||=
18
+ one_of(
19
+ create_redirect,
20
+ create_video_ad,
21
+ create_vast_network,
22
+ create_acudeo_network
23
+ )
24
+ end
25
+
26
+ def show
27
+ @@show ||=
28
+ one_of(
29
+ show_redirect,
30
+ show_video_ad,
31
+ show_vast_network,
32
+ show_acudeo_network
33
+ )
34
+ end
35
+
36
+ def update
37
+ @@update ||=
38
+ one_of(
39
+ update_redirect,
40
+ update_video_ad,
41
+ update_vast_network,
42
+ update_acudeo_network
43
+ )
44
+ end
45
+
46
+ # --------------------
47
+
48
+ def create_redirect
49
+ @@create_redirect ||=
50
+ object_type("ad", merged(CREATE_PROPERTIES,{
51
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::REDIRECT]),
52
+ :redirect_url => SCHEMA.url,
53
+ }))
54
+ end
55
+
56
+ def create_video_ad
57
+ @@create_video_ad ||=
58
+ object_type("ad", merged(CREATE_PROPERTIES,{
59
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::VIDEO_AD]),
60
+ :video_flv_url => SCHEMA.url(:required => false),
61
+ :clickthru_url => SCHEMA.url(:required => false),
62
+ :companion_ad_html => SCHEMA.companion_ad_html(:required => false),
63
+ :social_urls => SCHEMA.social_urls(:required => false),
64
+ :vast_tracker_urls => SCHEMA.vast_tracker_urls(:required => false),
65
+ }))
66
+ end
67
+
68
+ def create_vast_network
69
+ @@create_vast_network ||=
70
+ object_type("ad", merged(CREATE_PROPERTIES,{
71
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::VAST_NETWORK]),
72
+ :vast_url => SCHEMA.url,
73
+ }))
74
+ end
75
+
76
+ def create_acudeo_network
77
+ @@create_acudeo_network ||=
78
+ object_type("ad", merged(CREATE_PROPERTIES,{
79
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::ACUDEO_NETWORK]),
80
+ :acudeo_program_id => SCHEMA.slug,
81
+ }))
82
+ end
83
+
84
+ def show_redirect
85
+ @@show_redirect ||=
86
+ object_type("ad", merged(SHOW_PROPERTIES,{
87
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::REDIRECT]),
88
+ :redirect_url => SCHEMA.url,
89
+ }))
90
+ end
91
+
92
+ def show_video_ad
93
+ @@show_video_ad ||=
94
+ object_type("ad", merged(SHOW_PROPERTIES,{
95
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::VIDEO_AD]),
96
+ :video_flv_url => SCHEMA.url,
97
+ :clickthru_url => SCHEMA.url,
98
+ :companion_ad_html => SCHEMA.companion_ad_html,
99
+ :social_urls => SCHEMA.social_urls,
100
+ :vast_tracker_urls => SCHEMA.vast_tracker_urls,
101
+ }))
102
+ end
103
+
104
+ def show_vast_network
105
+ @@show_vast_network ||=
106
+ object_type("ad", merged(SHOW_PROPERTIES,{
107
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::VAST_NETWORK]),
108
+ :vast_url => SCHEMA.url,
109
+ }))
110
+ end
111
+
112
+ def show_acudeo_network
113
+ @@show_acudeo_network ||=
114
+ object_type("ad", merged(SHOW_PROPERTIES,{
115
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::ACUDEO_NETWORK]),
116
+ :acudeo_program_id => SCHEMA.slug,
117
+ }))
118
+ end
119
+
120
+ def update_redirect
121
+ @@update_redirect ||=
122
+ object_type("ad", merged(UPDATE_PROPERTIES,{
123
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::REDIRECT], :required => false),
124
+ :redirect_url => SCHEMA.url(:required => false),
125
+ }))
126
+ end
127
+
128
+ def update_video_ad
129
+ @@update_video_ad ||=
130
+ object_type("ad", merged(UPDATE_PROPERTIES,{
131
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::VIDEO_AD], :required => false),
132
+ :video_flv_url => SCHEMA.url(:required => false),
133
+ :clickthru_url => SCHEMA.url(:required => false),
134
+ :companion_ad_html => SCHEMA.companion_ad_html(:required => false),
135
+ :social_urls => SCHEMA.social_urls(:required => false),
136
+ :vast_tracker_urls => SCHEMA.vast_tracker_urls(:required => false),
137
+ }))
138
+ end
139
+
140
+ def update_vast_network
141
+ @@update_vast_network ||=
142
+ object_type("ad", merged(UPDATE_PROPERTIES,{
143
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::VAST_NETWORK], :required => false),
144
+ :vast_url => SCHEMA.url(:required => false),
145
+ }))
146
+ end
147
+
148
+ def update_acudeo_network
149
+ @@update_acudeo_network ||=
150
+ object_type("ad", merged(UPDATE_PROPERTIES,{
151
+ :response_type => SCHEMA.choice_of([Neuron::Client::Ad::ACUDEO_NETWORK], :required => false),
152
+ :acudeo_program_id => SCHEMA.slug(:required => false),
153
+ }))
154
+ end
155
+
156
+ # --------------------
157
+
158
+ def companion_ad_html(overrides={})
159
+ merged({
160
+ :type => %w(string null),
161
+ :required => true
162
+ }, overrides)
163
+ end
164
+
165
+ def daily_cap(overrides={})
166
+ merged({
167
+ :type => %w(integer string null),
168
+ :required => true,
169
+ :minimum => 1,
170
+ :exclusiveMinimum => false,
171
+ :pattern => "^[1-9]\\d*$"
172
+ }, overrides)
173
+ end
174
+
175
+ def day_partitions(overrides={})
176
+ merged({
177
+ :type => ["string","null"],
178
+ :required => true,
179
+ :minLength => 168,
180
+ :maxLength => 168,
181
+ :pattern => "^[TF]+$"
182
+ }, overrides)
183
+ end
184
+
185
+ def frequency_cap(overrides={})
186
+ merged({
187
+ :type => ["object","null"],
188
+ :additionalProperties => false,
189
+ :required => true,
190
+ :properties => {
191
+ :limit => {
192
+ :type => %w(integer string),
193
+ :minimum => 1,
194
+ :maximum => 10,
195
+ :required => true,
196
+ :enum => (1..10).to_a + (1..10).map(&:to_s)
197
+ },
198
+ :window => choice_of(Neuron::Client::Ad::FREQUENCY_CAP_WINDOWS)
199
+ }
200
+ }, overrides)
201
+ end
202
+
203
+ def geo_target_netacuity_ids(overrides={})
204
+ properties = {}
205
+ Neuron::Client::GeoTarget::TYPES.each do |geo_type|
206
+ properties[geo_type] = set_of(integer, :required => false)
207
+ end
208
+ merged({
209
+ :type => "object",
210
+ :required => true,
211
+ :additionalProperties => false,
212
+ :properties => properties
213
+ }, overrides)
214
+ end
215
+
216
+ def ideal_impressions_per_hour(overrides={})
217
+ merged({
218
+ :type => %w(number string null),
219
+ :required => true,
220
+ :minimum => 0,
221
+ :exclusiveMinimum => true,
222
+ :pattern => "^\\d+(\\.\\d+)?$"
223
+ }, overrides)
224
+ end
225
+
226
+ def overall_cap(overrides={})
227
+ merged({
228
+ :type => %w(integer string null),
229
+ :required => true,
230
+ :minimum => 1,
231
+ :exclusiveMinimum => false,
232
+ :pattern => "^[1-9]\\d*$"
233
+ }, overrides)
234
+ end
235
+
236
+ def social_urls(overrides={})
237
+ properties = {}
238
+ Neuron::Client::Ad::SOCIAL_TYPES.each do |social_type|
239
+ properties[social_type] = url(:required => false)
240
+ end
241
+ merged({
242
+ :type => "object",
243
+ :required => true,
244
+ :additionalProperties => false,
245
+ :properties => properties
246
+ }, overrides)
247
+ end
248
+
249
+ def vast_tracker_urls(overrides={})
250
+ properties = {}
251
+ Neuron::Client::Ad::VAST_TRACKER_TYPES.each do |tracker_type|
252
+ properties[tracker_type] = set_of(url, :required => false)
253
+ end
254
+ merged({
255
+ :type => "object",
256
+ :required => true,
257
+ :additionalProperties => false,
258
+ :properties => properties
259
+ }, overrides)
260
+ end
261
+
262
+ def zone_links(overrides={})
263
+ merged({
264
+ :type => "object",
265
+ :required => true,
266
+ :additionalProperties => false,
267
+ :patternProperties => {
268
+ "^\\w+$" => {
269
+ :description => "property name is a zone id",
270
+ :type => "object",
271
+ :required => true,
272
+ :additionalProperties => false,
273
+ :properties => {
274
+ :priority => priority,
275
+ :weight => weight
276
+ }
277
+ }
278
+ }
279
+ }, overrides)
280
+ end
281
+
282
+ # --------------------
283
+
284
+ private
285
+
286
+ CREATE_PROPERTIES =
287
+ {
288
+ :approved => SCHEMA.yes_no( :required => true),
289
+ :daily_cap => SCHEMA.daily_cap( :required => false),
290
+ :day_partitions => SCHEMA.day_partitions( :required => false),
291
+ :end_datetime => SCHEMA.datetime( :required => false, :type => %w(string null)),
292
+ :frequency_cap => SCHEMA.frequency_cap( :required => false),
293
+ :geo_target_netacuity_ids => SCHEMA.geo_target_netacuity_ids( :required => false),
294
+ :ideal_impressions_per_hour => SCHEMA.ideal_impressions_per_hour(:required => false),
295
+ :name => SCHEMA.nullable_string( :required => false),
296
+ :overall_cap => SCHEMA.overall_cap( :required => false),
297
+ :pixel_ids => SCHEMA.set_of(SCHEMA.id, :required => false),
298
+ :start_datetime => SCHEMA.datetime( :required => true),
299
+ :time_zone => SCHEMA.timezone( :required => true),
300
+ :zone_links => SCHEMA.zone_links( :required => false),
301
+
302
+ :id => SCHEMA.missing_or_null,
303
+ :created_at => SCHEMA.missing_or_null,
304
+ :updated_at => SCHEMA.missing_or_null,
305
+ :total_impressed => SCHEMA.missing_or_null,
306
+ :today_impressed => SCHEMA.missing_or_null,
307
+
308
+ :response_type => SCHEMA.choice_of([]),
309
+
310
+ # Redirect:
311
+ :redirect_url => SCHEMA.missing_or_null,
312
+
313
+ # VastNetwork:
314
+ :vast_url => SCHEMA.missing_or_null,
315
+
316
+ # AcudeoNetwork:
317
+ :acudeo_program_id => SCHEMA.missing_or_null,
318
+
319
+ # VideoAd:
320
+ :video_flv_url => SCHEMA.missing_or_null,
321
+ :clickthru_url => SCHEMA.missing_or_null,
322
+ :companion_ad_html => SCHEMA.missing_or_null,
323
+ :social_urls => SCHEMA.missing_or_null_or_empty_hash,
324
+ :vast_tracker_urls => SCHEMA.missing_or_null_or_empty_hash,
325
+ }
326
+
327
+ SHOW_PROPERTIES =
328
+ {
329
+ :approved => SCHEMA.yes_no( :required => true),
330
+ :daily_cap => SCHEMA.daily_cap( :required => true),
331
+ :day_partitions => SCHEMA.day_partitions( :required => true),
332
+ :end_datetime => SCHEMA.datetime( :required => true, :type => %w(string null)),
333
+ :frequency_cap => SCHEMA.frequency_cap( :required => true),
334
+ :geo_target_netacuity_ids => SCHEMA.geo_target_netacuity_ids( :required => true),
335
+ :ideal_impressions_per_hour => SCHEMA.ideal_impressions_per_hour(:required => true),
336
+ :name => SCHEMA.nullable_string( :required => true),
337
+ :overall_cap => SCHEMA.overall_cap( :required => true),
338
+ :pixel_ids => SCHEMA.set_of(SCHEMA.id, :required => true),
339
+ :start_datetime => SCHEMA.datetime( :required => true),
340
+ :time_zone => SCHEMA.timezone( :required => true),
341
+ :zone_links => SCHEMA.zone_links( :required => true),
342
+
343
+ :id => SCHEMA.id( :required => true),
344
+ :created_at => SCHEMA.datetime( :required => true),
345
+ :updated_at => SCHEMA.datetime( :required => true),
346
+ :total_impressed => SCHEMA.integer(:minimum => 0, :required => true),
347
+ :today_impressed => SCHEMA.integer(:minimum => 0, :required => true),
348
+
349
+ :response_type => SCHEMA.choice_of([], :required => true),
350
+
351
+ # Redirect:
352
+ :redirect_url => SCHEMA.missing_or_null,
353
+
354
+ # VastNetwork:
355
+ :vast_url => SCHEMA.missing_or_null,
356
+
357
+ # AcudeoNetwork:
358
+ :acudeo_program_id => SCHEMA.missing_or_null,
359
+
360
+ # VideoAd:
361
+ :video_flv_url => SCHEMA.missing_or_null,
362
+ :clickthru_url => SCHEMA.missing_or_null,
363
+ :companion_ad_html => SCHEMA.missing_or_null,
364
+ :social_urls => SCHEMA.missing_or_null_or_empty_hash,
365
+ :vast_tracker_urls => SCHEMA.missing_or_null_or_empty_hash,
366
+ }
367
+
368
+ UPDATE_PROPERTIES =
369
+ {
370
+ :id => SCHEMA.id(:required => true),
371
+
372
+ :approved => SCHEMA.yes_no( :required => false),
373
+ :daily_cap => SCHEMA.daily_cap( :required => false),
374
+ :day_partitions => SCHEMA.day_partitions( :required => false),
375
+ :end_datetime => SCHEMA.datetime( :required => false, :type => %w(string null)),
376
+ :frequency_cap => SCHEMA.frequency_cap( :required => false),
377
+ :geo_target_netacuity_ids => SCHEMA.geo_target_netacuity_ids( :required => false),
378
+ :ideal_impressions_per_hour => SCHEMA.ideal_impressions_per_hour(:required => false),
379
+ :name => SCHEMA.nullable_string( :required => false),
380
+ :overall_cap => SCHEMA.overall_cap( :required => false),
381
+ :pixel_ids => SCHEMA.set_of(SCHEMA.id, :required => false),
382
+ :start_datetime => SCHEMA.datetime( :required => false),
383
+ :time_zone => SCHEMA.timezone( :required => false),
384
+ :zone_links => SCHEMA.zone_links( :required => false),
385
+
386
+ :response_type => SCHEMA.choice_of([], :required => false),
387
+
388
+ # Redirect:
389
+ :redirect_url => SCHEMA.missing_or_null,
390
+
391
+ # VastNetwork:
392
+ :vast_url => SCHEMA.missing_or_null,
393
+
394
+ # AcudeoNetwork:
395
+ :acudeo_program_id => SCHEMA.missing_or_null,
396
+
397
+ # VideoAd:
398
+ :video_flv_url => SCHEMA.missing_or_null,
399
+ :clickthru_url => SCHEMA.missing_or_null,
400
+ :companion_ad_html => SCHEMA.missing_or_null,
401
+ :social_urls => SCHEMA.missing_or_null_or_empty_hash,
402
+ :vast_tracker_urls => SCHEMA.missing_or_null_or_empty_hash,
403
+ }
404
+ end
405
+ end
406
+ end
@@ -0,0 +1,49 @@
1
+ module Neuron
2
+ module Schema
3
+ class AdZone
4
+ include Common
5
+
6
+ SCHEMA = self.new
7
+
8
+ def index
9
+ @@index ||=
10
+ set_of(object_type("ad_zone",
11
+ :ad_id => id,
12
+ :zone_id => uuid,
13
+ :weight => weight,
14
+ :priority => priority
15
+ ))
16
+ end
17
+
18
+ def create
19
+ @@create ||=
20
+ object_type("ad_zone",
21
+ :ad_id => id,
22
+ :zone_id => uuid,
23
+ :weight => weight,
24
+ :priority => priority
25
+ )
26
+ end
27
+
28
+ def show
29
+ @@show ||=
30
+ object_type("ad_zone",
31
+ :ad_id => id,
32
+ :zone_id => uuid,
33
+ :weight => weight,
34
+ :priority => priority
35
+ )
36
+ end
37
+
38
+ def update
39
+ @@update ||=
40
+ object_type("ad_zone",
41
+ :ad_id => id,
42
+ :zone_id => uuid,
43
+ :weight => weight,
44
+ :priority => priority
45
+ )
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,52 @@
1
+ module Neuron
2
+ module Schema
3
+ class BlockedReferer
4
+ include Common
5
+
6
+ SCHEMA = self.new
7
+
8
+ def index
9
+ @@index ||=
10
+ set_of(object_type("blocked_referer",
11
+ :id => id,
12
+ :referer => blocked_referer
13
+ ))
14
+ end
15
+
16
+ def create
17
+ @@create ||=
18
+ object_type("blocked_referer",
19
+ :referer => blocked_referer
20
+ )
21
+ end
22
+
23
+ def show
24
+ @@show ||=
25
+ object_type("blocked_referer",
26
+ :id => id,
27
+ :referer => blocked_referer,
28
+ :created_at => datetime,
29
+ :updated_at => datetime
30
+ )
31
+ end
32
+
33
+ def update
34
+ @@update ||=
35
+ object_type("blocked_referer",
36
+ :id => id,
37
+ :referer => blocked_referer
38
+ )
39
+ end
40
+
41
+ private
42
+
43
+ def blocked_referer(overrides={})
44
+ merged({
45
+ :type => "string",
46
+ :maxLength => 2000,
47
+ :required => true
48
+ }, overrides)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,64 @@
1
+ module Neuron
2
+ module Schema
3
+ class BlockedUserAgent
4
+ include Common
5
+
6
+ SCHEMA = self.new
7
+
8
+ def index
9
+ @@index ||=
10
+ set_of(object_type("blocked_user_agent",
11
+ :id => id,
12
+ :description => description,
13
+ :user_agent => user_agent
14
+ ))
15
+ end
16
+
17
+ def create
18
+ @@create ||=
19
+ object_type("blocked_user_agent",
20
+ :description => description(:required => false),
21
+ :user_agent => user_agent
22
+ )
23
+ end
24
+
25
+ def show
26
+ @@show ||=
27
+ object_type("blocked_user_agent",
28
+ :id => id,
29
+ :description => description,
30
+ :user_agent => user_agent,
31
+ :created_at => datetime,
32
+ :updated_at => datetime
33
+ )
34
+ end
35
+
36
+ def update
37
+ @@update ||=
38
+ object_type("blocked_user_agent",
39
+ :id => id,
40
+ :description => description(:required => false),
41
+ :user_agent => user_agent(:required => false)
42
+ )
43
+ end
44
+
45
+ private
46
+
47
+ def description(overrides={})
48
+ merged({
49
+ :type => %w(string null),
50
+ :maxLength => 255,
51
+ :required => true
52
+ }, overrides)
53
+ end
54
+
55
+ def user_agent(overrides={})
56
+ merged({
57
+ :type => "string",
58
+ :format => "regex",
59
+ :required => true
60
+ }, overrides)
61
+ end
62
+ end
63
+ end
64
+ end