Class: Neuron::Schema::Zone

Inherits:
Object show all
Includes:
Common
Defined in:
lib/neuron-client/schema/zone.rb

Constant Summary collapse

SCHEMA =
self.new

Instance Method Summary collapse

Methods included from Common

#choice_of, #datetime, #errors, #id, included, #integer, #merged, #missing_or_null, #missing_or_null_or_empty_hash, #nonnull_string, #null, #nullable_string, #object_type, #object_type_or_null, #one_of, #parameters, #priority, #set_of, #slug, #timezone, #url, #uuid, #weight, #yes_no

Instance Method Details




182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/neuron-client/schema/zone.rb', line 182

def ad_links(overrides={})
  merged({
    :type => "object",
    :required => true,
    :additionalProperties => false,
    :patternProperties => {
      "^[0-9]+$" => {
        :description => "property name is an ad id",
        :type => "object",
        :required => true,
        :additionalProperties => false,
        :properties => {
          :priority => priority,
          :weight => weight
        }
      }
    }
  }, overrides)
end

#channel(overrides = {}) ⇒ Object



202
203
204
205
206
207
208
209
# File 'lib/neuron-client/schema/zone.rb', line 202

def channel(overrides={})
  merged({
    :type => "string",
    :pattern => "^\\w+$",
    :minLength => 1,
    :maxLength => 255
  }, overrides)
end

#color(overrides = {}) ⇒ Object



211
212
213
214
215
216
217
# File 'lib/neuron-client/schema/zone.rb', line 211

def color(overrides={})
  merged({
    :type => %w(string null),
    :format => "color",
    :required => true
  }, overrides)
end

#createObject



16
17
18
19
20
21
22
23
24
# File 'lib/neuron-client/schema/zone.rb', line 16

def create
  @@create ||=
  one_of(
    create_redirect,
    create_iris_2_0,
    create_iris_2_5,
    create_vast
  )
end

#create_iris_2_0Object



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/neuron-client/schema/zone.rb', line 55

def create_iris_2_0
  @@create_iris_2_0 ||=
  object_type("zone", merged(CREATE_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::IRIS]),
    :iris_version  => SCHEMA.choice_of([Neuron::Client::Zone::IRIS_2_0], :required => false),
    :template_slug => SCHEMA.choice_of(Neuron::Client::Zone::TEMPLATE_SLUGS),
    :channel       => SCHEMA.channel,
    :expand        => SCHEMA.yes_no,
    :mute          => SCHEMA.yes_no,
    :autoplay      => SCHEMA.yes_no
  }))
end

#create_iris_2_5Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/neuron-client/schema/zone.rb', line 68

def create_iris_2_5
  @@create_iris_2_5 ||=
  object_type("zone", merged(CREATE_PROPERTIES,{
    :response_type    => SCHEMA.choice_of([Neuron::Client::Zone::IRIS]),
    :iris_version     => SCHEMA.choice_of([Neuron::Client::Zone::IRIS_2_5]),
    :template_slug    => SCHEMA.choice_of(Neuron::Client::Zone::TEMPLATE_SLUGS),
    :channel          => SCHEMA.channel,
    :expand           => SCHEMA.yes_no,
    :playlist_mode    => SCHEMA.playlist_mode,
    :volume           => SCHEMA.volume,
    :color            => SCHEMA.color(:required => false),
    :playback_mode    => SCHEMA.playback_mode,
    :overlay_provider => SCHEMA.overlay_provider(:required => false),
    :overlay_feed_url => SCHEMA.url(:type => %w(null string), :required => false)
  }))
end

#create_redirectObject




48
49
50
51
52
53
# File 'lib/neuron-client/schema/zone.rb', line 48

def create_redirect
  @@create_redirect ||=
  object_type("zone", merged(CREATE_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::REDIRECT]),
  }))
end

#create_vastObject



85
86
87
88
89
90
# File 'lib/neuron-client/schema/zone.rb', line 85

def create_vast
  @@create_vast ||=
  object_type("zone", merged(CREATE_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::VAST]),
  }))
end

#indexObject



8
9
10
11
12
13
14
# File 'lib/neuron-client/schema/zone.rb', line 8

def index
  @@index ||=
  set_of(object_type("zone",
    :id => uuid,
    :name => nullable_string
  ))
end

#overlay_provider(overrides = {}) ⇒ Object



219
220
221
222
223
# File 'lib/neuron-client/schema/zone.rb', line 219

def overlay_provider(overrides={})
  choice_of(Neuron::Client::Zone::OVERLAY_PROVIDERS + [nil], merged({
    :type => %w(string null)
  },overrides))
end

#playback_mode(overrides = {}) ⇒ Object



225
226
227
# File 'lib/neuron-client/schema/zone.rb', line 225

def playback_mode(overrides={})
  choice_of(Neuron::Client::Zone::PLAYBACK_MODES, overrides)
end

#playlist_mode(overrides = {}) ⇒ Object



229
230
231
# File 'lib/neuron-client/schema/zone.rb', line 229

def playlist_mode(overrides={})
  choice_of(Neuron::Client::Zone::PLAYLIST_MODES, overrides)
end

#showObject



26
27
28
29
30
31
32
33
34
# File 'lib/neuron-client/schema/zone.rb', line 26

