wsc_sdk 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +146 -0
- data/.circleci/docker/build/Dockerfile +3 -0
- data/.circleci/helpers/add_preamble.rb +29 -0
- data/.circleci/helpers/build_docs.sh +5 -0
- data/.circleci/helpers/build_gem.sh +5 -0
- data/.circleci/helpers/debundle-context.sh +14 -0
- data/.circleci/helpers/finalize_release.sh +24 -0
- data/.circleci/helpers/publish_docs.sh +10 -0
- data/.circleci/helpers/release_gem.sh +8 -0
- data/.circleci/helpers/setup.sh +11 -0
- data/.circleci/helpers/setup_aws.sh +13 -0
- data/.circleci/helpers/setup_gem.sh +2 -0
- data/.circleci/helpers/setup_git.sh +27 -0
- data/.circleci/helpers/setup_rubygems.sh +15 -0
- data/.circleci/helpers/test_integration.sh +12 -0
- data/.circleci/helpers/test_unit.sh +6 -0
- data/.circleci/jobs/publish-production.sh +17 -0
- data/.circleci/jobs/publish-staging.sh +17 -0
- data/.circleci/jobs/release-production.sh +21 -0
- data/.circleci/jobs/test-integration.sh +9 -0
- data/.circleci/jobs/test-unit.sh +9 -0
- data/.circleci/tag_repo.rb +46 -0
- data/.gitignore +28 -0
- data/.rspec +2 -0
- data/.yard/config +2 -0
- data/.yard/template/default/fulldoc/html/css/custom.css +151 -0
- data/.yard/template/default/layout/html/footer.erb +0 -0
- data/.yard/template/default/layout/html/headers.erb +10 -0
- data/.yard/template/default/layout/html/layout.erb +45 -0
- data/.yard/template/default/layout/html/setup.rb +24 -0
- data/.yardopts +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +99 -0
- data/LICENSE.txt +28 -0
- data/README.md +397 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/Hash.html +291 -0
- data/doc/WscSdk.html +570 -0
- data/doc/WscSdk/ApiResponse.html +242 -0
- data/doc/WscSdk/Attributes.html +128 -0
- data/doc/WscSdk/Attributes/Mode.html +191 -0
- data/doc/WscSdk/Attributes/Type.html +389 -0
- data/doc/WscSdk/Client.html +2677 -0
- data/doc/WscSdk/Configuration.html +595 -0
- data/doc/WscSdk/Endpoint.html +2974 -0
- data/doc/WscSdk/Endpoints.html +141 -0
- data/doc/WscSdk/Endpoints/CustomStreamTargets.html +383 -0
- data/doc/WscSdk/Endpoints/LiveStreams.html +197 -0
- data/doc/WscSdk/Endpoints/OutputStreamTargets.html +180 -0
- data/doc/WscSdk/Endpoints/Outputs.html +180 -0
- data/doc/WscSdk/Endpoints/StreamTargets.html +446 -0
- data/doc/WscSdk/Endpoints/Transcoders.html +197 -0
- data/doc/WscSdk/Endpoints/UllStreamTargets.html +383 -0
- data/doc/WscSdk/Endpoints/WowzaStreamTargets.html +383 -0
- data/doc/WscSdk/Enum.html +225 -0
- data/doc/WscSdk/Enums.html +321 -0
- data/doc/WscSdk/Enums/BillingMode.html +188 -0
- data/doc/WscSdk/Enums/BroadcastLocation.html +396 -0
- data/doc/WscSdk/Enums/BufferSize.html +301 -0
- data/doc/WscSdk/Enums/ClosedCaptionType.html +221 -0
- data/doc/WscSdk/Enums/CustomProvider.html +252 -0
- data/doc/WscSdk/Enums/DeliveryMethod.html +188 -0
- data/doc/WscSdk/Enums/DeliveryType.html +188 -0
- data/doc/WscSdk/Enums/Encoder.html +460 -0
- data/doc/WscSdk/Enums/Errors.html +555 -0
- data/doc/WscSdk/Enums/IdleTimeout.html +398 -0
- data/doc/WscSdk/Enums/ImagePosition.html +220 -0
- data/doc/WscSdk/Enums/ModelMode.html +175 -0
- data/doc/WscSdk/Enums/ModelType.html +373 -0
- data/doc/WscSdk/Enums/PlayerType.html +188 -0
- data/doc/WscSdk/Enums/Protocol.html +204 -0
- data/doc/WscSdk/Enums/TargetDeliveryProtocol.html +188 -0
- data/doc/WscSdk/Enums/TranscoderType.html +188 -0
- data/doc/WscSdk/Enums/UserRegion.html +383 -0
- data/doc/WscSdk/Enums/WowzaProvider.html +188 -0
- data/doc/WscSdk/Errors.html +683 -0
- data/doc/WscSdk/Loggable.html +346 -0
- data/doc/WscSdk/Model.html +3316 -0
- data/doc/WscSdk/ModelList.html +442 -0
- data/doc/WscSdk/ModelTemplate.html +267 -0
- data/doc/WscSdk/Models.html +141 -0
- data/doc/WscSdk/Models/CustomStreamTarget.html +192 -0
- data/doc/WscSdk/Models/Error.html +351 -0
- data/doc/WscSdk/Models/LiveStream.html +601 -0
- data/doc/WscSdk/Models/LiveStreamConnectionCode.html +192 -0
- data/doc/WscSdk/Models/LiveStreamState.html +200 -0
- data/doc/WscSdk/Models/LiveStreamStats.html +200 -0
- data/doc/WscSdk/Models/LiveStreamThumbnailUrl.html +200 -0
- data/doc/WscSdk/Models/Output.html +294 -0
- data/doc/WscSdk/Models/OutputStreamTarget.html +274 -0
- data/doc/WscSdk/Models/StreamTarget.html +273 -0
- data/doc/WscSdk/Models/Transcoder.html +793 -0
- data/doc/WscSdk/Models/TranscoderBooleanStat.html +278 -0
- data/doc/WscSdk/Models/TranscoderConnectionCode.html +192 -0
- data/doc/WscSdk/Models/TranscoderFloatStat.html +278 -0
- data/doc/WscSdk/Models/TranscoderIntegerStat.html +278 -0
- data/doc/WscSdk/Models/TranscoderState.html +196 -0
- data/doc/WscSdk/Models/TranscoderStats.html +196 -0
- data/doc/WscSdk/Models/TranscoderStreamTargetState.html +192 -0
- data/doc/WscSdk/Models/TranscoderStringStat.html +278 -0
- data/doc/WscSdk/Models/TranscoderThumbnailUrl.html +196 -0
- data/doc/WscSdk/Models/UllStreamTarget.html +360 -0
- data/doc/WscSdk/Models/WowzaStreamTarget.html +380 -0
- data/doc/WscSdk/Pagination.html +1277 -0
- data/doc/WscSdk/Schema.html +861 -0
- data/doc/WscSdk/SchemaAttribute.html +2400 -0
- data/doc/WscSdk/Templates.html +141 -0
- data/doc/WscSdk/Templates/CustomStreamTarget.html +1045 -0
- data/doc/WscSdk/Templates/LiveStream.html +1432 -0
- data/doc/WscSdk/Templates/Output.html +829 -0
- data/doc/WscSdk/Templates/Transcoder.html +699 -0
- data/doc/WscSdk/Templates/UllStreamTarget.html +411 -0
- data/doc/WscSdk/Templates/WowzaStreamTarget.html +447 -0
- data/doc/WscSdk/TranscoderSharedMethods.html +1113 -0
- data/doc/_index.html +705 -0
- data/doc/class_list.html +51 -0
- data/doc/css/bootstrap.css +5 -0
- data/doc/css/common.css +1 -0
- data/doc/css/custom.css +151 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +570 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/images/wsc-ruby-1800x400.png +0 -0
- data/doc/index.html +570 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1731 -0
- data/doc/top-level-namespace.html +182 -0
- data/examples/client.rb +40 -0
- data/examples/helpers.rb +100 -0
- data/examples/live_streams/create.rb +39 -0
- data/examples/live_streams/delete.rb +32 -0
- data/examples/live_streams/find.rb +22 -0
- data/examples/live_streams/flood.rb +126 -0
- data/examples/live_streams/list.rb +24 -0
- data/examples/live_streams/regenerate_connection_code.rb +29 -0
- data/examples/live_streams/reset.rb +32 -0
- data/examples/live_streams/reset_and_wait.rb +51 -0
- data/examples/live_streams/start.rb +33 -0
- data/examples/live_streams/start_and_wait.rb +51 -0
- data/examples/live_streams/state.rb +33 -0
- data/examples/live_streams/stats.rb +43 -0
- data/examples/live_streams/stop.rb +33 -0
- data/examples/live_streams/stop_and_wait.rb +51 -0
- data/examples/live_streams/thumbnail_url.rb +46 -0
- data/examples/live_streams/update.rb +43 -0
- data/examples/live_streams/workflow.rb +165 -0
- data/examples/output_stream_targets/create.rb +56 -0
- data/examples/output_stream_targets/delete.rb +45 -0
- data/examples/output_stream_targets/find.rb +37 -0
- data/examples/output_stream_targets/list.rb +36 -0
- data/examples/output_stream_targets/update.rb +56 -0
- data/examples/outputs/create.rb +49 -0
- data/examples/outputs/delete.rb +39 -0
- data/examples/outputs/find.rb +31 -0
- data/examples/outputs/list.rb +29 -0
- data/examples/outputs/update.rb +50 -0
- data/examples/stream_targets/custom/create.rb +42 -0
- data/examples/stream_targets/custom/delete.rb +31 -0
- data/examples/stream_targets/custom/find.rb +23 -0
- data/examples/stream_targets/custom/list.rb +24 -0
- data/examples/stream_targets/custom/update.rb +43 -0
- data/examples/stream_targets/list.rb +24 -0
- data/examples/stream_targets/ull/create.rb +41 -0
- data/examples/stream_targets/ull/delete.rb +31 -0
- data/examples/stream_targets/ull/find.rb +23 -0
- data/examples/stream_targets/ull/list.rb +24 -0
- data/examples/stream_targets/ull/update.rb +43 -0
- data/examples/stream_targets/wowza/create.rb +42 -0
- data/examples/stream_targets/wowza/delete.rb +31 -0
- data/examples/stream_targets/wowza/find.rb +23 -0
- data/examples/stream_targets/wowza/list.rb +23 -0
- data/examples/stream_targets/wowza/update.rb +43 -0
- data/examples/transcoders/create.rb +39 -0
- data/examples/transcoders/delete.rb +31 -0
- data/examples/transcoders/find.rb +23 -0
- data/examples/transcoders/list.rb +24 -0
- data/examples/transcoders/reset.rb +32 -0
- data/examples/transcoders/reset_and_wait.rb +48 -0
- data/examples/transcoders/start.rb +33 -0
- data/examples/transcoders/start_and_wait.rb +50 -0
- data/examples/transcoders/state.rb +33 -0
- data/examples/transcoders/stats.rb +43 -0
- data/examples/transcoders/stop.rb +33 -0
- data/examples/transcoders/stop_and_wait.rb +50 -0
- data/examples/transcoders/thumbnail_url.rb +46 -0
- data/examples/transcoders/update.rb +43 -0
- data/images/wsc-ruby-1800x400.png +0 -0
- data/lib/wsc_sdk.rb +81 -0
- data/lib/wsc_sdk/client.rb +417 -0
- data/lib/wsc_sdk/configuration.rb +21 -0
- data/lib/wsc_sdk/constants.rb +29 -0
- data/lib/wsc_sdk/endpoint.rb +492 -0
- data/lib/wsc_sdk/endpoints/custom_stream_targets.rb +44 -0
- data/lib/wsc_sdk/endpoints/live_streams.rb +34 -0
- data/lib/wsc_sdk/endpoints/output_stream_targets.rb +17 -0
- data/lib/wsc_sdk/endpoints/outputs.rb +17 -0
- data/lib/wsc_sdk/endpoints/stream_targets.rb +45 -0
- data/lib/wsc_sdk/endpoints/transcoders.rb +38 -0
- data/lib/wsc_sdk/endpoints/ull_stream_targets.rb +44 -0
- data/lib/wsc_sdk/endpoints/wowza_stream_targets.rb +44 -0
- data/lib/wsc_sdk/enums.rb +31 -0
- data/lib/wsc_sdk/enums/billing_mode.rb +20 -0
- data/lib/wsc_sdk/enums/broadcast_location.rb +58 -0
- data/lib/wsc_sdk/enums/buffer_size.rb +41 -0
- data/lib/wsc_sdk/enums/closed_caption_type.rb +26 -0
- data/lib/wsc_sdk/enums/custom_provider.rb +32 -0
- data/lib/wsc_sdk/enums/delivery_method.rb +20 -0
- data/lib/wsc_sdk/enums/delivery_type.rb +20 -0
- data/lib/wsc_sdk/enums/encoder.rb +71 -0
- data/lib/wsc_sdk/enums/idle_timeout.rb +50 -0
- data/lib/wsc_sdk/enums/image_position.rb +26 -0
- data/lib/wsc_sdk/enums/player_type.rb +20 -0
- data/lib/wsc_sdk/enums/protocol.rb +23 -0
- data/lib/wsc_sdk/enums/target_delivery_protocol.rb +20 -0
- data/lib/wsc_sdk/enums/transcoder_type.rb +20 -0
- data/lib/wsc_sdk/enums/wowza_provider.rb +20 -0
- data/lib/wsc_sdk/errors.rb +115 -0
- data/lib/wsc_sdk/model.rb +515 -0
- data/lib/wsc_sdk/model_list.rb +42 -0
- data/lib/wsc_sdk/model_template.rb +27 -0
- data/lib/wsc_sdk/models/custom_stream_target.rb +34 -0
- data/lib/wsc_sdk/models/error.rb +53 -0
- data/lib/wsc_sdk/models/live_stream.rb +130 -0
- data/lib/wsc_sdk/models/live_stream_connection_code.rb +31 -0
- data/lib/wsc_sdk/models/live_stream_state.rb +20 -0
- data/lib/wsc_sdk/models/live_stream_stats.rb +20 -0
- data/lib/wsc_sdk/models/live_stream_thumbnail_url.rb +20 -0
- data/lib/wsc_sdk/models/output.rb +61 -0
- data/lib/wsc_sdk/models/output_stream_target.rb +37 -0
- data/lib/wsc_sdk/models/stream_target.rb +29 -0
- data/lib/wsc_sdk/models/transcoder.rb +135 -0
- data/lib/wsc_sdk/models/transcoder_boolean_stat.rb +41 -0
- data/lib/wsc_sdk/models/transcoder_connection_code.rb +29 -0
- data/lib/wsc_sdk/models/transcoder_float_stat.rb +40 -0
- data/lib/wsc_sdk/models/transcoder_integer_stat.rb +40 -0
- data/lib/wsc_sdk/models/transcoder_state.rb +31 -0
- data/lib/wsc_sdk/models/transcoder_stats.rb +51 -0
- data/lib/wsc_sdk/models/transcoder_stream_target_state.rb +29 -0
- data/lib/wsc_sdk/models/transcoder_string_stat.rb +40 -0
- data/lib/wsc_sdk/models/transcoder_thumbnail_url.rb +29 -0
- data/lib/wsc_sdk/models/ull_stream_target.rb +54 -0
- data/lib/wsc_sdk/models/wowza_stream_target.rb +60 -0
- data/lib/wsc_sdk/modules/api_response.rb +24 -0
- data/lib/wsc_sdk/modules/loggable.rb +44 -0
- data/lib/wsc_sdk/modules/transcoder_shared_methods.rb +221 -0
- data/lib/wsc_sdk/pagination.rb +89 -0
- data/lib/wsc_sdk/schema.rb +140 -0
- data/lib/wsc_sdk/schema_attribute.rb +349 -0
- data/lib/wsc_sdk/templates/custom_stream_target.rb +154 -0
- data/lib/wsc_sdk/templates/live_stream.rb +234 -0
- data/lib/wsc_sdk/templates/output.rb +133 -0
- data/lib/wsc_sdk/templates/transcoder.rb +97 -0
- data/lib/wsc_sdk/templates/ull_stream_target.rb +49 -0
- data/lib/wsc_sdk/templates/wowza_stream_target.rb +57 -0
- data/lib/wsc_sdk/version.rb +7 -0
- data/wsc_sdk.gemspec +48 -0
- metadata +460 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Get our client
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, pagination_page: 1, pagination_per_page: 25)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
stream_targets_ull = $client.stream_targets.ull
|
13
|
+
page = arguments[0] # First argument is the page number (default: 1)
|
14
|
+
per_page = arguments[1] # Second argument is the items per page (default: 25, max: 1000)
|
15
|
+
|
16
|
+
# Request the list of stream_targets_wowza using pagination
|
17
|
+
list = stream_targets_ull.list(pagination: { page: page.to_i, per_page: per_page.to_i })
|
18
|
+
|
19
|
+
# Handle an API error (in the helpers.rb file)
|
20
|
+
handle_api_error(list, "There was an error retrieving the list of the Wowza stream targets") unless list.success?
|
21
|
+
|
22
|
+
# Output the list of stream_targets_wowza
|
23
|
+
# Defined in helpers.rb
|
24
|
+
output_model_list(list, "Ull Stream Targets: #{list.keys.length}", true, :name)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Get our client
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, ull_stream_target_id: nil, new_stream_target_name: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
ull_stream_targets = $client.stream_targets.ull
|
13
|
+
ull_stream_target_id = arguments[0]
|
14
|
+
name = arguments[1]
|
15
|
+
|
16
|
+
# Request the ull_stream_target object
|
17
|
+
ull_stream_target = ull_stream_targets.find(ull_stream_target_id)
|
18
|
+
|
19
|
+
# Handle an API error (in the helpers.rb file)
|
20
|
+
handle_api_error(ull_stream_target, "There was an error finding the ull stream target") unless ull_stream_target.success?
|
21
|
+
|
22
|
+
# Update the ull_stream_target
|
23
|
+
ull_stream_target.name = name
|
24
|
+
|
25
|
+
# If the ull_stream_target is invalid, output the messages and exit
|
26
|
+
unless (ull_stream_target.valid?)
|
27
|
+
puts "Ull Stream Target is invalid:"
|
28
|
+
|
29
|
+
ull_stream_target.errors.each do |field, message|
|
30
|
+
puts " - #{field}: #{message}"
|
31
|
+
end
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
# Get the result of saving the object to the API
|
36
|
+
saved = ull_stream_target.save
|
37
|
+
|
38
|
+
# Handle an API error (in the helpers.rb file)
|
39
|
+
handle_api_error(saved, "There was an error saving the ull stream target") unless saved.success?
|
40
|
+
|
41
|
+
# Output the ull_stream_target details
|
42
|
+
# Defined in helpers.rb
|
43
|
+
output_model_attributes(ull_stream_target, "Ull Stream Target: #{ull_stream_target.name}")
|
@@ -0,0 +1,42 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Include our client configuration
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present.
|
9
|
+
arguments = ask_for_arguments(__FILE__, stream_target_name: nil, use_secure_ingest: false, use_cors: false)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
wowza_stream_targets = $client.stream_targets.wowza
|
13
|
+
|
14
|
+
# Build a RTMP/pull wowza_stream_target using a predefined template, and modify a
|
15
|
+
# few values
|
16
|
+
name = arguments[0]
|
17
|
+
secure_ingest = arguments[1].to_s.downcase.start_with?("t","y","1")
|
18
|
+
cors = arguments[2].to_s.downcase.start_with?("t","y","1")
|
19
|
+
wowza_stream_target_data = WscSdk::Templates::WowzaStreamTarget.akamai_cupertino(name, secure_ingest, cors)
|
20
|
+
|
21
|
+
# Build the wowza_stream_target object
|
22
|
+
wowza_stream_target = wowza_stream_targets.build(wowza_stream_target_data)
|
23
|
+
|
24
|
+
# If the wowza_stream_target is invalid, output the messages and exit
|
25
|
+
unless (wowza_stream_target.valid?)
|
26
|
+
puts "Wowza Stream Target is invalid:"
|
27
|
+
|
28
|
+
wowza_stream_target.errors.each do |field, message|
|
29
|
+
puts " - #{field}: #{message}"
|
30
|
+
end
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get the result of saving the object to the API
|
35
|
+
saved = wowza_stream_target.save
|
36
|
+
|
37
|
+
# Handle an API error (in the helpers.rb file)
|
38
|
+
handle_api_error(saved, "There was an error creating the wowza stream target") unless saved.success?
|
39
|
+
|
40
|
+
# Output the wowza stream target
|
41
|
+
# Defined in helpers.rb
|
42
|
+
output_model_attributes(wowza_stream_target, "Wowza Stream Target: #{wowza_stream_target.name}")
|
@@ -0,0 +1,31 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Get our client
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, wowza_stream_target_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
wowza_stream_targets = $client.stream_targets.wowza
|
13
|
+
wowza_stream_target_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the wowza_stream_target object
|
16
|
+
wowza_stream_target = wowza_stream_targets.find(wowza_stream_target_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(wowza_stream_target, "There was an error finding the wowza stream target") unless wowza_stream_target.success?
|
20
|
+
|
21
|
+
# Get the result of deleting the object from the API
|
22
|
+
deleted = wowza_stream_target.delete
|
23
|
+
|
24
|
+
# Handle an API error (in the helpers.rb file)
|
25
|
+
handle_api_error(deleted, "There was an error deleting the wowza stream target") unless deleted.success?
|
26
|
+
|
27
|
+
# If we've successfully deleted the wowza_stream_target, then output the details.
|
28
|
+
# Note that the data for the output still exists locally in the SDK, however the
|
29
|
+
# ID has been removed since it no longer references a valid record in the API.
|
30
|
+
# Defined in helpers.rb
|
31
|
+
output_model_attributes(wowza_stream_target, "Wowza Stream Target: #{wowza_stream_target.name}")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Get our client
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, wowza_stream_target_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
wowza_stream_targets = $client.stream_targets.wowza
|
13
|
+
wowza_stream_target_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the transcoder object
|
16
|
+
wowza_stream_target = wowza_stream_targets.find(wowza_stream_target_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(wowza_stream_target, "There was an error finding the Wowza stream target") unless wowza_stream_target.success?
|
20
|
+
|
21
|
+
# Output the wowza stream target
|
22
|
+
# Defined in helpers.rb
|
23
|
+
output_model_attributes(wowza_stream_target, "Wowza Stream Target: #{wowza_stream_target.name}")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Get our client
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, pagination_page: 1, pagination_per_page: 25)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
stream_targets_wowza = $client.stream_targets.wowza
|
13
|
+
page = arguments[0] # First argument is the page number (default: 1)
|
14
|
+
per_page = arguments[1] # Second argument is the items per page (default: 25, max: 1000)
|
15
|
+
|
16
|
+
# Request the list of stream_targets_wowza using pagination
|
17
|
+
list = stream_targets_wowza.list(pagination: { page: page.to_i, per_page: per_page.to_i })
|
18
|
+
|
19
|
+
# Handle an API error (in the helpers.rb file)
|
20
|
+
handle_api_error(list, "There was an error retrieving the list of the Wowza stream targets") unless list.success?
|
21
|
+
|
22
|
+
# Output the list of stream_targets_wowza
|
23
|
+
output_model_list(list, "Wowza Stream Targets: #{list.keys.length}", true, :name)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../../client" # Get our client
|
6
|
+
require_relative "../../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, wowza_stream_target_id: nil, new_stream_target_name: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
wowza_stream_targets = $client.stream_targets.wowza
|
13
|
+
wowza_stream_target_id = arguments[0]
|
14
|
+
name = arguments[1]
|
15
|
+
|
16
|
+
# Request the wowza_stream_target object
|
17
|
+
wowza_stream_target = wowza_stream_targets.find(wowza_stream_target_id)
|
18
|
+
|
19
|
+
# Handle an API error (in the helpers.rb file)
|
20
|
+
handle_api_error(wowza_stream_target, "There was an error finding the wowza stream target") unless wowza_stream_target.success?
|
21
|
+
|
22
|
+
# Update the wowza_stream_target
|
23
|
+
wowza_stream_target.name = name
|
24
|
+
|
25
|
+
# If the wowza_stream_target is invalid, output the messages and exit
|
26
|
+
unless (wowza_stream_target.valid?)
|
27
|
+
puts "Wowza Stream Target is invalid:"
|
28
|
+
|
29
|
+
wowza_stream_target.errors.each do |field, message|
|
30
|
+
puts " - #{field}: #{message}"
|
31
|
+
end
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
# Get the result of saving the object to the API
|
36
|
+
saved = wowza_stream_target.save
|
37
|
+
|
38
|
+
# Handle an API error (in the helpers.rb file)
|
39
|
+
handle_api_error(saved, "There was an error saving the wowza stream target") unless saved.success?
|
40
|
+
|
41
|
+
# Output the wowza_stream_target details
|
42
|
+
# Defined in helpers.rb
|
43
|
+
output_model_attributes(wowza_stream_target, "Wowza Stream Target: #{wowza_stream_target.name}")
|
@@ -0,0 +1,39 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Include our client configuration
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
arguments = ask_for_arguments(__FILE__, transcoder_name: nil, source_url: nil)
|
9
|
+
|
10
|
+
# Extract some data into convenience variables
|
11
|
+
transcoders = $client.transcoders
|
12
|
+
name = arguments[0]
|
13
|
+
source_url = arguments[1]
|
14
|
+
|
15
|
+
# Build a RTMP/pull transcoder using a predefined template.
|
16
|
+
transcoder_data = WscSdk::Templates::Transcoder.rtmp_pull(name, source_url)
|
17
|
+
|
18
|
+
# Build the transcoder object
|
19
|
+
transcoder = transcoders.build(transcoder_data)
|
20
|
+
|
21
|
+
# If the transcoder is invalid, output the messages and exit
|
22
|
+
unless (transcoder.valid?)
|
23
|
+
puts "Transcoder is invalid:"
|
24
|
+
|
25
|
+
transcoder.errors.each do |field, message|
|
26
|
+
puts " - #{field}: #{message}"
|
27
|
+
end
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get the result of saving the object to the API
|
32
|
+
saved = transcoder.save
|
33
|
+
|
34
|
+
# Handle an API error (in the helpers.rb file)
|
35
|
+
handle_api_error(saved, "There was an error creating the transcoder") unless saved.success?
|
36
|
+
|
37
|
+
# Output the transcoder details
|
38
|
+
# Defined in helpers.rb
|
39
|
+
output_model_attributes(transcoder, "Transcoder: #{transcoder.name}")
|
@@ -0,0 +1,31 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Get our client
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, transcoder_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
transcoders = $client.transcoders
|
13
|
+
transcoder_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the transcoder object
|
16
|
+
transcoder = transcoders.find(transcoder_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(transcoder, "There was an error finding the transcoder") unless transcoder.success?
|
20
|
+
|
21
|
+
# Get the result of deleting the object from the API
|
22
|
+
deleted = transcoder.delete
|
23
|
+
|
24
|
+
# Handle an API error (in the helpers.rb file)
|
25
|
+
handle_api_error(deleted, "There was an error deleting the transcoder") unless deleted.success?
|
26
|
+
|
27
|
+
# If we've successfully deleted the transcoder then output the details.
|
28
|
+
# Note that the data for the output still exists locally in the SDK, however the
|
29
|
+
# ID has been removed since it no longer references a valid record in the API.
|
30
|
+
# Defined in helpers.rb
|
31
|
+
output_model_attributes(transcoder, "Transcoder: #{transcoder.name}")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Get our client
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, transcoder_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
transcoders = $client.transcoders
|
13
|
+
transcoder_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the transcoder object
|
16
|
+
transcoder = transcoders.find(transcoder_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(transcoder, "There was an error finding the transcoder") unless transcoder.success?
|
20
|
+
|
21
|
+
# Output transcoder details
|
22
|
+
# Defined in helpers.rb
|
23
|
+
output_model_attributes(transcoder, "Transcoder: #{transcoder.name}")
|
@@ -0,0 +1,24 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Get our client
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, pagination_page: 1, pagination_per_page: 25)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
transcoders = $client.transcoders
|
13
|
+
page = arguments[0] # First argument is the page number (default: 1)
|
14
|
+
per_page = arguments[1] # Second argument is the items per page (default: 25, max: 1000)
|
15
|
+
|
16
|
+
# Request the list of transcoders using pagination
|
17
|
+
list = transcoders.list(pagination: { page: page.to_i, per_page: per_page.to_i })
|
18
|
+
|
19
|
+
# Handle an API error (in the helpers.rb file)
|
20
|
+
handle_api_error(list, "There was an error retrieving the list of transcoders") unless list.success?
|
21
|
+
|
22
|
+
# Output the list of transcoders
|
23
|
+
# Define in helpers.rb
|
24
|
+
output_model_list(list, "Transcoders: #{list.keys.length}", true, :name)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Get our client
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, transcoder_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
transcoders = $client.transcoders
|
13
|
+
transcoder_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the transcoder object
|
16
|
+
transcoder = transcoders.find(transcoder_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(transcoder, "There was an error finding the transcoder") unless transcoder.success?
|
20
|
+
|
21
|
+
# Get the result of resetting the transcoder
|
22
|
+
#
|
23
|
+
# NOTE: You can also reset and wait for the transcoder state to transition to
|
24
|
+
# a reset state. See the `reset_and_wait` example.
|
25
|
+
state = transcoder.reset
|
26
|
+
|
27
|
+
# Handle an API error (in the helpers.rb file)
|
28
|
+
handle_api_error(state, "There was an error resetting the transcoder") unless state.success?
|
29
|
+
|
30
|
+
# Output the transcoder state
|
31
|
+
# Defined in helpers.rb
|
32
|
+
output_model_attributes(state, "Transcoder State:")
|
@@ -0,0 +1,48 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Get our client
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, transcoder_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
transcoders = $client.transcoders
|
13
|
+
transcoder_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the transcoder object
|
16
|
+
transcoder = transcoders.find(transcoder_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(transcoder, "There was an error finding the transcoder") unless transcoder.success?
|
20
|
+
|
21
|
+
# Get the result of resetting the transcoder. We add a code block, which
|
22
|
+
# instructs the SDK to enter a wait loop and periodically polls the API
|
23
|
+
# for the transcoder state until either the `started` state is returned or
|
24
|
+
# the timeout period is reached.
|
25
|
+
state = transcoder.reset do |wait_state, transcoder_state|
|
26
|
+
# This code will execute each time the state of the transcoder is polled
|
27
|
+
# during the wait loop. You can check the wait_state to determine what the
|
28
|
+
# outcomes of each request are.
|
29
|
+
|
30
|
+
if wait_state == :waiting
|
31
|
+
# We're still waiting for the started state to be returned
|
32
|
+
puts "Waiting..."
|
33
|
+
elsif wait_state == :complete
|
34
|
+
# We've successfully reset the transcoder, so output the completed state
|
35
|
+
# Defined in helpers.rb
|
36
|
+
output_model_attributes(transcoder_state, "Completed Transcoder State:")
|
37
|
+
elsif wait_state == :timeout
|
38
|
+
# A timeout occurs if the reset state isn't reached within the timeout
|
39
|
+
# limit, which defaults to 30 seconds.
|
40
|
+
|
41
|
+
puts "TIMEOUT: Could not reset the transcoder within the timeout period."
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Handle an API error (in the helpers.rb file)
|
46
|
+
handle_api_error(state, "There was an error starting the transcoder") unless state.success?
|
47
|
+
|
48
|
+
output_model_attributes(state, "Final Transcoder State:")
|
@@ -0,0 +1,33 @@
|
|
1
|
+
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved.
|
2
|
+
####> This code is licensed pursuant to the BSD 3-Clause License.
|
3
|
+
|
4
|
+
require "wsc_sdk"
|
5
|
+
require_relative "../client" # Get our client
|
6
|
+
require_relative "../helpers" # Include some helpers to make the code more direct
|
7
|
+
|
8
|
+
# Ensure the args passed in are present
|
9
|
+
arguments = ask_for_arguments(__FILE__, transcoder_id: nil)
|
10
|
+
|
11
|
+
# Extract some data into convenience variables
|
12
|
+
transcoders = $client.transcoders
|
13
|
+
transcoder_id = arguments[0]
|
14
|
+
|
15
|
+
# Request the transcoder object
|
16
|
+
transcoder = transcoders.find(transcoder_id)
|
17
|
+
|
18
|
+
# Handle an API error (in the helpers.rb file)
|
19
|
+
handle_api_error(transcoder, "There was an error finding the transcoder") unless transcoder.success?
|
20
|
+
|
21
|
+
# Get the result of starting the transcoder
|
22
|
+
#
|
23
|
+
# NOTE: You can also start and wait for the transcoder state to transition to
|
24
|
+
# a started state. See the `start_and_wait` example.
|
25
|
+
#
|
26
|
+
state = transcoder.start
|
27
|
+
|
28
|
+
# Handle an API error (in the helpers.rb file)
|
29
|
+
handle_api_error(state, "There was an error starting the transcoder") unless state.success?
|
30
|
+
|
31
|
+
# Output the transcoder state
|
32
|
+
# Defined in helpers.rb
|
33
|
+
output_model_attributes(state, "Transcoder State:")
|