sessionm-vast 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vast/ad.rb +4 -8
- data/lib/vast/companion_creative.rb +3 -3
- data/lib/vast/creative.rb +3 -3
- data/lib/vast/document.rb +2 -28
- data/lib/vast/inline_ad.rb +1 -6
- data/lib/vast/linear_creative.rb +4 -16
- data/lib/vast/mediafile.rb +2 -2
- data/lib/vast/non_linear_creative.rb +4 -8
- data/lib/vast/wrapper_ad.rb +2 -2
- data/lib/vast.rb +1 -3
- data/test/ad_test.rb +2 -2
- metadata +4 -11
- data/Gemfile +0 -9
- data/Pathfile +0 -2
- data/Rakefile +0 -8
- data/lib/vast/icon.rb +0 -87
- data/lib/vast3_draft.xsd +0 -1036
- data/test/examples/vast3_inline.xml +0 -86
- data/test/vast3_inline_ad_test.rb +0 -23
data/lib/vast/ad.rb
CHANGED
@@ -32,10 +32,6 @@ module VAST
|
|
32
32
|
def id
|
33
33
|
source_node[:id]
|
34
34
|
end
|
35
|
-
|
36
|
-
def sequence
|
37
|
-
source_node[:sequence]
|
38
|
-
end
|
39
35
|
|
40
36
|
# Returns name of source ad server
|
41
37
|
def ad_system
|
@@ -50,7 +46,7 @@ module VAST
|
|
50
46
|
# Returns URI to request if ad does not play due to error.
|
51
47
|
def error_url
|
52
48
|
error_url_node = source_node.at("Error")
|
53
|
-
URI.parse(
|
49
|
+
URI.parse(error_url_node.content.strip) if error_url_node
|
54
50
|
end
|
55
51
|
|
56
52
|
# Returns an array containing all linear creatives.
|
@@ -82,14 +78,14 @@ module VAST
|
|
82
78
|
|
83
79
|
# Each Ad must contain at least one impression.
|
84
80
|
def impression
|
85
|
-
URI.parse(
|
81
|
+
URI.parse(source_node.at('Impression').content.strip)
|
86
82
|
end
|
87
83
|
|
88
84
|
# Array of all impressions available for this ad, excluding those specific
|
89
85
|
# to a particular creative.
|
90
86
|
def impressions
|
91
87
|
source_node.xpath('.//Impression').to_a.collect do |node|
|
92
|
-
URI.parse(
|
88
|
+
URI.parse(node.content.strip)
|
93
89
|
end
|
94
90
|
end
|
95
91
|
|
@@ -100,4 +96,4 @@ module VAST
|
|
100
96
|
end
|
101
97
|
end
|
102
98
|
end
|
103
|
-
end
|
99
|
+
end
|
@@ -34,7 +34,7 @@ module VAST
|
|
34
34
|
|
35
35
|
# URI to open as destination page when user clicks on the video
|
36
36
|
def click_through_url
|
37
|
-
URI.parse
|
37
|
+
URI.parse source_node.at('CompanionClickThrough').content.strip
|
38
38
|
end
|
39
39
|
|
40
40
|
# Alternate text to be displayed when companion is rendered in HTML environment.
|
@@ -65,9 +65,9 @@ module VAST
|
|
65
65
|
def resource_url
|
66
66
|
case resource_type
|
67
67
|
when :static
|
68
|
-
URI.parse
|
68
|
+
URI.parse source_node.at('StaticResource').content.strip
|
69
69
|
when :iframe
|
70
|
-
URI.parse
|
70
|
+
URI.parse source_node.at('IFrameResource').content.strip
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
data/lib/vast/creative.rb
CHANGED
@@ -35,9 +35,9 @@ module VAST
|
|
35
35
|
source_node.xpath('.//Tracking').to_a.collect do |node|
|
36
36
|
underscored_name = underscore(node[:event])
|
37
37
|
if tracking_urls[underscored_name.to_sym]
|
38
|
-
tracking_urls[underscored_name.to_sym] << URI.parse(
|
38
|
+
tracking_urls[underscored_name.to_sym] << URI.parse(node.content.strip)
|
39
39
|
else
|
40
|
-
tracking_urls[underscored_name.to_sym] = [URI.parse(
|
40
|
+
tracking_urls[underscored_name.to_sym] = [URI.parse(node.content.strip)]
|
41
41
|
end
|
42
42
|
end
|
43
43
|
tracking_urls
|
@@ -59,4 +59,4 @@ module VAST
|
|
59
59
|
source_node.ancestors('Creative').first
|
60
60
|
end
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
data/lib/vast/document.rb
CHANGED
@@ -1,17 +1,9 @@
|
|
1
1
|
module VAST
|
2
2
|
# A complete VAST document
|
3
3
|
class Document < Nokogiri::XML::Document
|
4
|
-
|
5
|
-
|
6
|
-
def self.eval_macro(xml_string)
|
7
|
-
end
|
8
|
-
|
4
|
+
|
9
5
|
# Parse a VAST XML document
|
10
6
|
def self.parse(*args)
|
11
|
-
# VAST 3 support macro, need to uri escape all macros
|
12
|
-
if (args[0].is_a? String)
|
13
|
-
@macros.each{|x| args[0].gsub!("[#{x}]", "%5B#{x}%5D")}
|
14
|
-
end
|
15
7
|
super(*args)
|
16
8
|
end
|
17
9
|
|
@@ -25,17 +17,7 @@ module VAST
|
|
25
17
|
# Checks whether document conforms to the VAST XML Schema Definitions, accessible at
|
26
18
|
# http://www.iab.net/iab_products_and_industry_services/508676/digitalvideo/vast
|
27
19
|
def valid?
|
28
|
-
|
29
|
-
major_version = version_node ? version_node.value.to_i : 0
|
30
|
-
case major_version
|
31
|
-
when 2
|
32
|
-
xsd_file = VAST_SCHEMA_XSD_FILE
|
33
|
-
when 3
|
34
|
-
xsd_file = VAST3_SCHEMA_XSD_FILE
|
35
|
-
else
|
36
|
-
return false
|
37
|
-
end
|
38
|
-
xsd = Nokogiri::XML::Schema(File.read(xsd_file))
|
20
|
+
xsd = Nokogiri::XML::Schema(File.read(VAST_SCHEMA_XSD_FILE))
|
39
21
|
xsd.valid?(self)
|
40
22
|
end
|
41
23
|
|
@@ -54,14 +36,6 @@ module VAST
|
|
54
36
|
def inline_ads
|
55
37
|
ads.select{ |ad| ad.kind_of?(VAST::InlineAd) }
|
56
38
|
end
|
57
|
-
|
58
|
-
def ad_pod_ads
|
59
|
-
ads.select{ |ad| ad.sequence.is_a? Numeric }.sort{|x, y| x.sequence <=> y.sequence }
|
60
|
-
end
|
61
|
-
|
62
|
-
def stand_alone_ads
|
63
|
-
ads.select{ |ad| !ad.sequence.is_a?(Numeric) }
|
64
|
-
end
|
65
39
|
|
66
40
|
# All wrapper ads
|
67
41
|
def wrapper_ads
|
data/lib/vast/inline_ad.rb
CHANGED
@@ -4,12 +4,7 @@ module VAST
|
|
4
4
|
|
5
5
|
# URI of request to survey vendor
|
6
6
|
def survey_url
|
7
|
-
URI.parse
|
8
|
-
end
|
9
|
-
|
10
|
-
# Common name of ad
|
11
|
-
def ad_system
|
12
|
-
source_node.at('AdSystem').content
|
7
|
+
URI.parse source_node.at('Survey').content.strip
|
13
8
|
end
|
14
9
|
|
15
10
|
# Common name of ad
|
data/lib/vast/linear_creative.rb
CHANGED
@@ -8,20 +8,15 @@ module VAST
|
|
8
8
|
source_node.at('Duration').content
|
9
9
|
end
|
10
10
|
|
11
|
-
# VAST 3
|
12
|
-
def skipoffset
|
13
|
-
source_node[:skipoffset]
|
14
|
-
end
|
15
|
-
|
16
11
|
# URI to open as destination page when user clicks on the video
|
17
12
|
def click_through_url
|
18
|
-
URI.parse
|
13
|
+
URI.parse source_node.at('ClickThrough').content.strip
|
19
14
|
end
|
20
15
|
|
21
16
|
# An array of URIs to request for tracking purposes when user clicks on the video
|
22
17
|
def click_tracking_urls
|
23
18
|
source_node.xpath('.//ClickTracking').to_a.collect do |node|
|
24
|
-
URI.parse
|
19
|
+
URI.parse node.content.strip
|
25
20
|
end
|
26
21
|
end
|
27
22
|
|
@@ -32,7 +27,7 @@ module VAST
|
|
32
27
|
custom_click_urls = {}
|
33
28
|
source_node.xpath('.//CustomClick').to_a.collect do |node|
|
34
29
|
key = underscore(node[:id]).to_sym
|
35
|
-
custom_click_urls[key] = URI.parse(
|
30
|
+
custom_click_urls[key] = URI.parse(node.content.strip)
|
36
31
|
end
|
37
32
|
custom_click_urls
|
38
33
|
end
|
@@ -46,12 +41,5 @@ module VAST
|
|
46
41
|
Mediafile.new(node)
|
47
42
|
end
|
48
43
|
end
|
49
|
-
|
50
|
-
def icons
|
51
|
-
source_node.xpath('.//Icon').to_a.collect do |node|
|
52
|
-
Icon.new(node)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
44
|
end
|
57
|
-
end
|
45
|
+
end
|
data/lib/vast/mediafile.rb
CHANGED
@@ -5,7 +5,7 @@ module VAST
|
|
5
5
|
|
6
6
|
# Location of linear file
|
7
7
|
def url
|
8
|
-
URI.parse
|
8
|
+
URI.parse source_node.content.strip
|
9
9
|
end
|
10
10
|
|
11
11
|
def id
|
@@ -53,4 +53,4 @@ module VAST
|
|
53
53
|
source_node[:maintainAspectRatio]=="true"
|
54
54
|
end
|
55
55
|
end
|
56
|
-
end
|
56
|
+
end
|
@@ -34,11 +34,7 @@ module VAST
|
|
34
34
|
|
35
35
|
# URI to open as destination page when user clicks on creative
|
36
36
|
def click_through_url
|
37
|
-
URI.parse
|
38
|
-
end
|
39
|
-
|
40
|
-
def click_tracking_url
|
41
|
-
URI.parse URI.escape(source_node.at('NonLinearClickTracking').content.strip)
|
37
|
+
URI.parse source_node.at('NonLinearClickThrough').content.strip
|
42
38
|
end
|
43
39
|
|
44
40
|
# Whether it is acceptable to scale the mediafile.
|
@@ -80,9 +76,9 @@ module VAST
|
|
80
76
|
def resource_url
|
81
77
|
case resource_type
|
82
78
|
when :static
|
83
|
-
URI.parse
|
79
|
+
URI.parse source_node.at('StaticResource').content.strip
|
84
80
|
when :iframe
|
85
|
-
URI.parse
|
81
|
+
URI.parse source_node.at('IFrameResource').content.strip
|
86
82
|
end
|
87
83
|
end
|
88
84
|
|
@@ -94,4 +90,4 @@ module VAST
|
|
94
90
|
end
|
95
91
|
|
96
92
|
end
|
97
|
-
end
|
93
|
+
end
|
data/lib/vast/wrapper_ad.rb
CHANGED
data/lib/vast.rb
CHANGED
@@ -8,7 +8,6 @@ require 'vast/wrapper_ad'
|
|
8
8
|
require 'vast/creative'
|
9
9
|
require 'vast/linear_creative'
|
10
10
|
require 'vast/mediafile'
|
11
|
-
require 'vast/icon'
|
12
11
|
require 'vast/companion_creative'
|
13
12
|
require 'vast/non_linear_creative'
|
14
13
|
require 'vast/extension'
|
@@ -17,8 +16,7 @@ require 'vast/extension'
|
|
17
16
|
module VAST
|
18
17
|
VAST_VERSION = 2.0
|
19
18
|
VAST_SCHEMA_XSD_FILE = File.expand_path(File.join(File.dirname(__FILE__), 'vast_2.0.1.xsd'))
|
20
|
-
|
21
|
-
|
19
|
+
|
22
20
|
class VASTError < StandardError; end
|
23
21
|
|
24
22
|
# Raised when parsing a VAST document that does not conform to the VAST spec XSD
|
data/test/ad_test.rb
CHANGED
@@ -46,7 +46,7 @@ class AdTest < Test::Unit::TestCase
|
|
46
46
|
|
47
47
|
assert_equal "601364", ad.id
|
48
48
|
assert_equal "Acudeo Compatible", ad.ad_system
|
49
|
-
assert_equal URI.parse(
|
49
|
+
assert_equal URI.parse('http://myErrorURL/error'), ad.error_url
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_ad_should_know_linear_creatives
|
@@ -119,4 +119,4 @@ class AdTest < Test::Unit::TestCase
|
|
119
119
|
assert extension.kind_of?(VAST::Extension)
|
120
120
|
end
|
121
121
|
end
|
122
|
-
end
|
122
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sessionm-vast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70174552626880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.5.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70174552626880
|
25
25
|
description:
|
26
26
|
email:
|
27
27
|
- chrisgdinn@gmail.com
|
@@ -30,7 +30,6 @@ extensions: []
|
|
30
30
|
extra_rdoc_files: []
|
31
31
|
files:
|
32
32
|
- lib/vast.rb
|
33
|
-
- lib/vast3_draft.xsd
|
34
33
|
- lib/vast_2.0.1.xsd
|
35
34
|
- lib/vast/ad.rb
|
36
35
|
- lib/vast/companion_creative.rb
|
@@ -38,7 +37,6 @@ files:
|
|
38
37
|
- lib/vast/document.rb
|
39
38
|
- lib/vast/element.rb
|
40
39
|
- lib/vast/extension.rb
|
41
|
-
- lib/vast/icon.rb
|
42
40
|
- lib/vast/inline_ad.rb
|
43
41
|
- lib/vast/linear_creative.rb
|
44
42
|
- lib/vast/mediafile.rb
|
@@ -54,7 +52,6 @@ files:
|
|
54
52
|
- test/mediafile_test.rb
|
55
53
|
- test/non_linear_creative_test.rb
|
56
54
|
- test/test_helper.rb
|
57
|
-
- test/vast3_inline_ad_test.rb
|
58
55
|
- test/wrapper_ad_test.rb
|
59
56
|
- test/examples/document_with_no_ads.xml
|
60
57
|
- test/examples/document_with_one_inline_ad.xml
|
@@ -64,12 +61,8 @@ files:
|
|
64
61
|
- test/examples/invalid_document.xml
|
65
62
|
- test/examples/invalid_document_with_missing_ad_type.xml
|
66
63
|
- test/examples/invalid_document_with_missing_creative_type.xml
|
67
|
-
- test/examples/vast3_inline.xml
|
68
64
|
- LICENSE
|
69
65
|
- README.rdoc
|
70
|
-
- Gemfile
|
71
|
-
- Pathfile
|
72
|
-
- Rakefile
|
73
66
|
homepage: http://github.com/chrisdinn/vast
|
74
67
|
licenses: []
|
75
68
|
post_install_message:
|
data/Gemfile
DELETED
data/Pathfile
DELETED
data/Rakefile
DELETED
data/lib/vast/icon.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
module VAST
|
2
|
-
# Any number of Mediafile objects can be provided for a single Ad, but it is assumed that all Mediafiles belongs
|
3
|
-
# to a single Ad object represent the same creative unit with the same duration, Ad-ID (ISCI code), etc.
|
4
|
-
class Icon < Element
|
5
|
-
|
6
|
-
def program
|
7
|
-
source_node[:program]
|
8
|
-
end
|
9
|
-
|
10
|
-
def width
|
11
|
-
source_node[:width].to_i
|
12
|
-
end
|
13
|
-
|
14
|
-
def height
|
15
|
-
source_node[:height].to_i
|
16
|
-
end
|
17
|
-
|
18
|
-
def xPosition
|
19
|
-
source_node[:xPosition].to_i
|
20
|
-
end
|
21
|
-
|
22
|
-
def yPosition
|
23
|
-
source_node[:yPosition].to_i
|
24
|
-
end
|
25
|
-
|
26
|
-
def duration
|
27
|
-
source_node[:duration].to_i
|
28
|
-
end
|
29
|
-
|
30
|
-
def offset
|
31
|
-
source_node[:offset].to_i
|
32
|
-
end
|
33
|
-
|
34
|
-
# Defines the method to use for communication with the companion
|
35
|
-
def api_framework
|
36
|
-
source_node[:apiFramework]
|
37
|
-
end
|
38
|
-
|
39
|
-
def resource_type
|
40
|
-
if source_node.at('StaticResource')
|
41
|
-
:static
|
42
|
-
elsif source_node.at('IFrameResource')
|
43
|
-
:iframe
|
44
|
-
elsif source_node.at('HTMLResource')
|
45
|
-
:html
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Returns MIME type of static creative
|
50
|
-
def creative_type
|
51
|
-
if resource_type == :static
|
52
|
-
source_node.at('StaticResource')[:creativeType]
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# Returns URI for static or iframe resource
|
57
|
-
def resource_url
|
58
|
-
case resource_type
|
59
|
-
when :static
|
60
|
-
URI.parse URI.escape(source_node.at('StaticResource').content.strip)
|
61
|
-
when :iframe
|
62
|
-
URI.parse URI.escape(source_node.at('IFrameResource').content.strip)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Returns HTML text for html resource
|
67
|
-
def resource_html
|
68
|
-
if resource_type == :html
|
69
|
-
source_node.at('HTMLResource').content
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def click_through_url
|
74
|
-
URI.parse URI.escape(source_node.at('IconClickThrough').content.strip)
|
75
|
-
end
|
76
|
-
|
77
|
-
def click_tracking_url
|
78
|
-
URI.parse URI.escape(source_node.at('IconClickTracking').content.strip)
|
79
|
-
end
|
80
|
-
|
81
|
-
def view_tracking_url
|
82
|
-
URI.parse URI.escape(source_node.at('IconViewTracking').content.strip)
|
83
|
-
end
|
84
|
-
|
85
|
-
# end of class
|
86
|
-
end
|
87
|
-
end
|