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/heroku_spec.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe TelestreamCloud::Video do
|
4
|
-
before(:each) do
|
5
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\"}"
|
6
|
-
stub_http_request(:get, /api.example.com:443\/v2\/factories\/my_cloud_id.json/).
|
7
|
-
to_return(:body => cloud_json)
|
8
|
-
|
9
|
-
my_heroku_url = "http://access_key:secret_key@api.example.com:443/my_cloud_id"
|
10
|
-
ENV['PANDASTREAM_URL']= my_heroku_url
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should get all videos" do
|
14
|
-
TelestreamCloud.configure_heroku
|
15
|
-
|
16
|
-
videos_json = "[]"
|
17
|
-
stub_http_request(:get, /api.example.com:443\/v3.0\/videos.json/).to_return(:body => videos_json)
|
18
|
-
|
19
|
-
TelestreamCloud::Video.all.should be_empty
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should get all videos" do
|
23
|
-
TelestreamCloud.configure ENV['PANDASTREAM_URL']
|
24
|
-
|
25
|
-
videos_json = "[]"
|
26
|
-
stub_http_request(:get, /api.example.com:443\/v3.0\/videos.json/).to_return(:body => videos_json)
|
27
|
-
|
28
|
-
TelestreamCloud::Video.all.should be_empty
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
end
|
data/spec/panda_spec.rb
DELETED
@@ -1,206 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
require 'timecop'
|
3
|
-
|
4
|
-
describe TelestreamCloud do
|
5
|
-
before(:each) do
|
6
|
-
new_time = Time.utc(2010, 1, 12, 1, 0, 0)
|
7
|
-
Timecop.freeze(new_time)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "when not connected" do
|
11
|
-
|
12
|
-
["get", "post", "put", "delete"].each do |method|
|
13
|
-
it "should raise error for #{method}" do
|
14
|
-
lambda {
|
15
|
-
TelestreamCloud.send(method, nil, nil)
|
16
|
-
}.should raise_error(TelestreamCloud::ConfigurationError, "Telestream Cloud is not configured!")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "root configuration with hash" do
|
23
|
-
it "should not fail is access_key and secret_key are given" do
|
24
|
-
proc do
|
25
|
-
TelestreamCloud.configure({:access_key => "bar", :secret_key => "baz"})
|
26
|
-
end.should_not raise_error(TelestreamCloud::ConfigurationError)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should fail if access_key or secret_key are missing" do
|
30
|
-
proc do
|
31
|
-
TelestreamCloud.configure({:secret_key => "baz"})
|
32
|
-
end.should raise_error(TelestreamCloud::ConfigurationError)
|
33
|
-
proc do
|
34
|
-
TelestreamCloud.configure({:access_key => "bar"})
|
35
|
-
end.should raise_error(TelestreamCloud::ConfigurationError)
|
36
|
-
proc do
|
37
|
-
TelestreamCloud.configure({})
|
38
|
-
end.should raise_error(TelestreamCloud::ConfigurationError)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "root configuration with block" do
|
43
|
-
it "should not fail is access_key and secret_key are given" do
|
44
|
-
proc do
|
45
|
-
TelestreamCloud.configure do
|
46
|
-
access_key "bar"
|
47
|
-
secret_key "baz"
|
48
|
-
end
|
49
|
-
end.should_not raise_error(TelestreamCloud::ConfigurationError)
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should fail if access_key or secret_key are missing" do
|
53
|
-
proc do
|
54
|
-
TelestreamCloud.configure do
|
55
|
-
secret_key "baz"
|
56
|
-
end
|
57
|
-
end.should raise_error(TelestreamCloud::ConfigurationError)
|
58
|
-
proc do
|
59
|
-
TelestreamCloud.configure do
|
60
|
-
access_key "bar"
|
61
|
-
end
|
62
|
-
end.should raise_error(TelestreamCloud::ConfigurationError)
|
63
|
-
proc do
|
64
|
-
TelestreamCloud.configure do
|
65
|
-
end
|
66
|
-
end.should raise_error(TelestreamCloud::ConfigurationError)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
shared_examples_for "Connected" do
|
71
|
-
|
72
|
-
it "should make get request with signed request to panda server" do
|
73
|
-
stub_http_request(:get, "http://myapihost:85/v3.0/videos?access_key=my_access_key&factory_id=my_cloud_id&signature=ArhKqAFUwLQl9RhSmnOv5L2CMWhr0ZFOxA0B9IKIg8I=×tamp=2010-01-12T01%3A00%3A00.000000Z").to_return(:body => "{\"abc\":\"d\"}")
|
74
|
-
@tc.get("/videos").should == {'abc' => 'd'}
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should create a signed version of the parameters" do
|
78
|
-
signed_params = @tc.signed_params('POST',
|
79
|
-
'/videos.json',
|
80
|
-
{"param1" => 'one', "param2" => 'two'}
|
81
|
-
)
|
82
|
-
signed_params.should == {
|
83
|
-
'access_key' => "my_access_key",
|
84
|
-
'timestamp' => "2010-01-12T01:00:00.000000Z",
|
85
|
-
'factory_id' => 'my_cloud_id',
|
86
|
-
'signature' => 'A/7DSazLSnr8wiX2QUKCWE3C1IXAAdIpEcnFF4Qc8Rw=',
|
87
|
-
'param1' => 'one',
|
88
|
-
'param2' => 'two'
|
89
|
-
}
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should create a signed version of the parameters without additional arguments" do
|
93
|
-
@tc.signed_params('POST', '/videos.json').should == {
|
94
|
-
'access_key' => "my_access_key",
|
95
|
-
'timestamp' => "2010-01-12T01:00:00.000000Z",
|
96
|
-
'factory_id' => 'my_cloud_id',
|
97
|
-
'signature' => 'Ne/W+cvZAZ4yE70PcXgLbPieGrwdaCX9WPUCQeJBPhs='
|
98
|
-
}
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
it "should create a signed version of the parameters and difficult characters" do
|
103
|
-
signed_params = @tc.signed_params('POST',
|
104
|
-
'/videos.json',
|
105
|
-
{"tilde" => '~', "space" => ' '}
|
106
|
-
)
|
107
|
-
signed_params.should == {
|
108
|
-
'access_key' => "my_access_key",
|
109
|
-
'timestamp' => "2010-01-12T01:00:00.000000Z",
|
110
|
-
'factory_id' => 'my_cloud_id',
|
111
|
-
'signature' => 'g3shJBMg/7Kmbj3kl0eb4ziT3zounhFpC5jJIg+3Kts=',
|
112
|
-
'tilde' => '~',
|
113
|
-
'space' => ' '
|
114
|
-
}
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
it "should not include file inside the signature" do
|
119
|
-
@tc.signed_params('POST', '/videos.json', { "file" => "my_file" }).should == {
|
120
|
-
'access_key' => "my_access_key",
|
121
|
-
'timestamp' => "2010-01-12T01:00:00.000000Z",
|
122
|
-
'factory_id' => 'my_cloud_id',
|
123
|
-
'signature' => 'Ne/W+cvZAZ4yE70PcXgLbPieGrwdaCX9WPUCQeJBPhs=',
|
124
|
-
'file' => "my_file"
|
125
|
-
}
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should stringify keys" do
|
129
|
-
@tc.signed_params('POST', '/videos.json', { :file => "symbol_key" }).should == {
|
130
|
-
'access_key' => "my_access_key",
|
131
|
-
'timestamp' => "2010-01-12T01:00:00.000000Z",
|
132
|
-
'factory_id' => 'my_cloud_id',
|
133
|
-
'signature' => 'Ne/W+cvZAZ4yE70PcXgLbPieGrwdaCX9WPUCQeJBPhs=',
|
134
|
-
'file' => "symbol_key"
|
135
|
-
}
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe "TelestreamCloud.connect " do
|
140
|
-
before(:each) do
|
141
|
-
@tc = TelestreamCloud.connect!({"access_key" => "my_access_key", "secret_key" => "my_secret_key", "api_host" => "myapihost", "api_port" => 85, "factory_id" => 'my_cloud_id'})
|
142
|
-
end
|
143
|
-
it_should_behave_like "Connected"
|
144
|
-
end
|
145
|
-
|
146
|
-
describe "TelestreamCloud.connect with symbols" do
|
147
|
-
before(:each) do
|
148
|
-
@tc = TelestreamCloud.connect!({:access_key => "my_access_key", :secret_key => "my_secret_key", :api_host => "myapihost", :api_port => 85, :factory_id => 'my_cloud_id'})
|
149
|
-
end
|
150
|
-
|
151
|
-
it_should_behave_like "Connected"
|
152
|
-
end
|
153
|
-
|
154
|
-
describe "Panda::Connection.new" do
|
155
|
-
before(:each) do
|
156
|
-
@tc = TelestreamCloud::Connection.new({"access_key" => "my_access_key", "secret_key" => "my_secret_key", "api_host" => "myapihost", "api_port" => 85, "factory_id" => 'my_cloud_id'})
|
157
|
-
end
|
158
|
-
it_should_behave_like "Connected"
|
159
|
-
end
|
160
|
-
|
161
|
-
describe "Using hash as a return format" do
|
162
|
-
|
163
|
-
before(:each) do
|
164
|
-
@tc = TelestreamCloud::Connection.new({"access_key" => "my_access_key", "secret_key" => "my_secret_key", "api_host" => "myapihost", "api_port" => 85, "factory_id" => 'my_cloud_id' })
|
165
|
-
end
|
166
|
-
|
167
|
-
it "should make get request" do
|
168
|
-
stub_http_request(:get, "http://myapihost:85/v3.0/videos?access_key=my_access_key&factory_id=my_cloud_id&signature=ArhKqAFUwLQl9RhSmnOv5L2CMWhr0ZFOxA0B9IKIg8I=×tamp=2010-01-12T01%3A00%3A00.000000Z").to_return(:body => "{\"key\":\"value\"}")
|
169
|
-
@tc.get("/videos").should == {'key' => 'value'}
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
# describe "ActiveSupport::JSON parsing" do
|
175
|
-
#
|
176
|
-
# it "should use active support if it has been defined and if restclient is used " do
|
177
|
-
# @tc = Panda::Connection.new({"access_key" => "my_access_key", "secret_key" => "my_secret_key", "api_host" => "myapihost", "api_port" => 85, "cloud_id" => 'my_cloud_id' })
|
178
|
-
# Panda.adapter = 'restclient'
|
179
|
-
#
|
180
|
-
# stub_http_request(:get, "http://myapihost:85/v2/videos?access_key=my_access_key&cloud_id=my_cloud_id&signature=DYpg2K6d7kGo%2FuWPO%2FaQgtQmY3BPtFEtQgdQhVe8teM%3D×tamp=2010-01-12T01%3A00%3A00.000000Z").to_return(:body => "abc")
|
181
|
-
#
|
182
|
-
#
|
183
|
-
# module ActiveSupport
|
184
|
-
# class JSON; end
|
185
|
-
# end
|
186
|
-
#
|
187
|
-
# ActiveSupport::JSON.should_receive(:decode).with("abc").and_return("blah")
|
188
|
-
# @tc.get("/videos").should == "blah"
|
189
|
-
#
|
190
|
-
# Object.send :remove_const, :ActiveSupport
|
191
|
-
# end
|
192
|
-
# end
|
193
|
-
|
194
|
-
describe "parsing" do
|
195
|
-
it "should raise an error if the response is not JSON parsable" do
|
196
|
-
@connection = TelestreamCloud::Connection.new({"access_key" => "my_access_key", "secret_key" => "my_secret_key", "api_host" => "myapihost", "api_port" => 85, "cloud_id" => 'my_cloud_id' })
|
197
|
-
|
198
|
-
stub_http_request(:get, //).to_return(:body => "blahblah")
|
199
|
-
|
200
|
-
lambda {
|
201
|
-
@connection.get("/fake")
|
202
|
-
}.should raise_error(TelestreamCloud::ServiceNotAvailable)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
data/spec/profile_spec.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe TelestreamCloud::Profile do
|
4
|
-
before(:each) do
|
5
|
-
cloud_json = "{\"s3_videos_bucket\":\"my_bucket\",\"id\":\"my_cloud_id\"}"
|
6
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/factories\/my_cloud_id.json/).
|
7
|
-
to_return(:body => cloud_json)
|
8
|
-
|
9
|
-
TelestreamCloud.configure do
|
10
|
-
access_key "my_access_key"
|
11
|
-
secret_key "my_secret_key"
|
12
|
-
api_host "api.example.com"
|
13
|
-
factory_id 'my_cloud_id'
|
14
|
-
api_port 85
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should create a profile" do
|
20
|
-
profile_json = "{\"title\":\"my_profile\",\"id\":\"123\"}"
|
21
|
-
stub_http_request(:post, /api.example.com:85\/v3.0\/profiles.json/).
|
22
|
-
with(:body => /title=my_profile/).
|
23
|
-
to_return(:body => profile_json)
|
24
|
-
|
25
|
-
profile = TelestreamCloud::Profile.new(:title => "my_profile")
|
26
|
-
|
27
|
-
profile.new?.should == true
|
28
|
-
profile.changed?.should == true
|
29
|
-
profile.save.should == true
|
30
|
-
profile.changed?.should == false
|
31
|
-
profile.id.should == "123"
|
32
|
-
profile.new?.should == false
|
33
|
-
|
34
|
-
profile.changed?.should == false
|
35
|
-
|
36
|
-
profile.title = "new_last_title"
|
37
|
-
profile.changed?.should == true
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
it "should update a profile and sending the changed attributes" do
|
42
|
-
profile_json = "{\"title\":\"my_profile\",\"id\":\"123\"}"
|
43
|
-
stub_http_request(:put, /api.example.com:85\/v3.0\/profiles\/999.json/).
|
44
|
-
with{|r| !(r.body =~ /title=my_new_profile_title/) && r.body =~ /width=80/}.
|
45
|
-
to_return(:body => profile_json)
|
46
|
-
|
47
|
-
profile = TelestreamCloud::Profile.new(:id => "999", :title => "my_profile_title")
|
48
|
-
|
49
|
-
profile.width=80
|
50
|
-
profile.new?.should == false
|
51
|
-
profile.save.should == true
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
it "should not call update a profile" do
|
56
|
-
profile_json = "{\"title\":\"my_profile\",\"id\":\"123\"}"
|
57
|
-
stub_http_request(:put, /api.example.com:85\/v3.0\/profiles\/123.json/).
|
58
|
-
with(:body => /title=my_profile/).
|
59
|
-
to_return(:body => profile_json)
|
60
|
-
|
61
|
-
profile = TelestreamCloud::Profile.new(:id => "123")
|
62
|
-
profile.title = "my_profile"
|
63
|
-
|
64
|
-
profile.new?.should == false
|
65
|
-
profile.save.should == true
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
it "should have a many relation on encodings" do
|
70
|
-
encoding_json = "[{\"abc\":\"efg\",\"id\":456}]"
|
71
|
-
profile_json = "{\"title\":\"my_profile\",\"id\":\"901\"}"
|
72
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/profiles\/901\/encodings.json/).
|
73
|
-
to_return(:body => encoding_json)
|
74
|
-
|
75
|
-
profile = TelestreamCloud::Profile.new(:title => "my_source_url", :id => "901")
|
76
|
-
profile.encodings.first.id.should == 456
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should reload the object" do
|
80
|
-
profile_json = "{\"title\":\"my_profile\",\"id\":\"123\"}"
|
81
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/profiles\/123.json/).
|
82
|
-
to_return(:body => profile_json)
|
83
|
-
|
84
|
-
profile = TelestreamCloud::Profile.new(:id => "123", :title => "my_new_profile_title")
|
85
|
-
profile.title.should == "my_new_profile_title"
|
86
|
-
profile.reload
|
87
|
-
profile.id.should == "123"
|
88
|
-
profile.title.should == "my_profile"
|
89
|
-
end
|
90
|
-
|
91
|
-
it "shoud raise an exeception if it's a new object" do
|
92
|
-
profile = TelestreamCloud::Profile.new(:title => "my_new_profile_title")
|
93
|
-
lambda {
|
94
|
-
profile.reload
|
95
|
-
}.should raise_error("RecordNotFound")
|
96
|
-
end
|
97
|
-
|
98
|
-
it "shoud raise an exeception if it's a new object" do
|
99
|
-
profile_json = "{\"title\":\"my_profile\",\"id\":\"123\"}"
|
100
|
-
stub_http_request(:get, /api.example.com:85\/v3.0\/profiles\/123.json/).
|
101
|
-
to_return(:body => profile_json)
|
102
|
-
|
103
|
-
profile = TelestreamCloud::Profile.find(123)
|
104
|
-
profile.reload.should == profile
|
105
|
-
end
|
106
|
-
|
107
|
-
it "should not delegate scope if the method do not really exist in the scope" do
|
108
|
-
lambda {TelestreamCloud::Profile.reload}.should raise_error(NoMethodError)
|
109
|
-
lambda {TelestreamCloud::Profile.each}.should raise_error(NoMethodError)
|
110
|
-
lambda {TelestreamCloud::Profile.size}.should raise_error(NoMethodError)
|
111
|
-
end
|
112
|
-
|
113
|
-
it "should tell if profile is using a preset" do
|
114
|
-
TelestreamCloud::Profile.new(:title => "abc").preset?.should be_truthy
|
115
|
-
TelestreamCloud::Profile.new(:preset_name => "abc").preset?.should be_falsey
|
116
|
-
end
|
117
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
require 'telestream_cloud'
|
4
|
-
require 'rspec'
|
5
|
-
|
6
|
-
require 'webmock/rspec'
|
7
|
-
include WebMock::API
|
8
|
-
|
9
|
-
def hputs(*args)
|
10
|
-
puts ERB::Util.html_escape(args.join("\n")).gsub(/\r?\n/, '<br/>') + '<br/>'
|
11
|
-
end
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.before(:each) do
|
15
|
-
TelestreamCloud.instance_variable_set("@connection", nil)
|
16
|
-
TelestreamCloud.instance_variable_set("@factory", nil)
|
17
|
-
end
|
18
|
-
end
|
data/spec/uploader_spec.rb
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
shared_examples_for "uploader" do
|
4
|
-
let(:file_size) { 45_000_000 }
|
5
|
-
let(:file) do
|
6
|
-
double(:file,
|
7
|
-
path: '/foo/bar.mp4',
|
8
|
-
size: file_size
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
TelestreamCloud.configure do
|
14
|
-
access_key "my_access_key"
|
15
|
-
secret_key "my_secret_key"
|
16
|
-
api_host "api.example.com"
|
17
|
-
factory_id 'my_cloud_id'
|
18
|
-
api_port 85
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#upload' do
|
23
|
-
let(:part_size) { 10_000_000 }
|
24
|
-
let(:session_url) { 'http://api.example.com:1234/upload/session?id=1234' }
|
25
|
-
|
26
|
-
let(:video_json) do
|
27
|
-
"{\"id\":\"12345\"}"
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'with valid session' do
|
31
|
-
let(:session_json) do
|
32
|
-
"{\"id\":\"1234\",\"location\":\"#{session_url}\",\"parts\":\"5\",\"part_size\":\"#{part_size}\",\"max_connections\":\"16\"}"
|
33
|
-
end
|
34
|
-
|
35
|
-
before do
|
36
|
-
stub_request(:post, "http://api.example.com:85/v3.0/videos/upload.json")
|
37
|
-
.to_return(body: session_json)
|
38
|
-
|
39
|
-
expect(file).to receive(:read).with(part_size).and_return("chunk").exactly(4).times
|
40
|
-
expect(file).to receive(:read).with(file_size % part_size).and_return("chunk").once
|
41
|
-
|
42
|
-
5.times do |i|
|
43
|
-
expect(file).to receive(:seek).with(i * part_size)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'uploads file' do
|
48
|
-
stub_request(:put, session_url).with(headers: { "X-Part" => /[0-3]/ })
|
49
|
-
|
50
|
-
stub_request(:put, session_url)
|
51
|
-
.with(headers: { "X-Part" => 4 }, body: "chunk")
|
52
|
-
.to_return(body: "{\"id\":\"12345\"}")
|
53
|
-
|
54
|
-
|
55
|
-
subject.upload
|
56
|
-
expect(subject).to be_success
|
57
|
-
expect(subject.video).not_to be_nil
|
58
|
-
expect(subject.video.id).to eq("12345")
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'retries missing chunks' do
|
62
|
-
stub_request(:put, session_url)
|
63
|
-
stub_request(:put, session_url).with(headers: { "X-Part" => 3 })
|
64
|
-
.to_return({body: ""}).then.to_return({body: video_json})
|
65
|
-
|
66
|
-
stub_request(:get, session_url).to_return(body: JSON.generate(missing_parts: [3]))
|
67
|
-
|
68
|
-
expect(file).to receive(:read).with(part_size).and_return("chunk")
|
69
|
-
expect(file).to receive(:seek).with(3 * part_size)
|
70
|
-
|
71
|
-
subject.upload
|
72
|
-
|
73
|
-
expect(subject).to be_success
|
74
|
-
expect(subject.video).not_to be_nil
|
75
|
-
expect(subject.video.id).to eq("12345")
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'fails after few tries' do
|
79
|
-
stub_request(:put, session_url)
|
80
|
-
stub_request(:get, session_url).to_return(body: JSON.generate(missing_parts: [3]))
|
81
|
-
|
82
|
-
expect(file).to receive(:read).with(part_size).and_return("chunk").exactly(4).times
|
83
|
-
expect(file).to receive(:seek).with(3 * part_size).exactly(4).times
|
84
|
-
|
85
|
-
subject.upload
|
86
|
-
|
87
|
-
expect(subject.status).to eq(:failed)
|
88
|
-
expect(subject.video).to be_nil
|
89
|
-
expect(subject.error).to be_a(TelestreamCloud::Uploader::MissingPartError)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
context 'with invalid session' do
|
94
|
-
let(:session_json) do
|
95
|
-
"{\"error\":\"NotAuthorized\",\"message\":\"Message\"}"
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'fails' do
|
99
|
-
stub_request(:post, "http://api.example.com:85/v3.0/videos/upload.json")
|
100
|
-
.to_return(body: session_json)
|
101
|
-
|
102
|
-
subject.upload
|
103
|
-
|
104
|
-
expect(subject.status).to eq(:failed)
|
105
|
-
expect(subject.error).to be_a(TelestreamCloud::Uploader::UploadError)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe '.upload' do
|
111
|
-
it 'calls #upload' do
|
112
|
-
video = double(:video)
|
113
|
-
expect_any_instance_of(subject.class).to receive(:upload)
|
114
|
-
expect_any_instance_of(subject.class).to receive(:video).and_return(video)
|
115
|
-
|
116
|
-
expect(subject.class.upload(file: file)).to eq(video)
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'calls #upload with retries options' do
|
120
|
-
video = double(:video)
|
121
|
-
expect_any_instance_of(subject.class).to receive(:upload).with(5)
|
122
|
-
expect_any_instance_of(subject.class).to receive(:video).and_return(video)
|
123
|
-
|
124
|
-
expect(subject.class.upload(file: file, retries: 5)).to eq(video)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe TelestreamCloud::Uploader do
|
130
|
-
subject do
|
131
|
-
TelestreamCloud::Uploader.new(file: file)
|
132
|
-
end
|
133
|
-
|
134
|
-
it_behaves_like "uploader"
|
135
|
-
end
|
136
|
-
|
137
|
-
describe TelestreamCloud::ParallelUploader do
|
138
|
-
subject do
|
139
|
-
TelestreamCloud::ParallelUploader.new(file: file)
|
140
|
-
end
|
141
|
-
|
142
|
-
it_behaves_like "uploader"
|
143
|
-
end
|