vast 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +45 -0
- data/README.rdoc +43 -0
- data/lib/vast.rb +22 -0
- data/lib/vast/ad.rb +78 -0
- data/lib/vast/creative.rb +59 -0
- data/lib/vast/document.rb +40 -0
- data/lib/vast/inline_ad.rb +15 -0
- data/lib/vast/linear_creative.rb +39 -0
- data/lib/vast/mediafile.rb +54 -0
- data/lib/vast_2.0.1.xsd +643 -0
- data/test/ad_test.rb +103 -0
- data/test/creative_test.rb +35 -0
- data/test/document_test.rb +72 -0
- data/test/examples/document_with_no_ads.xml +3 -0
- data/test/examples/document_with_one_inline_ad.xml +80 -0
- data/test/examples/document_with_one_inline_and_one_wrapper_ad.xml +89 -0
- data/test/examples/document_with_one_wrapper_ad.xml +38 -0
- data/test/examples/document_with_two_inline_ads.xml +111 -0
- data/test/examples/invalid_document.xml +3 -0
- data/test/examples/invalid_document_with_missing_ad_type.xml +58 -0
- data/test/examples/invalid_document_with_missing_creative_type.xml +39 -0
- data/test/inline_ad_test.rb +14 -0
- data/test/linear_creative_test.rb +26 -0
- data/test/mediafile_test.rb +19 -0
- data/test/test_helper.rb +13 -0
- metadata +100 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
<!-- Invalid VAST document with ad type commented out -->
|
2
|
+
<VAST version="2.0">
|
3
|
+
|
4
|
+
<Ad id="601364">
|
5
|
+
<!-- <InLine> -->
|
6
|
+
<AdSystem>Acudeo Compatible</AdSystem>
|
7
|
+
<AdTitle>VAST 2.0 Instream Test 1</AdTitle>
|
8
|
+
<Description>VAST 2.0 Instream Test 1</Description>
|
9
|
+
<Error>http://myErrorURL/error</Error>
|
10
|
+
|
11
|
+
<Impression>http://myTrackingURL/impression</Impression>
|
12
|
+
<Creatives>
|
13
|
+
<Creative AdID="601364">
|
14
|
+
<Linear>
|
15
|
+
<Duration>00:00:30</Duration>
|
16
|
+
<TrackingEvents>
|
17
|
+
<Tracking event="creativeView">http://myTrackingURL/creativeView</Tracking>
|
18
|
+
|
19
|
+
<Tracking event="start">http://myTrackingURL/start</Tracking>
|
20
|
+
<Tracking event="midpoint">http://myTrackingURL/midpoint</Tracking>
|
21
|
+
<Tracking event="firstQuartile">http://myTrackingURL/firstQuartile</Tracking>
|
22
|
+
<Tracking event="thirdQuartile">http://myTrackingURL/thirdQuartile</Tracking>
|
23
|
+
<Tracking event="complete">http://myTrackingURL/complete</Tracking>
|
24
|
+
</TrackingEvents>
|
25
|
+
|
26
|
+
<VideoClicks>
|
27
|
+
<ClickThrough>http://www.tremormedia.com</ClickThrough>
|
28
|
+
<ClickTracking>http://myTrackingURL/click</ClickTracking>
|
29
|
+
</VideoClicks>
|
30
|
+
<MediaFiles>
|
31
|
+
<MediaFile delivery="progressive" type="video/x-flv" bitrate="500" width="400" height="300" scalable="true" maintainAspectRatio="true">http://cdnp.tremormedia.com/video/acudeo/Carrot_400x300_500kb.flv</MediaFile>
|
32
|
+
</MediaFiles>
|
33
|
+
|
34
|
+
</Linear>
|
35
|
+
</Creative>
|
36
|
+
<Creative AdID="601364-Companion">
|
37
|
+
<CompanionAds>
|
38
|
+
<Companion width="300" height="250">
|
39
|
+
<StaticResource creativeType="image/jpeg">http://demo.tremormedia.com/proddev/vast/Blistex1.jpg</StaticResource>
|
40
|
+
<TrackingEvents>
|
41
|
+
<Tracking event="creativeView">http://myTrackingURL/firstCompanionCreativeView</Tracking>
|
42
|
+
|
43
|
+
</TrackingEvents>
|
44
|
+
|
45
|
+
<CompanionClickThrough>http://www.tremormedia.com</CompanionClickThrough>
|
46
|
+
</Companion>
|
47
|
+
<Companion width="728" height="90">
|
48
|
+
<StaticResource creativeType="image/jpeg">http://demo.tremormedia.com/proddev/vast/728x90_banner1.jpg</StaticResource>
|
49
|
+
<CompanionClickThrough>http://www.tremormedia.com</CompanionClickThrough>
|
50
|
+
</Companion>
|
51
|
+
|
52
|
+
</CompanionAds>
|
53
|
+
</Creative>
|
54
|
+
</Creatives>
|
55
|
+
<!-- </InLine> -->
|
56
|
+
</Ad>
|
57
|
+
|
58
|
+
</VAST>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Invalid VAST document with missing ad creative-->
|
2
|
+
<VAST version="2.0">
|
3
|
+
|
4
|
+
<Ad id="601364">
|
5
|
+
<InLine>
|
6
|
+
<AdSystem>Acudeo Compatible</AdSystem>
|
7
|
+
<AdTitle>VAST 2.0 Instream Test 1</AdTitle>
|
8
|
+
<Description>VAST 2.0 Instream Test 1</Description>
|
9
|
+
<Error>http://myErrorURL/error</Error>
|
10
|
+
|
11
|
+
<Impression>http://myTrackingURL/impression</Impression>
|
12
|
+
<Creatives>
|
13
|
+
<Creative AdID="601364">
|
14
|
+
<!-- <Linear> -->
|
15
|
+
<Duration>00:00:30</Duration>
|
16
|
+
<TrackingEvents>
|
17
|
+
<Tracking event="creativeView">http://myTrackingURL/creativeView</Tracking>
|
18
|
+
|
19
|
+
<Tracking event="start">http://myTrackingURL/start</Tracking>
|
20
|
+
<Tracking event="midpoint">http://myTrackingURL/midpoint</Tracking>
|
21
|
+
<Tracking event="firstQuartile">http://myTrackingURL/firstQuartile</Tracking>
|
22
|
+
<Tracking event="thirdQuartile">http://myTrackingURL/thirdQuartile</Tracking>
|
23
|
+
<Tracking event="complete">http://myTrackingURL/complete</Tracking>
|
24
|
+
</TrackingEvents>
|
25
|
+
|
26
|
+
<VideoClicks>
|
27
|
+
<ClickThrough>http://www.tremormedia.com</ClickThrough>
|
28
|
+
<ClickTracking>http://myTrackingURL/click</ClickTracking>
|
29
|
+
</VideoClicks>
|
30
|
+
<MediaFiles>
|
31
|
+
<MediaFile delivery="progressive" type="video/x-flv" bitrate="500" width="400" height="300" scalable="true" maintainAspectRatio="true">http://cdnp.tremormedia.com/video/acudeo/Carrot_400x300_500kb.flv</MediaFile>
|
32
|
+
</MediaFiles>
|
33
|
+
<!-- </Linear> -->
|
34
|
+
</Creative>
|
35
|
+
</Creatives>
|
36
|
+
</InLine>
|
37
|
+
</Ad>
|
38
|
+
|
39
|
+
</VAST>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class InlineAdTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_ad_should_know_attributes
|
6
|
+
document_file = example_file('document_with_one_inline_ad.xml')
|
7
|
+
document = VAST::Document.parse!(document_file)
|
8
|
+
inline_ad = document.inline_ads.first
|
9
|
+
|
10
|
+
assert_equal "http://mySurveyURL/survey", inline_ad.survey_url.to_s
|
11
|
+
assert_equal "VAST 2.0 Instream Test 1", inline_ad.ad_title
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class LinearCreativeTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_should_know_attributes
|
6
|
+
document_file = example_file('document_with_one_inline_ad.xml')
|
7
|
+
document = VAST::Document.parse!(document_file)
|
8
|
+
creative = document.inline_ads.first.linear_creatives.first
|
9
|
+
|
10
|
+
assert_equal "00:00:30", creative.duration
|
11
|
+
assert_equal "http://www.tremormedia.com", creative.click_through_url.to_s
|
12
|
+
assert_equal "http://myTrackingURL/click1", creative.click_tracking_urls.first.to_s
|
13
|
+
assert_equal "http://myTrackingURL/click2", creative.click_tracking_urls.last.to_s
|
14
|
+
assert_equal "http://myTrackingURL/custom1", creative.custom_click_urls[:custom_one].to_s
|
15
|
+
assert_equal "http://myTrackingURL/custom2", creative.custom_click_urls[:custom_two].to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_have_mediafiles
|
19
|
+
document_file = example_file('document_with_one_inline_ad.xml')
|
20
|
+
document = VAST::Document.parse!(document_file)
|
21
|
+
creative = document.inline_ads.first.linear_creatives.first
|
22
|
+
|
23
|
+
assert creative.mediafiles.first.kind_of?(VAST::Mediafile)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MediafileTest < Test::Unit::TestCase
|
4
|
+
def test_should_know_attributes
|
5
|
+
document_file = example_file('document_with_one_inline_ad.xml')
|
6
|
+
document = VAST::Document.parse!(document_file)
|
7
|
+
mediafile = VAST::Mediafile.new(document.at('MediaFile'))
|
8
|
+
|
9
|
+
assert_equal "http://cdnp.tremormedia.com/video/acudeo/Carrot_400x300_500kb.flv", mediafile.url.to_s
|
10
|
+
assert_equal "firstFile", mediafile.id
|
11
|
+
assert_equal "progressive", mediafile.delivery
|
12
|
+
assert_equal "video/x-flv", mediafile.type
|
13
|
+
assert_equal 400, mediafile.width
|
14
|
+
assert_equal 300, mediafile.height
|
15
|
+
assert_equal 500, mediafile.bitrate
|
16
|
+
assert mediafile.scalable?
|
17
|
+
assert mediafile.maintain_aspect_ratio?
|
18
|
+
end
|
19
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
Bundler.setup(:default, :test)
|
6
|
+
Bundler.require(:default, :test)
|
7
|
+
|
8
|
+
require 'vast'
|
9
|
+
|
10
|
+
def example_file(filename)
|
11
|
+
file_path = File.expand_path(File.join(File.dirname(__FILE__), 'examples', filename))
|
12
|
+
File.read file_path
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vast
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
version: "0.1"
|
9
|
+
platform: ruby
|
10
|
+
authors:
|
11
|
+
- Chris Dinn
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
|
16
|
+
date: 2010-08-23 00:00:00 -04:00
|
17
|
+
default_executable:
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: nokogiri
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
segments:
|
27
|
+
- 1
|
28
|
+
- 4
|
29
|
+
- 3
|
30
|
+
version: 1.4.3
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description:
|
34
|
+
email:
|
35
|
+
- chrisgdinn@gmail.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- lib/vast.rb
|
44
|
+
- lib/vast_2.0.1.xsd
|
45
|
+
- lib/vast/ad.rb
|
46
|
+
- lib/vast/creative.rb
|
47
|
+
- lib/vast/document.rb
|
48
|
+
- lib/vast/inline_ad.rb
|
49
|
+
- lib/vast/linear_creative.rb
|
50
|
+
- lib/vast/mediafile.rb
|
51
|
+
- test/ad_test.rb
|
52
|
+
- test/creative_test.rb
|
53
|
+
- test/document_test.rb
|
54
|
+
- test/inline_ad_test.rb
|
55
|
+
- test/linear_creative_test.rb
|
56
|
+
- test/mediafile_test.rb
|
57
|
+
- test/test_helper.rb
|
58
|
+
- test/examples/document_with_no_ads.xml
|
59
|
+
- test/examples/document_with_one_inline_ad.xml
|
60
|
+
- test/examples/document_with_one_inline_and_one_wrapper_ad.xml
|
61
|
+
- test/examples/document_with_one_wrapper_ad.xml
|
62
|
+
- test/examples/document_with_two_inline_ads.xml
|
63
|
+
- test/examples/invalid_document.xml
|
64
|
+
- test/examples/invalid_document_with_missing_ad_type.xml
|
65
|
+
- test/examples/invalid_document_with_missing_creative_type.xml
|
66
|
+
- LICENSE
|
67
|
+
- README.md
|
68
|
+
- README.rdoc
|
69
|
+
has_rdoc: true
|
70
|
+
homepage: http://github.com/chrisdinn/vast
|
71
|
+
licenses: []
|
72
|
+
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
requirements: []
|
93
|
+
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 1.3.6
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: A gem for working with VAST 2.0 documents
|
99
|
+
test_files: []
|
100
|
+
|