def show
  @@show ||=
  one_of(
    show_redirect,
    show_iris_2_0,
    show_iris_2_5,
    show_vast
  )
end

#show_iris_2_0Object



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/neuron-client/schema/zone.rb', line 99

def show_iris_2_0
  @@show_iris_2_0 ||=
  object_type("zone", merged(SHOW_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::IRIS]),
    :iris_version  => SCHEMA.choice_of([Neuron::Client::Zone::IRIS_2_0], :required => false),
    :template_slug => SCHEMA.choice_of(Neuron::Client::Zone::TEMPLATE_SLUGS),
    :channel       => SCHEMA.channel,
    :expand        => SCHEMA.yes_no,
    :mute          => SCHEMA.yes_no,
    :autoplay      => SCHEMA.yes_no
  }))
end

#show_iris_2_5Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/neuron-client/schema/zone.rb', line 112

def show_iris_2_5
  @@show_iris_2_5 ||=
  object_type("zone", merged(SHOW_PROPERTIES,{
    :response_type    => SCHEMA.choice_of([Neuron::Client::Zone::IRIS]),
    :iris_version     => SCHEMA.choice_of([Neuron::Client::Zone::IRIS_2_5]),
    :template_slug    => SCHEMA.choice_of(Neuron::Client::Zone::TEMPLATE_SLUGS),
    :channel          => SCHEMA.channel,
    :expand           => SCHEMA.yes_no,
    :playlist_mode    => SCHEMA.playlist_mode,
    :volume           => SCHEMA.volume,
    :color            => SCHEMA.color,
    :playback_mode    => SCHEMA.playback_mode,
    :overlay_provider => SCHEMA.overlay_provider,
    :overlay_feed_url => SCHEMA.url(:type => %w(null string))
  }))
end

#show_redirectObject



92
93
94
95
96
97
# File 'lib/neuron-client/schema/zone.rb', line 92

def show_redirect
  @@show_redirect ||=
  object_type("zone", merged(SHOW_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::REDIRECT]),
  }))
end

#show_vastObject



129
130
131
132
133
134
# File 'lib/neuron-client/schema/zone.rb', line 129

def show_vast
  @@show_vast ||=
  object_type("zone", merged(SHOW_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::VAST]),
  }))
end

#updateObject



36
37
38
39
40
41
42
43
44
# File 'lib/neuron-client/schema/zone.rb', line 36

def update
  @@update ||=
  one_of(
    update_redirect,
    update_iris_2_0,
    update_iris_2_5,
    update_vast
  )
end

#update_iris_2_0Object



143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/neuron-client/schema/zone.rb', line 143

def update_iris_2_0
  @@update_iris_2_0 ||=
  object_type("zone", merged(UPDATE_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::IRIS], :required => false),
    :iris_version  => SCHEMA.choice_of([Neuron::Client::Zone::IRIS_2_0], :required => false),
    :template_slug => SCHEMA.choice_of(Neuron::Client::Zone::TEMPLATE_SLUGS, :required => false),
    :channel       => SCHEMA.channel(:required => false),
    :expand        => SCHEMA.yes_no(:required => false),
    :mute          => SCHEMA.yes_no(:required => false),
    :autoplay      => SCHEMA.yes_no(:required => false)
  }))
end

#update_iris_2_5Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/neuron-client/schema/zone.rb', line 156

def update_iris_2_5
  @@update_iris_2_5 ||=
  object_type("zone", merged(UPDATE_PROPERTIES,{
    :response_type    => SCHEMA.choice_of([Neuron::Client::Zone::IRIS], :required => false),
    :iris_version     => SCHEMA.choice_of([Neuron::Client::Zone::IRIS_2_5], :required => false),
    :template_slug    => SCHEMA.choice_of(Neuron::Client::Zone::TEMPLATE_SLUGS, :required => false),
    :channel          => SCHEMA.channel(:required => false),
    :expand           => SCHEMA.yes_no(:required => false),
    :playlist_mode    => SCHEMA.playlist_mode(:required => false),
    :volume           => SCHEMA.volume(:required => false),
    :color            => SCHEMA.color(:required => false),
    :playback_mode    => SCHEMA.playback_mode(:required => false),
    :overlay_provider => SCHEMA.overlay_provider(:required => false),
    :overlay_feed_url => SCHEMA.url(:type => %w(null string), :required => false)
  }))
end

#update_redirectObject



136
137
138
139
140
141
# File 'lib/neuron-client/schema/zone.rb', line 136

def update_redirect
  @@update_redirect ||=
  object_type("zone", merged(UPDATE_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::REDIRECT], :required => false),
  }))
end

#update_vastObject



173
174
175
176
177
178
# File 'lib/neuron-client/schema/zone.rb', line 173

def update_vast
  @@update_vast ||=
  object_type("zone", merged(UPDATE_PROPERTIES,{
    :response_type => SCHEMA.choice_of([Neuron::Client::Zone::VAST], :required => false),
  }))
end

#volume(overrides = {}) ⇒ Object



233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/neuron-client/schema/zone.rb', line 233

def volume(overrides={})
  merged({
    :type => %w(integer string null),
    :required => true,
    :minimum => 0,
    :exclusiveMinimum => false,
    :maximum => 100,
    :exclusiveMaximum => false,
    :pattern => "^[0-9]\\d+$",
    :maxLength => 3
  }, overrides)
end