telestream_cloud 1.1.0 → 2.0.0.1
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +16 -354
- data/flip/.gitignore +39 -0
- data/flip/.rspec +2 -0
- data/flip/.swagger-codegen-ignore +23 -0
- data/flip/.swagger-codegen/VERSION +1 -0
- data/flip/Gemfile +7 -0
- data/flip/README.md +130 -0
- data/flip/Rakefile +8 -0
- data/flip/docs/CanceledResponse.md +8 -0
- data/flip/docs/CloudNotificationSettings.md +11 -0
- data/flip/docs/CloudNotificationSettingsEvents.md +11 -0
- data/flip/docs/CopyProfileBody.md +9 -0
- data/flip/docs/CountResponse.md +8 -0
- data/flip/docs/CreateEncodingBody.md +10 -0
- data/flip/docs/CreateVideoBody.md +12 -0
- data/flip/docs/DeletedResponse.md +8 -0
- data/flip/docs/Encoding.md +38 -0
- data/flip/docs/EncodingSignedUrl.md +8 -0
- data/flip/docs/EncodingSignedUrls.md +8 -0
- data/flip/docs/Error.md +9 -0
- data/flip/docs/ExtraFile.md +10 -0
- data/flip/docs/Factory.md +25 -0
- data/flip/docs/FactoryBody.md +23 -0
- data/flip/docs/FactoryBodyStorageCredentialAttributes.md +11 -0
- data/flip/docs/FactorySync.md +8 -0
- data/flip/docs/FactorySyncBody.md +8 -0
- data/flip/docs/FlipApi.md +2179 -0
- data/flip/docs/PaginatedEncodingsCollection.md +11 -0
- data/flip/docs/PaginatedFactoryCollection.md +11 -0
- data/flip/docs/PaginatedProfilesCollection.md +11 -0
- data/flip/docs/PaginatedVideoCollection.md +11 -0
- data/flip/docs/PaginatedWorkflowsCollection.md +11 -0
- data/flip/docs/Profile.md +135 -0
- data/flip/docs/ProfileBody.md +137 -0
- data/flip/docs/ResubmitVideoBody.md +8 -0
- data/flip/docs/RetriedResponse.md +8 -0
- data/flip/docs/SignedVideoUrl.md +8 -0
- data/flip/docs/UpdateEncodingBody.md +9 -0
- data/flip/docs/UploadSession.md +13 -0
- data/flip/docs/Video.md +31 -0
- data/flip/docs/VideoMetadata.md +7 -0
- data/flip/docs/VideoUploadBody.md +24 -0
- data/flip/git_push.sh +55 -0
- data/flip/lib/telestream_cloud_flip.rb +79 -0
- data/flip/lib/telestream_cloud_flip/api/flip_api.rb +2385 -0
- data/flip/lib/telestream_cloud_flip/api_client.rb +389 -0
- data/flip/lib/telestream_cloud_flip/api_error.rb +38 -0
- data/flip/lib/telestream_cloud_flip/configuration.rb +209 -0
- data/flip/lib/telestream_cloud_flip/models/canceled_response.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/cloud_notification_settings.rb +237 -0
- data/flip/lib/telestream_cloud_flip/models/cloud_notification_settings_events.rb +239 -0
- data/flip/lib/telestream_cloud_flip/models/copy_profile_body.rb +209 -0
- data/flip/lib/telestream_cloud_flip/models/count_response.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/create_encoding_body.rb +214 -0
- data/flip/lib/telestream_cloud_flip/models/create_video_body.rb +231 -0
- data/flip/lib/telestream_cloud_flip/models/deleted_response.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/encoding.rb +486 -0
- data/flip/lib/telestream_cloud_flip/models/encoding_signed_url.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/encoding_signed_urls.rb +191 -0
- data/flip/lib/telestream_cloud_flip/models/error.rb +199 -0
- data/flip/lib/telestream_cloud_flip/models/extra_file.rb +221 -0
- data/flip/lib/telestream_cloud_flip/models/factory.rb +388 -0
- data/flip/lib/telestream_cloud_flip/models/factory_body.rb +374 -0
- data/flip/lib/telestream_cloud_flip/models/factory_body_storage_credential_attributes.rb +215 -0
- data/flip/lib/telestream_cloud_flip/models/factory_sync.rb +222 -0
- data/flip/lib/telestream_cloud_flip/models/factory_sync_body.rb +227 -0
- data/flip/lib/telestream_cloud_flip/models/paginated_encodings_collection.rb +240 -0
- data/flip/lib/telestream_cloud_flip/models/paginated_factory_collection.rb +220 -0
- data/flip/lib/telestream_cloud_flip/models/paginated_profiles_collection.rb +220 -0
- data/flip/lib/telestream_cloud_flip/models/paginated_video_collection.rb +220 -0
- data/flip/lib/telestream_cloud_flip/models/paginated_workflows_collection.rb +220 -0
- data/flip/lib/telestream_cloud_flip/models/profile.rb +1777 -0
- data/flip/lib/telestream_cloud_flip/models/profile_body.rb +1762 -0
- data/flip/lib/telestream_cloud_flip/models/resubmit_video_body.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/retried_response.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/signed_video_url.rb +189 -0
- data/flip/lib/telestream_cloud_flip/models/update_encoding_body.rb +199 -0
- data/flip/lib/telestream_cloud_flip/models/upload_session.rb +249 -0
- data/flip/lib/telestream_cloud_flip/models/video.rb +418 -0
- data/flip/lib/telestream_cloud_flip/models/video_metadata.rb +179 -0
- data/flip/lib/telestream_cloud_flip/models/video_upload_body.rb +362 -0
- data/flip/lib/telestream_cloud_flip/uploader.rb +244 -0
- data/flip/lib/telestream_cloud_flip/version.rb +18 -0
- data/flip/spec/api/flip_api_spec.rb +550 -0
- data/flip/spec/api_client_spec.rb +226 -0
- data/flip/spec/configuration_spec.rb +42 -0
- data/flip/spec/models/canceled_response_spec.rb +42 -0
- data/flip/spec/models/cloud_notification_settings_events_spec.rb +60 -0
- data/flip/spec/models/cloud_notification_settings_spec.rb +60 -0
- data/flip/spec/models/copy_profile_body_spec.rb +48 -0
- data/flip/spec/models/count_response_spec.rb +42 -0
- data/flip/spec/models/create_encoding_body_spec.rb +54 -0
- data/flip/spec/models/create_video_body_spec.rb +66 -0
- data/flip/spec/models/deleted_response_spec.rb +42 -0
- data/flip/spec/models/encoding_signed_url_spec.rb +42 -0
- data/flip/spec/models/encoding_signed_urls_spec.rb +42 -0
- data/flip/spec/models/encoding_spec.rb +222 -0
- data/flip/spec/models/error_spec.rb +48 -0
- data/flip/spec/models/extra_file_spec.rb +54 -0
- data/flip/spec/models/factory_body_spec.rb +136 -0
- data/flip/spec/models/factory_body_storage_credential_attributes_spec.rb +60 -0
- data/flip/spec/models/factory_spec.rb +148 -0
- data/flip/spec/models/factory_sync_body_spec.rb +46 -0
- data/flip/spec/models/factory_sync_spec.rb +46 -0
- data/flip/spec/models/paginated_encodings_collection_spec.rb +60 -0
- data/flip/spec/models/paginated_factory_collection_spec.rb +60 -0
- data/flip/spec/models/paginated_profiles_collection_spec.rb +60 -0
- data/flip/spec/models/paginated_video_collection_spec.rb +60 -0
- data/flip/spec/models/paginated_workflows_collection_spec.rb +60 -0
- data/flip/spec/models/profile_body_spec.rb +916 -0
- data/flip/spec/models/profile_spec.rb +916 -0
- data/flip/spec/models/resubmit_video_body_spec.rb +42 -0
- data/flip/spec/models/retried_response_spec.rb +42 -0
- data/flip/spec/models/signed_video_url_spec.rb +42 -0
- data/flip/spec/models/update_encoding_body_spec.rb +48 -0
- data/flip/spec/models/upload_session_spec.rb +72 -0
- data/flip/spec/models/video_metadata_spec.rb +36 -0
- data/flip/spec/models/video_spec.rb +180 -0
- data/flip/spec/models/video_upload_body_spec.rb +138 -0
- data/flip/spec/spec_helper.rb +111 -0
- data/flip/telestream_cloud_flip.gemspec +47 -0
- data/lib/telestream_cloud.rb +0 -31
- data/lib/telestream_cloud/flip.rb +1 -9
- data/lib/telestream_cloud/qc.rb +1 -0
- data/lib/telestream_cloud/tts.rb +1 -0
- data/lib/telestream_cloud/version.rb +1 -1
- data/qc/.gitignore +39 -0
- data/qc/.rspec +2 -0
- data/qc/.swagger-codegen-ignore +23 -0
- data/qc/.swagger-codegen/VERSION +1 -0
- data/qc/Gemfile +7 -0
- data/qc/README.md +58 -0
- data/qc/Rakefile +8 -0
- data/qc/docs/Alert.md +13 -0
- data/qc/docs/AudioStream.md +13 -0
- data/qc/docs/Container.md +9 -0
- data/qc/docs/Data.md +10 -0
- data/qc/docs/Data1.md +9 -0
- data/qc/docs/ExtraFile.md +10 -0
- data/qc/docs/Job.md +12 -0
- data/qc/docs/JobData.md +9 -0
- data/qc/docs/JobDetails.md +9 -0
- data/qc/docs/JobDetailsResult.md +8 -0
- data/qc/docs/JobsCollection.md +12 -0
- data/qc/docs/Media.md +10 -0
- data/qc/docs/Options.md +7 -0
- data/qc/docs/Project.md +12 -0
- data/qc/docs/Proxy.md +12 -0
- data/qc/docs/QcApi.md +719 -0
- data/qc/docs/UploadSession.md +13 -0
- data/qc/docs/VideoStream.md +13 -0
- data/qc/docs/VideoUploadBody.md +12 -0
- data/qc/git_push.sh +55 -0
- data/qc/lib/telestream_cloud_qc.rb +64 -0
- data/qc/lib/telestream_cloud_qc/api/qc_api.rb +781 -0
- data/qc/lib/telestream_cloud_qc/api_client.rb +389 -0
- data/qc/lib/telestream_cloud_qc/api_error.rb +38 -0
- data/qc/lib/telestream_cloud_qc/configuration.rb +209 -0
- data/qc/lib/telestream_cloud_qc/models/alert.rb +236 -0
- data/qc/lib/telestream_cloud_qc/models/audio_stream.rb +238 -0
- data/qc/lib/telestream_cloud_qc/models/container.rb +198 -0
- data/qc/lib/telestream_cloud_qc/models/data.rb +208 -0
- data/qc/lib/telestream_cloud_qc/models/data_1.rb +197 -0
- data/qc/lib/telestream_cloud_qc/models/extra_file.rb +221 -0
- data/qc/lib/telestream_cloud_qc/models/job.rb +269 -0
- data/qc/lib/telestream_cloud_qc/models/job_data.rb +197 -0
- data/qc/lib/telestream_cloud_qc/models/job_details.rb +199 -0
- data/qc/lib/telestream_cloud_qc/models/job_details_result.rb +190 -0
- data/qc/lib/telestream_cloud_qc/models/jobs_collection.rb +230 -0
- data/qc/lib/telestream_cloud_qc/models/media.rb +210 -0
- data/qc/lib/telestream_cloud_qc/models/options.rb +179 -0
- data/qc/lib/telestream_cloud_qc/models/project.rb +262 -0
- data/qc/lib/telestream_cloud_qc/models/proxy.rb +224 -0
- data/qc/lib/telestream_cloud_qc/models/upload_session.rb +249 -0
- data/qc/lib/telestream_cloud_qc/models/video_stream.rb +235 -0
- data/qc/lib/telestream_cloud_qc/models/video_upload_body.rb +242 -0
- data/qc/lib/telestream_cloud_qc/uploader.rb +244 -0
- data/qc/lib/telestream_cloud_qc/version.rb +18 -0
- data/qc/spec/api/qc_api_spec.rb +202 -0
- data/qc/spec/api_client_spec.rb +226 -0
- data/qc/spec/configuration_spec.rb +42 -0
- data/qc/spec/models/alert_spec.rb +72 -0
- data/qc/spec/models/audio_stream_spec.rb +72 -0
- data/qc/spec/models/container_spec.rb +48 -0
- data/qc/spec/models/data_1_spec.rb +48 -0
- data/qc/spec/models/data_spec.rb +54 -0
- data/qc/spec/models/extra_file_spec.rb +54 -0
- data/qc/spec/models/job_data_spec.rb +48 -0
- data/qc/spec/models/job_details_result_spec.rb +42 -0
- data/qc/spec/models/job_details_spec.rb +48 -0
- data/qc/spec/models/job_spec.rb +74 -0
- data/qc/spec/models/jobs_collection_spec.rb +66 -0
- data/qc/spec/models/media_spec.rb +54 -0
- data/qc/spec/models/options_spec.rb +36 -0
- data/qc/spec/models/project_spec.rb +70 -0
- data/qc/spec/models/proxy_spec.rb +66 -0
- data/qc/spec/models/upload_session_spec.rb +72 -0
- data/qc/spec/models/video_stream_spec.rb +72 -0
- data/qc/spec/models/video_upload_body_spec.rb +66 -0
- data/qc/spec/spec_helper.rb +111 -0
- data/qc/telestream_cloud_qc.gemspec +47 -0
- data/telestream_cloud.gemspec +7 -12
- data/tts/.gitignore +39 -0
- data/tts/.rspec +2 -0
- data/tts/.swagger-codegen-ignore +23 -0
- data/tts/.swagger-codegen/VERSION +1 -0
- data/tts/Gemfile +7 -0
- data/tts/README.md +92 -0
- data/tts/Rakefile +8 -0
- data/tts/docs/CorporaCollection.md +8 -0
- data/tts/docs/Corpus.md +9 -0
- data/tts/docs/ErrorResponse.md +7 -0
- data/tts/docs/ExtraFile.md +10 -0
- data/tts/docs/Fragment.md +10 -0
- data/tts/docs/FragmentVariant.md +9 -0
- data/tts/docs/Job.md +23 -0
- data/tts/docs/JobResult.md +8 -0
- data/tts/docs/JobsCollection.md +12 -0
- data/tts/docs/Project.md +18 -0
- data/tts/docs/ProjectsCollection.md +12 -0
- data/tts/docs/Result.md +12 -0
- data/tts/docs/TtsApi.md +902 -0
- data/tts/docs/UploadSession.md +13 -0
- data/tts/docs/VideoUploadBody.md +12 -0
- data/tts/git_push.sh +55 -0
- data/tts/lib/telestream_cloud_tts.rb +60 -0
- data/tts/lib/telestream_cloud_tts/api/tts_api.rb +946 -0
- data/tts/lib/telestream_cloud_tts/api_client.rb +389 -0
- data/tts/lib/telestream_cloud_tts/api_error.rb +38 -0
- data/tts/lib/telestream_cloud_tts/configuration.rb +209 -0
- data/tts/lib/telestream_cloud_tts/models/corpora_collection.rb +191 -0
- data/tts/lib/telestream_cloud_tts/models/corpus.rb +199 -0
- data/tts/lib/telestream_cloud_tts/models/error_response.rb +179 -0
- data/tts/lib/telestream_cloud_tts/models/extra_file.rb +221 -0
- data/tts/lib/telestream_cloud_tts/models/fragment.rb +211 -0
- data/tts/lib/telestream_cloud_tts/models/fragment_variant.rb +199 -0
- data/tts/lib/telestream_cloud_tts/models/job.rb +372 -0
- data/tts/lib/telestream_cloud_tts/models/job_result.rb +191 -0
- data/tts/lib/telestream_cloud_tts/models/jobs_collection.rb +230 -0
- data/tts/lib/telestream_cloud_tts/models/project.rb +322 -0
- data/tts/lib/telestream_cloud_tts/models/projects_collection.rb +230 -0
- data/tts/lib/telestream_cloud_tts/models/result.rb +230 -0
- data/tts/lib/telestream_cloud_tts/models/upload_session.rb +249 -0
- data/tts/lib/telestream_cloud_tts/models/video_upload_body.rb +241 -0
- data/tts/lib/telestream_cloud_tts/uploader.rb +244 -0
- data/tts/lib/telestream_cloud_tts/version.rb +18 -0
- data/tts/spec/api/tts_api_spec.rb +236 -0
- data/tts/spec/api_client_spec.rb +226 -0
- data/tts/spec/configuration_spec.rb +42 -0
- data/tts/spec/models/corpora_collection_spec.rb +42 -0
- data/tts/spec/models/corpus_spec.rb +48 -0
- data/tts/spec/models/error_response_spec.rb +36 -0
- data/tts/spec/models/extra_file_spec.rb +54 -0
- data/tts/spec/models/fragment_spec.rb +54 -0
- data/tts/spec/models/fragment_variant_spec.rb +48 -0
- data/tts/spec/models/job_result_spec.rb +42 -0
- data/tts/spec/models/job_spec.rb +136 -0
- data/tts/spec/models/jobs_collection_spec.rb +66 -0
- data/tts/spec/models/project_spec.rb +106 -0
- data/tts/spec/models/projects_collection_spec.rb +66 -0
- data/tts/spec/models/result_spec.rb +66 -0
- data/tts/spec/models/upload_session_spec.rb +72 -0
- data/tts/spec/models/video_upload_body_spec.rb +66 -0
- data/tts/spec/spec_helper.rb +111 -0
- data/tts/telestream_cloud_tts.gemspec +47 -0
- metadata +281 -123
- data/Gemfile +0 -2
- data/lib/telestream_cloud/api_authentication.rb +0 -66
- data/lib/telestream_cloud/base.rb +0 -111
- data/lib/telestream_cloud/config.rb +0 -87
- data/lib/telestream_cloud/connection.rb +0 -101
- data/lib/telestream_cloud/errors.rb +0 -17
- data/lib/telestream_cloud/faraday.rb +0 -84
- data/lib/telestream_cloud/modules/associations.rb +0 -55
- data/lib/telestream_cloud/modules/builders.rb +0 -45
- data/lib/telestream_cloud/modules/destroyers.rb +0 -25
- data/lib/telestream_cloud/modules/factory_connection.rb +0 -7
- data/lib/telestream_cloud/modules/finders.rb +0 -68
- data/lib/telestream_cloud/modules/router.rb +0 -62
- data/lib/telestream_cloud/modules/updatable.rb +0 -31
- data/lib/telestream_cloud/modules/video_state.rb +0 -16
- data/lib/telestream_cloud/parallel_uploader.rb +0 -52
- data/lib/telestream_cloud/proxies/encoding_scope.rb +0 -56
- data/lib/telestream_cloud/proxies/profile_scope.rb +0 -7
- data/lib/telestream_cloud/proxies/proxy.rb +0 -27
- data/lib/telestream_cloud/proxies/scope.rb +0 -94
- data/lib/telestream_cloud/proxies/video_scope.rb +0 -28
- data/lib/telestream_cloud/resources/encoding.rb +0 -47
- data/lib/telestream_cloud/resources/factory.rb +0 -72
- data/lib/telestream_cloud/resources/profile.rb +0 -22
- data/lib/telestream_cloud/resources/resource.rb +0 -48
- data/lib/telestream_cloud/resources/video.rb +0 -39
- data/lib/telestream_cloud/telestream_cloud.rb +0 -69
- data/lib/telestream_cloud/upload_session.rb +0 -40
- data/lib/telestream_cloud/uploader.rb +0 -123
- data/lib/telestream_cloud/uploader/file_reader.rb +0 -27
- data/spec/cloud_spec.rb +0 -132
- data/spec/encoding_spec.rb +0 -260
- data/spec/heroku_spec.rb +0 -32
- data/spec/panda_spec.rb +0 -206
- data/spec/profile_spec.rb +0 -117
- data/spec/spec_helper.rb +0 -18
- data/spec/uploader_spec.rb +0 -143
- data/spec/video_spec.rb +0 -399
data/spec/video_spec.rb
DELETED
@@ -1,399 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe TelestreamCloud::Video do
|
4
|
-
before(:each) do
|
5
|
-
|
6
|
-
TelestreamCloud.configure do
|
7
|
-
access_key "my_access_key"
|
8
|
-
secret_key "my_secret_key"
|
9
|
-
api_host "api.example.com"
|
10
|
-
factory_id 'my_cloud_id'
|
11
|
-
api_port 85
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should create a video object" do
|
17
|
-
v = TelestreamCloud::Video.new({ :test => "abc" })
|
18
|
-
v.test.should == "abc"
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should tell video is new" do
|
22
|
-
v = TelestreamCloud::Video.new({ :id => "abc" })
|
23
|
-
v.new?.should be_falsey
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should not tell video is new" do
|
27
|
-
v = TelestreamCloud::Video.new({ :attr => "abc" })
|
28
|
-
v.new?.should be_truthy
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should find return all videos" do
|
32
|
-
|
33
|
-
videos_json = "[{\"source_url\":\"my_source_url\",\"id\":111},{\"source_url\":\"http://a.b.com/file2.mp4\",\"id\":222}]"
|
34
|
-
|
35
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos.json/).to_return(:body => videos_json)
|
36
|
-
|
37
|
-
videos = TelestreamCloud::Video.all
|
38
|
-
videos.first.id.should == 111
|
39
|
-
videos.first.source_url.should == "my_source_url"
|
40
|
-
videos.size.should == 2
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should find a videos having the correct id" do
|
44
|
-
|
45
|
-
video_json = "{\"source_url\":\"my_source_url\",\"id\":\"123\"}"
|
46
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
47
|
-
|
48
|
-
video = TelestreamCloud::Video.find("123")
|
49
|
-
video.id.should == "123"
|
50
|
-
video.source_url.should == "my_source_url"
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should raise exception if id is nil" do
|
54
|
-
|
55
|
-
lambda {
|
56
|
-
TelestreamCloud::Video.find(nil)
|
57
|
-
}.should raise_error('find method requires a correct value')
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should list all video's encodings" do
|
62
|
-
video_json = "{\"source_url\":\"my_source_url\",\"id\":\"123\"}"
|
63
|
-
encodings_json = "[{\"abc\":\"my_source_url\",\"id\":\"456\"}]"
|
64
|
-
|
65
|
-
encodings = [TelestreamCloud::Encoding.new({:abc => "my_source_url", :id => "456"})]
|
66
|
-
|
67
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
68
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).to_return(:body => encodings_json)
|
69
|
-
|
70
|
-
video = TelestreamCloud::Video.find("123")
|
71
|
-
video.encodings.first.attributes.should == encodings.first.attributes
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should delete a video using class" do
|
75
|
-
video_json = "{\"deleted\":\"ok\"}"
|
76
|
-
stub_http_request(:delete, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
77
|
-
|
78
|
-
video = TelestreamCloud::Video.new(:source_url => "my_source_url", :id => "123")
|
79
|
-
video.factory
|
80
|
-
video.delete.should == true
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should delete a video using instance" do
|
84
|
-
video_json = "{\"deleted\":\"ok\"}"
|
85
|
-
stub_http_request(:delete, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
86
|
-
|
87
|
-
TelestreamCloud::Video.delete("123")
|
88
|
-
end
|
89
|
-
|
90
|
-
it "should have an error object if something goes wrong" do
|
91
|
-
response = "{\"message\":\"no-abc\",\"error\":\"error-abc\"}"
|
92
|
-
|
93
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/abc.json/).to_return(:body => response)
|
94
|
-
|
95
|
-
lambda {
|
96
|
-
TelestreamCloud::Video.find "abc"
|
97
|
-
}.should raise_error(TelestreamCloud::APIError, "error-abc: no-abc")
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should have an error object if something goes wrong" do
|
101
|
-
response = "{\"message\":\"no-abc\",\"error\":\"error-abc\"}"
|
102
|
-
|
103
|
-
stub_http_request(:put, /api.example.com:85\/v3.0\/profiles\/abc.json/).to_return(:body => response)
|
104
|
-
|
105
|
-
obj = TelestreamCloud::Profile.new(:id => "abc")
|
106
|
-
original_attrs = obj.attributes
|
107
|
-
obj.save
|
108
|
-
|
109
|
-
obj.errors.size.should == 1
|
110
|
-
obj.errors.first.to_s.should == "error-abc: no-abc"
|
111
|
-
obj.attributes.should == original_attrs
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should connect to eu" do
|
116
|
-
|
117
|
-
|
118
|
-
TelestreamCloud.configure do
|
119
|
-
access_key "my_access_key"
|
120
|
-
secret_key "my_secret_key"
|
121
|
-
factory_id 'my_cloud_id'
|
122
|
-
region "eu"
|
123
|
-
end
|
124
|
-
|
125
|
-
stub_http_request(:get, /api-eu.pandastream.com:443/).
|
126
|
-
to_return(:body => "{\"id\":\"123\"}")
|
127
|
-
TelestreamCloud::Video.find "123"
|
128
|
-
end
|
129
|
-
|
130
|
-
it "should accept a string as a port" do
|
131
|
-
TelestreamCloud.configure do
|
132
|
-
access_key "my_access_key"
|
133
|
-
secret_key "my_secret_key"
|
134
|
-
factory_id 'my_cloud_id'
|
135
|
-
api_port '443'
|
136
|
-
end
|
137
|
-
|
138
|
-
stub_http_request(:get, /https:\/\/api.pandastream.com:443/).
|
139
|
-
to_return(:body => "{\"id\":\"123\"}")
|
140
|
-
TelestreamCloud::Video.find "123"
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should connect to eu and trigger the request" do
|
144
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\"}"
|
145
|
-
stub_http_request(:get, /api-eu.pandastream.com:80\/v3.0\/factories\/my_cloud_id.json/).
|
146
|
-
to_return(:body => cloud_json)
|
147
|
-
|
148
|
-
TelestreamCloud.configure do |c|
|
149
|
-
c.access_key "my_access_key"
|
150
|
-
c.secret_key "my_secret_key"
|
151
|
-
c.factory_id 'my_cloud_id'
|
152
|
-
c.region "eu"
|
153
|
-
end
|
154
|
-
|
155
|
-
stub_http_request(:get, /api-eu.pandastream.com:443/).
|
156
|
-
to_return(:body => "{\"id\":\"123\"}")
|
157
|
-
TelestreamCloud::Video.find "123"
|
158
|
-
end
|
159
|
-
|
160
|
-
it "should use the correct connection" do
|
161
|
-
video_json = "{\"source_url\":\"my_source_url\",\"id\":\"123\"}"
|
162
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"cloud1\"}"
|
163
|
-
cloud2_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"cloud2\"}"
|
164
|
-
|
165
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/cloud1.json/).
|
166
|
-
to_return(:body => cloud_json)
|
167
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/cloud2.json/).
|
168
|
-
to_return(:body => cloud2_json)
|
169
|
-
|
170
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).
|
171
|
-
to_return(:body => video_json)
|
172
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).
|
173
|
-
to_return(:body => video_json)
|
174
|
-
|
175
|
-
cloud = TelestreamCloud::Factory.new(:id => "cloud1")
|
176
|
-
|
177
|
-
cloud2 = TelestreamCloud::Factory.new(:id => "cloud2")
|
178
|
-
|
179
|
-
video = cloud.videos.find("123")
|
180
|
-
video2 = cloud2.videos.find("123")
|
181
|
-
|
182
|
-
video.factory.id.should == "cloud1"
|
183
|
-
video2.factory.id.should == "cloud2"
|
184
|
-
|
185
|
-
TelestreamCloud::Video.factory.id.should == "my_cloud_id"
|
186
|
-
end
|
187
|
-
|
188
|
-
it "should create a video using class method" do
|
189
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
190
|
-
|
191
|
-
stub_http_request(:post, /api.example.com:85\/v3.0\/videos.json/).
|
192
|
-
with(:body => /source_url=url_panda.mp4/).
|
193
|
-
to_return(:body => video_json)
|
194
|
-
|
195
|
-
video = TelestreamCloud::Video.create(:source_url => "url_panda.mp4")
|
196
|
-
video.id.should == "123"
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should create a video and reload" do
|
200
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
201
|
-
|
202
|
-
stub_http_request(:post, /api.example.com:85\/v3.0\/videos.json/).
|
203
|
-
with(:body => /source_url=url_panda.mp4/).
|
204
|
-
to_return(:body => video_json)
|
205
|
-
|
206
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
207
|
-
|
208
|
-
video = TelestreamCloud::Video.create(:source_url => "url_panda.mp4")
|
209
|
-
video.reload.should == video
|
210
|
-
end
|
211
|
-
|
212
|
-
it "should create a video using class method and a block" do
|
213
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
214
|
-
|
215
|
-
stub_http_request(:post, /api.example.com:85\/v3.0\/videos.json/).
|
216
|
-
with(:body => /source_url=url_panda.mp4/).
|
217
|
-
to_return(:body => video_json)
|
218
|
-
|
219
|
-
video = TelestreamCloud::Video.create do |v|
|
220
|
-
v.source_url = "url_panda.mp4"
|
221
|
-
end
|
222
|
-
|
223
|
-
video.id.should == "123"
|
224
|
-
end
|
225
|
-
|
226
|
-
it "should return a json on attributes" do
|
227
|
-
video = TelestreamCloud::Video.new(:attr => "value")
|
228
|
-
|
229
|
-
MultiJson.decode( video.to_json ).should == {"attr" => "value", "factory_id" => "my_cloud_id"}
|
230
|
-
end
|
231
|
-
|
232
|
-
it "should create an encoding using video scope" do
|
233
|
-
encoding_json = "{\"source_url\":\"my_source_url\",\"id\":\"678\"}"
|
234
|
-
video_json = "{\"source_url\":\"my_source_url\",\"id\":\"123\"}"
|
235
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).
|
236
|
-
to_return(:body => video_json)
|
237
|
-
|
238
|
-
stub_http_request(:post, /api.example.com:85\/v3.0\/encodings.json/).
|
239
|
-
with(:body => /profile_id=345/).
|
240
|
-
to_return(:body => encoding_json)
|
241
|
-
|
242
|
-
video = TelestreamCloud::Video.find "123"
|
243
|
-
encoding = video.encodings.create(:profile_id => "345")
|
244
|
-
encoding.id.should == "678"
|
245
|
-
end
|
246
|
-
|
247
|
-
it "should not create a model having an id" do
|
248
|
-
video = TelestreamCloud::Video.new(:id => "abc")
|
249
|
-
lambda {
|
250
|
-
video.create
|
251
|
-
}.should raise_error "Can't create attribute. Already have an id=abc"
|
252
|
-
end
|
253
|
-
|
254
|
-
it "should not create a model having an id" do
|
255
|
-
lambda {
|
256
|
-
TelestreamCloud::Video.create(:id => "abc")
|
257
|
-
}.should raise_error "Can't create attribute. Already have an id=abc"
|
258
|
-
end
|
259
|
-
|
260
|
-
it "should not call the request twice" do
|
261
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
262
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
263
|
-
video = TelestreamCloud::Video.find("123")
|
264
|
-
|
265
|
-
encodings_json = "[{\"abc\":\"my_source_url\",\"id\":\"456\"}]"
|
266
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).to_return(:body => encodings_json)
|
267
|
-
|
268
|
-
encodings = video.encodings
|
269
|
-
encodings.first
|
270
|
-
encodings.first
|
271
|
-
|
272
|
-
WebMock.should have_requested(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).once
|
273
|
-
end
|
274
|
-
|
275
|
-
it 'should generate json of encodings' do
|
276
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
277
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
278
|
-
video = TelestreamCloud::Video.find("123")
|
279
|
-
|
280
|
-
encodings_json = "[{\"abc\":\"my_source_url\",\"id\":\"456\"}]"
|
281
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).to_return(:body => encodings_json)
|
282
|
-
|
283
|
-
MultiJson.decode( video.encodings.first.to_json ).should == {"abc" => "my_source_url", "id" => "456", "factory_id" => "my_cloud_id"}
|
284
|
-
end
|
285
|
-
|
286
|
-
it "should return the video url" do
|
287
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\", \"url\":\"http://my-bucket.s3.amazonaws.com/\"}"
|
288
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/my_cloud_id.json/).
|
289
|
-
to_return(:body => cloud_json)
|
290
|
-
|
291
|
-
video = TelestreamCloud::Video.new({:id => "456", :extname => ".ext", :path => "abc/panda", :status => 'success'})
|
292
|
-
video.url.should == "http://my-bucket.s3.amazonaws.com/abc/panda.ext"
|
293
|
-
end
|
294
|
-
|
295
|
-
it "should return the secure video url" do
|
296
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\", \"url\":\"http://my-bucket.s3.amazonaws.com/\"}"
|
297
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/my_cloud_id.json/).
|
298
|
-
to_return(:body => cloud_json)
|
299
|
-
|
300
|
-
video = TelestreamCloud::Video.new({:id => "456", :extname => ".ext", :path => "abc/panda", :status => 'success'})
|
301
|
-
video.url(:https => true).should == "https://my-bucket.s3.amazonaws.com/abc/panda.ext"
|
302
|
-
end
|
303
|
-
|
304
|
-
it "should generate a screenshot url" do
|
305
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\", \"url\":\"http://my-bucket.s3.amazonaws.com/\"}"
|
306
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/my_cloud_id.json/).
|
307
|
-
to_return(:body => cloud_json)
|
308
|
-
|
309
|
-
video = TelestreamCloud::Video.new({:id => "456", :extname => ".ext", :status => "success", :path => "abc/panda"})
|
310
|
-
video.preview_url.should == "http://my-bucket.s3.amazonaws.com/abc/panda_1.jpg"
|
311
|
-
end
|
312
|
-
|
313
|
-
it "should generate a secure screenshot url" do
|
314
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\", \"url\":\"http://my-bucket.s3.amazonaws.com/\"}"
|
315
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/my_cloud_id.json/).
|
316
|
-
to_return(:body => cloud_json)
|
317
|
-
|
318
|
-
video = TelestreamCloud::Video.new({:id => "456", :extname => ".ext", :status => "success", :path => "abc/panda"})
|
319
|
-
video.preview_url(:https => true).should == "https://my-bucket.s3.amazonaws.com/abc/panda_1.jpg"
|
320
|
-
end
|
321
|
-
|
322
|
-
it "should call the request if the scope has changed" do
|
323
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
324
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
325
|
-
video = TelestreamCloud::Video.find("123")
|
326
|
-
|
327
|
-
encodings_json = "[{\"abc\":\"my_source_url\",\"id\":\"456\"}]"
|
328
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).to_return(:body => encodings_json)
|
329
|
-
|
330
|
-
encodings = video.encodings.status("success")
|
331
|
-
|
332
|
-
encodings.first
|
333
|
-
encodings.last
|
334
|
-
|
335
|
-
video.encodings.first
|
336
|
-
|
337
|
-
WebMock.should have_requested(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).once
|
338
|
-
end
|
339
|
-
|
340
|
-
it "should not call the request twice" do
|
341
|
-
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
342
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).to_return(:body => video_json)
|
343
|
-
video = TelestreamCloud::Video.find("123")
|
344
|
-
|
345
|
-
encodings_json = "[{\"abc\":\"my_source_url\",\"id\":\"456\"}]"
|
346
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).to_return(:body => encodings_json)
|
347
|
-
|
348
|
-
encodings = video.encodings
|
349
|
-
encodings.first.id.should == "456"
|
350
|
-
encodings.reload
|
351
|
-
|
352
|
-
WebMock.should have_requested(:get, /api.example.com:85\/v3.0\/videos\/123\/encodings.json/).twice
|
353
|
-
end
|
354
|
-
|
355
|
-
it "should tell if the video is success" do
|
356
|
-
encoding = TelestreamCloud::Video.new({:status => "success"})
|
357
|
-
encoding.success?.should == true
|
358
|
-
encoding.processing?.should == false
|
359
|
-
end
|
360
|
-
|
361
|
-
it "should tell if the video is success" do
|
362
|
-
encoding = TelestreamCloud::Video.new({:status => "processing"})
|
363
|
-
encoding.success?.should == false
|
364
|
-
encoding.processing?.should == true
|
365
|
-
end
|
366
|
-
|
367
|
-
it "should tell if the video is success" do
|
368
|
-
encoding = TelestreamCloud::Video.new({:status => "fail"})
|
369
|
-
encoding.success?.should == false
|
370
|
-
encoding.fail?.should == true
|
371
|
-
end
|
372
|
-
|
373
|
-
it "should return the most recent updated video" do
|
374
|
-
video_json = "[{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}]"
|
375
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos.json/).
|
376
|
-
with{|r| r.uri.query =~ /per_page=1/ }.
|
377
|
-
to_return(:body => video_json)
|
378
|
-
TelestreamCloud::Video.first
|
379
|
-
end
|
380
|
-
|
381
|
-
it "should not delegate scope if the method do not really exist in the scope" do
|
382
|
-
lambda {TelestreamCloud::Video.reload}.should raise_error(NoMethodError)
|
383
|
-
lambda {TelestreamCloud::Video.each}.should raise_error(NoMethodError)
|
384
|
-
lambda {TelestreamCloud::Video.size}.should raise_error(NoMethodError)
|
385
|
-
end
|
386
|
-
|
387
|
-
it "should lazy load the cloud" do
|
388
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\"}"
|
389
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/my_cloud_id.json/).
|
390
|
-
to_return(:body => cloud_json)
|
391
|
-
|
392
|
-
video_json = "{\"source_url\":\"my_source_url\",\"id\":\"123\"}"
|
393
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/videos\/123.json/).
|
394
|
-
to_return(:body => video_json)
|
395
|
-
|
396
|
-
video = TelestreamCloud::Video.find "123"
|
397
|
-
video.factory.s3_videos_bucket.should == "my_bucket"
|
398
|
-
end
|
399
|
-
end
|