episodic-platform 0.9
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/History.txt +4 -0
- data/Manifest.txt +35 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +86 -0
- data/Rakefile +45 -0
- data/lib/episodic/platform.rb +82 -0
- data/lib/episodic/platform/analytics_methods.rb +190 -0
- data/lib/episodic/platform/base.rb +64 -0
- data/lib/episodic/platform/collection_response.rb +45 -0
- data/lib/episodic/platform/connection.rb +305 -0
- data/lib/episodic/platform/exceptions.rb +105 -0
- data/lib/episodic/platform/query_methods.rb +721 -0
- data/lib/episodic/platform/response.rb +94 -0
- data/lib/episodic/platform/write_methods.rb +446 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/fixtures/1-0.mp4 +0 -0
- data/test/fixtures/create-episode-response-s3.xml +15 -0
- data/test/fixtures/create-episode-response.xml +3 -0
- data/test/fixtures/episodes-response.xml +408 -0
- data/test/fixtures/episodes-summary-report-response.xml +4 -0
- data/test/fixtures/invalid-param-response-multiple.xml +8 -0
- data/test/fixtures/invalid-param-response-single.xml +9 -0
- data/test/fixtures/playlists-response.xml +611 -0
- data/test/fixtures/shows-response.xml +26 -0
- data/test/test_analytics_requests.rb +42 -0
- data/test/test_analytics_responses.rb +14 -0
- data/test/test_connection.rb +31 -0
- data/test/test_error_responses.rb +29 -0
- data/test/test_helper.rb +8 -0
- data/test/test_query_requests.rb +62 -0
- data/test/test_query_responses.rb +165 -0
- data/test/test_write_requests.rb +56 -0
- data/test/test_write_responses.rb +24 -0
- metadata +135 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<shows per_page="20" page="1" pages="1" total="2">
|
3
|
+
<show>
|
4
|
+
<id>89675</id>
|
5
|
+
<name>My show</name>
|
6
|
+
<description>My description</description>
|
7
|
+
<page_url></page_url>
|
8
|
+
<itunes_url></itunes_url>
|
9
|
+
<thumbnails>
|
10
|
+
</thumbnails>
|
11
|
+
<players width="640" height="360">
|
12
|
+
<player default="true" width="640" height="391">
|
13
|
+
<name>Default Player</name>
|
14
|
+
<embed_code><object id="ep_player" name="ep_player" height="391" width="640" data="http://cdn.episodic.com/player_development/EpisodicPlayer.swf?config=http%3A%2F%2Flocalhost%2Fcdn%2Fdevelopment%2Frandysimon%2F5%2Flatest%2Fconfig.xml" type="application/x-shockwave-flash"><param name="movie" value="http://cdn.episodic.com/player_development/EpisodicPlayer.swf?config=http%3A%2F%2Flocalhost%2Fcdn%2Fdevelopment%2Frandysimon%2F5%2Flatest%2Fconfig.xml"/><param name="AllowScriptAccess" value="always"/><param name="allowfullscreen" value="true"/><embed src="http://cdn.episodic.com/player_development/EpisodicPlayer.swf?config=http%3A%2F%2Flocalhost%2Fcdn%2Fdevelopment%2Frandysimon%2F5%2Flatest%2Fconfig.xml" type="application/x-shockwave-flash" allowfullscreen="true" AllowScriptAccess="always" width="640" height="391" id="ep_player" name="ep_player"/></object></embed_code>
|
15
|
+
<config>http://localhost/cdn/development/randysimon/5/latest/config.xml</config>
|
16
|
+
</player>
|
17
|
+
</players>
|
18
|
+
</show>
|
19
|
+
<show>
|
20
|
+
<id>adfadsfasdf</id>
|
21
|
+
<error>
|
22
|
+
<code>6</code>
|
23
|
+
<message>Show not found</message>
|
24
|
+
</error>
|
25
|
+
</show>
|
26
|
+
</shows>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestQueryRequests < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def setup
|
6
|
+
::Episodic::Platform::Base.establish_connection!(TEST_API_KEY, TEST_SECRET_KEY, :api_host => TEST_HOST)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_episodes_summary_report
|
10
|
+
response = ::Episodic::Platform::AnalyticsMethods.episodes_summary_report("5", "last_thirty", "daily", "csv")
|
11
|
+
|
12
|
+
assert response.token
|
13
|
+
|
14
|
+
report = ::Episodic::Platform::AnalyticsMethods.get_report(response.token)
|
15
|
+
|
16
|
+
puts report
|
17
|
+
assert report
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_episode_daily_report
|
21
|
+
response = ::Episodic::Platform::AnalyticsMethods.episode_daily_report("5", "ozv6spajltkx", "last_thirty", "csv")
|
22
|
+
|
23
|
+
assert response.token
|
24
|
+
|
25
|
+
report = ::Episodic::Platform::AnalyticsMethods.get_report(response.token)
|
26
|
+
|
27
|
+
puts report
|
28
|
+
assert report
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_campaigns_daily_report
|
32
|
+
response = ::Episodic::Platform::AnalyticsMethods.campaigns_daily_report("5", "last_thirty", "csv")
|
33
|
+
|
34
|
+
assert response.token
|
35
|
+
|
36
|
+
report = ::Episodic::Platform::AnalyticsMethods.get_report(response.token)
|
37
|
+
|
38
|
+
puts report
|
39
|
+
assert report
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestQueryResponses < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def test_episodes_response
|
6
|
+
response_xml = File.open(File.dirname(__FILE__) + "/fixtures/episodes-summary-report-response.xml") {|f|f.read}
|
7
|
+
|
8
|
+
response = ::Episodic::Platform::AnalyticsMethods.send(:parse_token_response, Episodic::Platform::HTTPResponse.new(200, response_xml))
|
9
|
+
|
10
|
+
assert response.token
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestConnection < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def test_convert_params_for_request
|
6
|
+
|
7
|
+
now = Time.now
|
8
|
+
|
9
|
+
params = {
|
10
|
+
"foo" => "bar",
|
11
|
+
"date" => now,
|
12
|
+
"hash_value" => { "text_value" => "my_value", "external_field" => { 123 => "happy", 576 => "sad"}, "date_value" => now },
|
13
|
+
"array_value" => ["234", "678", "789"],
|
14
|
+
"nil_value" => nil,
|
15
|
+
"boolean_value" => true
|
16
|
+
}
|
17
|
+
|
18
|
+
connection = Episodic::Platform::Connection.new(nil, nil, nil)
|
19
|
+
result = connection.send(:convert_params_for_request, params)
|
20
|
+
|
21
|
+
assert_equal "bar", result["foo"]
|
22
|
+
assert_equal now.to_i.to_s, result["date"]
|
23
|
+
assert_equal "my_value", result["hash_value[text_value]"]
|
24
|
+
assert_equal "123|happy;576|sad;", result["hash_value[external_field]"]
|
25
|
+
assert_equal now.to_i.to_s, result["hash_value[date_value]"]
|
26
|
+
assert_equal "234,678,789", result["array_value"]
|
27
|
+
assert_equal "", result["nil_value"]
|
28
|
+
assert_equal "true", result["boolean_value"]
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestErrorResponses < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def test_invalid_param_single_response
|
6
|
+
response_xml = File.open(File.dirname(__FILE__) + "/fixtures/invalid-param-response-single.xml") {|f|f.read}
|
7
|
+
|
8
|
+
begin
|
9
|
+
::Episodic::Platform::Response.new(Episodic::Platform::HTTPResponse.new(200, response_xml))
|
10
|
+
|
11
|
+
assert false, "Expected exception to be thrown"
|
12
|
+
rescue Episodic::Platform::InvalidParameters => e
|
13
|
+
assert e.message.include?("extensible_metadata_field_values_date_value")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_invalid_param_multiple_response
|
18
|
+
response_xml = File.open(File.dirname(__FILE__) + "/fixtures/invalid-param-response-multiple.xml") {|f|f.read}
|
19
|
+
|
20
|
+
begin
|
21
|
+
::Episodic::Platform::Response.new(Episodic::Platform::HTTPResponse.new(200, response_xml))
|
22
|
+
|
23
|
+
assert false, "Expected exception to be thrown"
|
24
|
+
rescue Episodic::Platform::InvalidParameters => e
|
25
|
+
assert e.message.include?("extensible_metadata_field_values_date_value")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestQueryRequests < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def setup
|
6
|
+
::Episodic::Platform::Base.establish_connection!(TEST_API_KEY, TEST_SECRET_KEY, :api_host => TEST_HOST)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_episodes
|
10
|
+
episode_response = ::Episodic::Platform::QueryMethods.episodes()
|
11
|
+
|
12
|
+
assert episode_response.total > 0
|
13
|
+
assert_equal 1, episode_response.page
|
14
|
+
assert_equal episode_response.total, episode_response.episodes.length
|
15
|
+
|
16
|
+
episodes = episode_response.episodes
|
17
|
+
assert episodes.first.thumbnails
|
18
|
+
assert episodes.first.players
|
19
|
+
assert episodes.first.downloads
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_playlists
|
23
|
+
response = ::Episodic::Platform::QueryMethods.playlists()
|
24
|
+
|
25
|
+
puts response.xml
|
26
|
+
|
27
|
+
assert response.total > 0
|
28
|
+
assert_equal 1, response.page
|
29
|
+
assert_equal response.total, response.playlists.length
|
30
|
+
|
31
|
+
playlists = response.playlists
|
32
|
+
assert playlists.first.thumbnails
|
33
|
+
assert playlists.first.players
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_shows
|
37
|
+
response = ::Episodic::Platform::QueryMethods.shows({:id => ["5", "adfadsfasdf"]})
|
38
|
+
|
39
|
+
puts response.xml
|
40
|
+
|
41
|
+
assert response.total > 0
|
42
|
+
assert_equal 1, response.page
|
43
|
+
assert_equal response.total, response.shows.length
|
44
|
+
|
45
|
+
shows = response.shows
|
46
|
+
assert shows.first.thumbnails
|
47
|
+
assert shows.first.players
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_modification_Callbacks
|
51
|
+
response = ::Episodic::Platform::QueryMethods.modification_callbacks(Time.now)
|
52
|
+
|
53
|
+
assert response
|
54
|
+
puts response
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_auth_failure
|
58
|
+
::Episodic::Platform::Base.establish_connection!("5bb6a3a17bb247yd13a716d8fc17153c", "fe18740f831e5edcdbe0209105e67dc7", :api_host => "localhost:3000")
|
59
|
+
|
60
|
+
assert_raise(Episodic::Platform::InvalidAPIKey) {::Episodic::Platform::QueryMethods.episodes()}
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestQueryResponses < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def test_episodes_response
|
6
|
+
response_xml = File.open(File.dirname(__FILE__) + "/fixtures/episodes-response.xml") {|f|f.read}
|
7
|
+
|
8
|
+
episodes_response = ::Episodic::Platform::QueryMethods.send(:parse_episodes_response, Episodic::Platform::HTTPResponse.new(200, response_xml))
|
9
|
+
|
10
|
+
assert_equal 14, episodes_response.total
|
11
|
+
assert_equal 20, episodes_response.per_page
|
12
|
+
assert_equal 1, episodes_response.page
|
13
|
+
assert_equal 1, episodes_response.pages
|
14
|
+
|
15
|
+
# Now look at the details of one of the episodes
|
16
|
+
episode = episodes_response.episodes.detect {|e| e.id == "oo3kyjwjzcap"}
|
17
|
+
assert episode
|
18
|
+
|
19
|
+
# Verify some properties
|
20
|
+
assert_equal "Episode 2", episode.name
|
21
|
+
assert_equal nil, episode.description
|
22
|
+
assert_equal Time.utc(2010,"jan",6,2,13,12), episode.air_date
|
23
|
+
assert_equal nil, episode.off_air_date
|
24
|
+
assert_equal "00:00:28", episode.duration
|
25
|
+
assert_equal "on_the_air", episode.status
|
26
|
+
|
27
|
+
custom_fields = episode.custom_fields
|
28
|
+
assert_equal 4, custom_fields.length
|
29
|
+
|
30
|
+
first_field = custom_fields.detect{|f| f.position == 1}
|
31
|
+
assert first_field
|
32
|
+
assert_equal "text", first_field.type
|
33
|
+
assert_equal false, first_field.required
|
34
|
+
assert_equal "Series Name", first_field.name
|
35
|
+
assert_equal 1, first_field.values.length
|
36
|
+
assert_equal "Game Trailers", first_field.values.first
|
37
|
+
|
38
|
+
second_field = custom_fields.detect{|f| f.position == 2}
|
39
|
+
assert second_field
|
40
|
+
assert_equal "number", second_field.type
|
41
|
+
assert_equal true, second_field.required
|
42
|
+
assert_equal "Number Field", second_field.name
|
43
|
+
assert_equal 1, second_field.values.length
|
44
|
+
assert_equal "567", second_field.values.first
|
45
|
+
|
46
|
+
third_field = custom_fields.detect{|f| f.position == 3}
|
47
|
+
assert third_field
|
48
|
+
assert_equal "date", third_field.type
|
49
|
+
assert_equal false, third_field.required
|
50
|
+
assert_equal "Publish Date", third_field.name
|
51
|
+
assert_equal 1, third_field.values.length
|
52
|
+
assert_equal "2010-01-29 18:51:00", third_field.values.first
|
53
|
+
|
54
|
+
forth_field = custom_fields.detect{|f| f.position == 4}
|
55
|
+
assert forth_field
|
56
|
+
assert_equal "external_select", forth_field.type
|
57
|
+
assert_equal false, forth_field.required
|
58
|
+
assert_equal "Category", forth_field.name
|
59
|
+
assert_equal 2, forth_field.values.length
|
60
|
+
assert_equal ["123", "Drama"], forth_field.values.first
|
61
|
+
|
62
|
+
assert_equal 1, episode.playlists.length
|
63
|
+
assert_equal "oo3my8ozcnb5", episode.playlists.first.id
|
64
|
+
assert_equal 1, episode.playlists.first.position
|
65
|
+
|
66
|
+
assert_equal 3, episode.thumbnails.length
|
67
|
+
assert_equal "http://localhost/cdn/development/randysimon/assets/207/a38.jpg", episode.thumbnails.first.url
|
68
|
+
|
69
|
+
assert_equal 1, episode.players.length
|
70
|
+
assert_equal "Default Player", episode.players.first.name
|
71
|
+
assert_equal true, episode.players.first.default
|
72
|
+
assert_equal "http://localhost/cdn/development/randysimon/5/oo3kyjwjzcap/config.xml", episode.players.first.config
|
73
|
+
assert episode.players.first.embed_code
|
74
|
+
|
75
|
+
assert_equal 1, episode.downloads.length
|
76
|
+
assert_equal "http://localhost/cdn/development/randysimon/assets/480/a38.mp4", episode.downloads.first.url
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_playlists_response
|
80
|
+
response_xml = File.open(File.dirname(__FILE__) + "/fixtures/playlists-response.xml") {|f|f.read}
|
81
|
+
|
82
|
+
response = ::Episodic::Platform::QueryMethods.send(:parse_playlists_response, Episodic::Platform::HTTPResponse.new(200, response_xml))
|
83
|
+
|
84
|
+
assert_equal 17, response.total
|
85
|
+
assert_equal 20, response.per_page
|
86
|
+
assert_equal 1, response.page
|
87
|
+
assert_equal 1, response.pages
|
88
|
+
|
89
|
+
# Now look at the details of one of the episodes
|
90
|
+
playlist = response.playlists.detect {|p| p.id == "ootudbh0gdfl"}
|
91
|
+
assert playlist
|
92
|
+
|
93
|
+
# Verify some properties
|
94
|
+
assert_equal "test1", playlist.name
|
95
|
+
assert_equal nil, playlist.description
|
96
|
+
assert_equal Time.utc(2010,"jan",7,21,20,37), playlist.created_at
|
97
|
+
|
98
|
+
custom_fields = playlist.custom_fields
|
99
|
+
assert_equal 3, custom_fields.length
|
100
|
+
|
101
|
+
first_field = custom_fields.detect{|f| f.position == 1}
|
102
|
+
assert first_field
|
103
|
+
assert_equal "text", first_field.type
|
104
|
+
assert_equal false, first_field.required
|
105
|
+
assert_equal "text field", first_field.name
|
106
|
+
assert_equal 0, first_field.values.length
|
107
|
+
|
108
|
+
second_field = custom_fields.detect{|f| f.position == 2}
|
109
|
+
assert second_field
|
110
|
+
assert_equal "date", second_field.type
|
111
|
+
assert_equal false, second_field.required
|
112
|
+
assert_equal "date field", second_field.name
|
113
|
+
assert_equal 1, second_field.values.length
|
114
|
+
assert_equal "2010-02-11 22:42:00", second_field.values.first
|
115
|
+
|
116
|
+
third_field = custom_fields.detect{|f| f.position == 3}
|
117
|
+
assert third_field
|
118
|
+
assert_equal "external_select", third_field.type
|
119
|
+
assert_equal false, third_field.required
|
120
|
+
assert_equal "External Select Field", third_field.name
|
121
|
+
assert_equal 0, third_field.values.length
|
122
|
+
|
123
|
+
assert_equal 7, playlist.episodes.length
|
124
|
+
assert_equal "oz049unr3jep", playlist.episodes.first.id
|
125
|
+
assert_equal 1, playlist.episodes.first.position
|
126
|
+
|
127
|
+
assert_equal 0, playlist.thumbnails.length
|
128
|
+
|
129
|
+
assert_equal 1, playlist.players.length
|
130
|
+
assert_equal "Default Player", playlist.players.first.name
|
131
|
+
assert_equal true, playlist.players.first.default
|
132
|
+
assert_equal "http://localhost/cdn/development/randysimon/6/playlists/ootudbh0gdfl/playlist.xml", playlist.players.first.config
|
133
|
+
assert playlist.players.first.embed_code
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_shows_response
|
137
|
+
response_xml = File.open(File.dirname(__FILE__) + "/fixtures/shows-response.xml") {|f|f.read}
|
138
|
+
|
139
|
+
response = ::Episodic::Platform::QueryMethods.send(:parse_shows_response, Episodic::Platform::HTTPResponse.new(200, response_xml))
|
140
|
+
|
141
|
+
assert_equal 2, response.total
|
142
|
+
assert_equal 20, response.per_page
|
143
|
+
assert_equal 1, response.page
|
144
|
+
assert_equal 1, response.pages
|
145
|
+
|
146
|
+
# Try to get the show that we could not find
|
147
|
+
show = response.shows.detect {|s| s.id == "adfadsfasdf"}
|
148
|
+
assert show
|
149
|
+
assert !show.exists?
|
150
|
+
|
151
|
+
# Now look at the details of one of the shows
|
152
|
+
show = response.shows.detect {|s| s.id == "89675"}
|
153
|
+
assert show
|
154
|
+
assert show.exists?
|
155
|
+
|
156
|
+
assert_equal "My show", show.name
|
157
|
+
assert_equal "My description", show.description
|
158
|
+
|
159
|
+
assert_equal 1, show.players.length
|
160
|
+
assert_equal "Default Player", show.players.first.name
|
161
|
+
assert_equal true, show.players.first.default
|
162
|
+
assert_equal "http://localhost/cdn/development/randysimon/5/latest/config.xml", show.players.first.config
|
163
|
+
assert show.players.first.embed_code
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestWriteRequests < Test::Unit::TestCase #:nodoc:
|
4
|
+
|
5
|
+
def setup
|
6
|
+
::Episodic::Platform::Base.establish_connection!(TEST_API_KEY, TEST_SECRET_KEY, :api_host => TEST_HOST)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_create_playlist
|
10
|
+
custom_fields = {
|
11
|
+
"text field" => "foo",
|
12
|
+
"date field" => Time.now,
|
13
|
+
"External Select Field" => {
|
14
|
+
"id1" => "val1",
|
15
|
+
"id2" => "val2"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
response = ::Episodic::Platform::WriteMethods.create_playlist("p7kpeeqkh2pt", "My Manual Playlist #{Time.now.to_i}", {"episode_ids" => ["ozv6spajltkx", "oz049unr3jep"], "custom_fields" => custom_fields})
|
19
|
+
|
20
|
+
assert response.playlist_id
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_update_playlist
|
25
|
+
custom_fields = {
|
26
|
+
"text field" => "bar"
|
27
|
+
}
|
28
|
+
response = ::Episodic::Platform::WriteMethods.update_playlist("p32khwxhm6m9", {"name" => "My Manual Playlist #{Time.now.to_i}", "episode_ids" => ["ozv6spajltkx"], "custom_fields" => custom_fields, "replace_episodes" => true})
|
29
|
+
|
30
|
+
assert response.playlist_id
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_create_asset
|
35
|
+
response = ::Episodic::Platform::WriteMethods.create_asset("5", "My New Asset #{Time.now.to_i}", File.dirname(__FILE__) + "/fixtures/1-0.mp4")
|
36
|
+
|
37
|
+
assert response.asset_id
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_create_update_episode
|
41
|
+
|
42
|
+
# Use the API test account for this test
|
43
|
+
Episodic::Platform::Base.establish_connection!(TEST_API_KEY, TEST_SECRET_KEY, :api_host => TEST_HOST)
|
44
|
+
|
45
|
+
response = ::Episodic::Platform::WriteMethods.create_episode("p7kpeeqkh2pt", "My Episode #{Time.now}", {:upload_types => "s3", :video_filename => "1-0.mp4", :thumbnail_filename => "thumb.png"})
|
46
|
+
|
47
|
+
episode_id = response.episode_id
|
48
|
+
assert episode_id
|
49
|
+
assert ::Episodic::Platform::WriteMethods.upload_file_for_episode(response.upload_for_filepath(File.dirname(__FILE__) + "/fixtures/1-0.mp4"))
|
50
|
+
assert ::Episodic::Platform::WriteMethods.upload_file_for_episode(response.upload_for_filepath(File.dirname(__FILE__) + "/fixtures/thumb.png"))
|
51
|
+
|
52
|
+
# Now update the video on the episode
|
53
|
+
response = ::Episodic::Platform::WriteMethods.update_episode(episode_id, {:upload_types => "s3", :video_filename => "3-0.m4v", :off_air_date => Time.now.to_i})
|
54
|
+
assert ::Episodic::Platform::WriteMethods.upload_file_for_episode(response.upload_for_filepath(File.dirname(__FILE__) + "/fixtures/3-0.m4v"))
|
55
|
+
end
|
56
|
+
end
|