Class: VAST::Creative
Overview
Contains the information related to a piece of creative.
Sequence
The Creative element takes an optional “sequence” attribute that indicates the suggested order in which the Creatives should be displayed. If two Creative elements are intended to be shown at the same time they should share the same sequence number.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
- #ad ⇒ Object
- #ad_id ⇒ Object
-
#ad_parameters ⇒ Object
Data to be passed into the video ad.
- #id ⇒ Object
-
#sequence ⇒ Object
The preferred order in which multiple Creatives should be displayed.
-
#tracking_urls ⇒ Object
Returns a hash, keyed by event name, containing an array of URIs to be called for each event.
Methods inherited from Element
Constructor Details
This class inherits a constructor from VAST::Element
Instance Method Details
#ad ⇒ Object
10 11 12 |
# File 'lib/vast/creative.rb', line 10 def ad Ad.create source_node.ancestors('Ad').first end |
#ad_id ⇒ Object
18 19 20 |
# File 'lib/vast/creative.rb', line 18 def ad_id creative_node[:AdID] end |
#ad_parameters ⇒ Object
Data to be passed into the video ad.
28 29 30 |
# File 'lib/vast/creative.rb', line 28 def ad_parameters source_node.at('AdParameters').content end |
#id ⇒ Object
14 15 16 |
# File 'lib/vast/creative.rb', line 14 def id creative_node[:id] end |
#sequence ⇒ Object
The preferred order in which multiple Creatives should be displayed
23 24 25 |
# File 'lib/vast/creative.rb', line 23 def sequence creative_node[:sequence] end |
#tracking_urls ⇒ Object
Returns a hash, keyed by event name, containing an array of URIs to be called for each event.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vast/creative.rb', line 33 def tracking_urls tracking_urls = {} source_node.xpath('.//Tracking').to_a.collect do |node| underscored_name = underscore(node[:event]) if tracking_urls[underscored_name.to_sym] tracking_urls[underscored_name.to_sym] << URI.parse(node.content.strip) else tracking_urls[underscored_name.to_sym] = [URI.parse(node.content.strip)] end end tracking_urls end |