Class: VAST::LinearCreative

Inherits:
Creative show all
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

#source_node

Instance Method Summary collapse

Methods inherited from Creative

#ad, #ad_id, #ad_parameters, #id, #sequence, #tracking_urls

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from VAST::Element

Instance Method Details

#click_through_urlObject

URI to open as destination page when user clicks on the video



17
18
19
# File 'lib/vast/linear_creative.rb', line 17

def click_through_url
  URI.parse source_node.at('ClickThrough').content.strip
end

#click_tracking_urlsObject

An array of URIs to request for tracking purposes when user clicks on the video



22
23
24
25
26
# File 'lib/vast/linear_creative.rb', line 22

def click_tracking_urls
  source_node.xpath('.//ClickTracking').to_a.collect do |node|
    URI.parse node.content.strip
  end
end

#custom_click_urlsObject

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



31
32
33
34
35
36
37
38
# File 'lib/vast/linear_creative.rb', line 31

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

#durationObject

Duration of creative



7
8
9
# File 'lib/vast/linear_creative.rb', line 7

def duration
  source_node.at('Duration').content
end

#iconsObject



50
51
52
53
54
# File 'lib/vast/linear_creative.rb', line 50

def icons
  source_node.xpath('.//Icon').to_a.collect do |node|
    Icon.new(node)
  end
end

#mediafilesObject

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.



44
45
46
47
48
# File 'lib/vast/linear_creative.rb', line 44

def mediafiles
  source_node.xpath('.//MediaFile').to_a.collect do |node|
    Mediafile.new(node)
  end
end

#skipoffsetObject

VAST 3



12
13
14
# File 'lib/vast/linear_creative.rb', line 12

def skipoffset
  source_node[:skipoffset]
end