Class: VAST::LinearCreative
- Defined in:
- lib/vast/linear_creative.rb
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
-
#click_through_url ⇒ Object
URI to open as destination page when user clicks on the video.
-
#click_tracking_urls ⇒ Object
An array of URIs to request for tracking purposes when user clicks on the video.
-
#custom_click_urls ⇒ Object
A hash of URIs to request on custom events such as hotspotted video.
-
#duration ⇒ Object
Duration of creative.
-
#mediafiles ⇒ Object
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
#click_through_url ⇒ Object
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 |
#click_tracking_urls ⇒ Object
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 |
#custom_click_urls ⇒ Object
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 |
#duration ⇒ Object
Duration of creative
7 8 9 |
# File 'lib/vast/linear_creative.rb', line 7 def duration source_node.at('Duration').content end |
#mediafiles ⇒ Object
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 |