Class: VAST::Icon

Inherits:
Element show all
Defined in:
lib/vast/icon.rb

Overview

Any number of Mediafile objects can be provided for a single Ad, but it is assumed that all Mediafiles belongs to a single Ad object represent the same creative unit with the same duration, Ad-ID (ISCI code), etc.

Instance Attribute Summary

Attributes inherited from Element

#source_node

Instance Method Summary collapse

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



35
36
37
# File 'lib/vast/icon.rb', line 35

def api_framework
  source_node[:apiFramework]
end

#click_through_urlObject



73
74
75
# File 'lib/vast/icon.rb', line 73

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

#click_tracking_urlObject



77
78
79
# File 'lib/vast/icon.rb', line 77

def click_tracking_url
  URI.parse source_node.at('IconClickTracking').content.strip
end

#creative_typeObject

Returns MIME type of static creative



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

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

#durationObject



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

def duration
  source_node[:duration].to_i
end

#heightObject



14
15
16
# File 'lib/vast/icon.rb', line 14

def height
  source_node[:height].to_i
end

#offsetObject



30
31
32
# File 'lib/vast/icon.rb', line 30

def offset
  source_node[:offset].to_i
end

#programObject



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

def program
  source_node[:program]
end

#resource_htmlObject

Returns HTML text for html resource



67
68
69
70
71
# File 'lib/vast/icon.rb', line 67

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

#resource_typeObject



39
40
41
42
43
44
45
46
47
# File 'lib/vast/icon.rb', line 39

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



57
58
59
60
61
62
63
64
# File 'lib/vast/icon.rb', line 57

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

#view_tracking_urlObject



81
82
83
# File 'lib/vast/icon.rb', line 81

def view_tracking_url
  URI.parse source_node.at('IconViewTracking').content.strip
end

#widthObject



10
11
12
# File 'lib/vast/icon.rb', line 10

def width
  source_node[:width].to_i
end

#xPositionObject



18
19
20
# File 'lib/vast/icon.rb', line 18

def xPosition
  source_node[:xPosition].to_i
end

#yPositionObject



22
23
24
# File 'lib/vast/icon.rb', line 22

def yPosition
  source_node[:yPosition].to_i
end