Class: VAST::LinearCreative
Overview
LinearCreative is presented before, in the middle of, or after the video content is consumed by the user, in very much the same way a TV commercial can play before, during or after the chosen program.
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary (collapse)
-
- (Object) click_through_url
URI to open as destination page when user clicks on the video.
-
- (Object) click_tracking_urls
An array of URIs to request for tracking purposes when user clicks on the video.
-
- (Object) custom_click_urls
A hash of URIs to request on custom events such as hotspotted video.
-
- (Object) duration
Duration of creative.
-
- (Object) mediafiles
Returns mediafiles containing the information required to display the linear creative's media.
Methods inherited from Creative
#ad, #ad_id, #ad_parameters, #id, #sequence, #tracking_urls
Methods inherited from Element
Constructor Details
This class inherits a constructor from VAST::Element
Instance Method Details
- (Object) click_through_url
URI to open as destination page when user clicks on the video
12 13 14 |
# File 'lib/vast/linear_creative.rb', line 12 def click_through_url URI.parse source_node.at('ClickThrough').content.strip end |
- (Object) click_tracking_urls
An array of URIs to request for tracking purposes when user clicks on the video
17 18 19 20 21 |
# File 'lib/vast/linear_creative.rb', line 17 def click_tracking_urls source_node.xpath('.//ClickTracking').to_a.collect do |node| URI.parse node.content.strip end end |
- (Object) custom_click_urls
A hash of URIs to request on custom events such as hotspotted video. This library required custom click urls to identify themselves with an `id` attribute, which is used as the key for this hash
26 27 28 29 30 31 32 33 |
# File 'lib/vast/linear_creative.rb', line 26 def custom_click_urls custom_click_urls = {} source_node.xpath('.//CustomClick').to_a.collect do |node| key = underscore(node[:id]).to_sym custom_click_urls[key] = URI.parse(node.content.strip) end custom_click_urls end |
- (Object) duration
Duration of creative
7 8 9 |
# File 'lib/vast/linear_creative.rb', line 7 def duration source_node.at('Duration').content end |
- (Object) mediafiles
Returns mediafiles containing the information required to display the linear creative's media
It is assumed that all mediafiles accessible represent the same creative unit with the same duration, Ad-ID (ISCI code), etc.
39 40 41 42 43 |
# File 'lib/vast/linear_creative.rb', line 39 def mediafiles source_node.xpath('.//MediaFile').to_a.collect do |node| Mediafile.new(node) end end |