Class: VAST::NonLinearCreative

Inherits:
Creative show all
Defined in:
lib/vast/non_linear_creative.rb

Overview

NonLinearCreative runs concurrently with the video content so the users see the ad while viewing the content. Non-linear video ads can be delivered as text, graphical ads, or as video overlays.

Instance Attribute Summary

Attributes inherited from Element

#source_node

Instance Method Summary collapse

Methods inherited from Creative

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

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from VAST::Element

Instance Method Details

#api_frameworkObject

Defines the method to use for communication with the companion



31
32
33
# File 'lib/vast/non_linear_creative.rb', line 31

def api_framework
  source_node[:apiFramework]
end

#click_through_urlObject

URI to open as destination page when user clicks on creative



36
37
38
# File 'lib/vast/non_linear_creative.rb', line 36

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

#creative_typeObject

Returns MIME type of static creative



69
70
71
72
73
# File 'lib/vast/non_linear_creative.rb', line 69

def creative_type
  if resource_type == :static
    source_node.at('StaticResource')[:creativeType]
  end
end

#expanded_heightObject

Height in pixels when in expanded state



26
27
28
# File 'lib/vast/non_linear_creative.rb', line 26

def expanded_height
  source_node[:expandedHeight].to_i
end

#expanded_widthObject

Width in pixels when in expanded state



21
22
23
# File 'lib/vast/non_linear_creative.rb', line 21

def expanded_width
  source_node[:expandedWidth].to_i
end

#heightObject

Height in pixels



16
17
18
# File 'lib/vast/non_linear_creative.rb', line 16

def height
  source_node[:height].to_i
end

#idObject



6
7
8
# File 'lib/vast/non_linear_creative.rb', line 6

def id
  source_node[:id]
end

#maintain_aspect_ratio?Boolean

Whether the mediafile must have its aspect ratio maintained when scaled

Returns:

  • (Boolean)


46
47
48
# File 'lib/vast/non_linear_creative.rb', line 46

def maintain_aspect_ratio?
  source_node[:maintainAspectRatio]=="true"
end

#min_suggested_durationObject

Suggested duration to display non-linear ad, typically for animation to complete. Expressed in standard time format hh:mm:ss



52
53
54
# File 'lib/vast/non_linear_creative.rb', line 52

def min_suggested_duration
  source_node[:minSuggestedDuration]
end

#resource_htmlObject

Returns HTML text for html resource



86
87
88
89
90
# File 'lib/vast/non_linear_creative.rb', line 86

def resource_html
  if resource_type == :html
    source_node.at('HTMLResource').content
  end
end

#resource_typeObject

Type of non-linear resource, returned as a symbol. Either :static, :iframe, or :html.



58
59
60
61
62
63
64
65
66
# File 'lib/vast/non_linear_creative.rb', line 58

def resource_type
  if source_node.at('StaticResource')
    :static
  elsif source_node.at('IFrameResource')
    :iframe
  elsif source_node.at('HTMLResource')
    :html
  end
end

#resource_urlObject

Returns URI for static or iframe resource



76
77
78
79
80
81
82
83
# File 'lib/vast/non_linear_creative.rb', line 76

def resource_url
  case resource_type
  when :static
    URI.parse source_node.at('StaticResource').content.strip
  when :iframe
    URI.parse source_node.at('IFrameResource').content.strip
  end
end

#scalable?Boolean

Whether it is acceptable to scale the mediafile.

Returns:

  • (Boolean)


41
42
43
# File 'lib/vast/non_linear_creative.rb', line 41

def scalable?
  source_node[:scalable]=="true"
end

#widthObject

Width in pixels



11
12
13
# File 'lib/vast/non_linear_creative.rb', line 11

def width
  source_node[:width].to_i
end