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
data/LICENSE.txt
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Copyright © 2019 , Wowza Media Systems, LLC.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification,
|
4
|
+
are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
this list of conditions and the following disclaimer.
|
8
|
+
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
14
|
+
may be used to endorse or promote products derived from this software without
|
15
|
+
specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
20
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
21
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
27
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
|
data/README.md
ADDED
@@ -0,0 +1,397 @@
|
|
1
|
+
![wowza streaming cloud ruby sdk logo](images/wsc-ruby-1800x400.png)
|
2
|
+
|
3
|
+
# Wowza Streaming Cloud Ruby SDK
|
4
|
+
|
5
|
+
Welcome to the official Wowza Streaming Cloud Ruby SDK (WscSdk). We help developers bring live streaming into their applications - for any size audience, anywhere in the world. This SDK leverages the Wowza Streaming Cloud REST API to programmatically control live streams, transcoders, outputs, and stream targets.
|
6
|
+
|
7
|
+
Need the basics? Get to know [Wowza Streaming Cloud](https://www.wowza.com/products/streaming-cloud).
|
8
|
+
|
9
|
+
### SDK version
|
10
|
+
|
11
|
+
v1.3.0 (references Wowza Streaming Cloud REST API version 1.3)
|
12
|
+
|
13
|
+
## Contents
|
14
|
+
|
15
|
+
- [Features](#features)
|
16
|
+
- [Installation](#installation)
|
17
|
+
- [Start building](#start-building)
|
18
|
+
- [Get your API key and generate an access key](#get-your-api-key-and-generate-an-access-key)
|
19
|
+
- [Create a client](#create-a-client)
|
20
|
+
- [Access endpoints](#access-endpoints)
|
21
|
+
- [Use templates](#use-templates)
|
22
|
+
- [Manage Lists](#managing-lists)
|
23
|
+
- [Error Handling](#error-handling)
|
24
|
+
- [Access the entire Wowza Streaming Cloud REST API](#access-the-entire-wowza-streaming-cloud-rest-api)
|
25
|
+
- [SDK examples](#sdk-examples)
|
26
|
+
- [Documentation](#documentation)
|
27
|
+
- [Contribute](#contribute)
|
28
|
+
- [Feedback](#feedback)
|
29
|
+
- [Support](#support)
|
30
|
+
- [Code of conduct](#code-of-conduct)
|
31
|
+
- [License](#license)
|
32
|
+
|
33
|
+
|
34
|
+
## Features
|
35
|
+
|
36
|
+
This SDK represents a subset of the features available in the Wowza Streaming Cloud REST API.
|
37
|
+
|
38
|
+
* Live streams
|
39
|
+
* Transcoders
|
40
|
+
* Outputs
|
41
|
+
* Stream targets
|
42
|
+
|
43
|
+
To add functionality related to players, stream sources, recordings, schedules, and usage metrics, see [Access the entire Wowza Streaming Cloud REST API](#access-the-entire-wowza-streaming-cloud-rest-api).
|
44
|
+
|
45
|
+
|
46
|
+
## Installation
|
47
|
+
|
48
|
+
### Prerequisites
|
49
|
+
|
50
|
+
* Ruby version 2.3 or higher
|
51
|
+
* Access to the Wowza Streaming Cloud service. You can start with our [free trial](https://www.wowza.com/pricing/cloud-developer-free-trial).
|
52
|
+
|
53
|
+
|
54
|
+
### Install the SDK
|
55
|
+
|
56
|
+
To use [RubyGems](https://rubygems.org/) for installation, add this line to your application's Gemfile:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
gem 'wsc_sdk', '~> 1.3.1'
|
60
|
+
```
|
61
|
+
|
62
|
+
And then execute:
|
63
|
+
|
64
|
+
```bash
|
65
|
+
$ bundle
|
66
|
+
```
|
67
|
+
|
68
|
+
|
69
|
+
Or install it yourself using:
|
70
|
+
|
71
|
+
```bash
|
72
|
+
$ gem install wsc_sdk
|
73
|
+
```
|
74
|
+
|
75
|
+
## Start building
|
76
|
+
|
77
|
+
### Get your API key and generate an access key
|
78
|
+
|
79
|
+
Start by getting an API key and access key to authenticate requests. You'll find them in the Wowza Streaming Cloud user interface.
|
80
|
+
|
81
|
+
1. Sign in to [Wowza Streaming Cloud](https://cloud.wowza.com).
|
82
|
+
|
83
|
+
2. In the menu bar, click your user name and choose **API Access**.
|
84
|
+
|
85
|
+
See [Locate an API key and generate an access key](https://www.wowza.com/docs/how-to-use-the-wowza-streaming-cloud-rest-api#keys) for more information.
|
86
|
+
|
87
|
+
### Create a client
|
88
|
+
|
89
|
+
To perform any SDK functions or API requests, start by creating an instance of of the `WscSdk::Client` object. This object requires your API key and access key. It handles all of the requirements for formulating a valid API request, and it gives you access to functions for listing, finding, creating, updating, and deleting models in the Wowza Streaming Cloud REST API.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
require 'wsc_sdk'
|
93
|
+
|
94
|
+
WscSdk.configure do |config|
|
95
|
+
config.api_key = "[your API key]"
|
96
|
+
config.access_key = "[your access key]"
|
97
|
+
config.logger = ::Logger.new(STDOUT)
|
98
|
+
end
|
99
|
+
|
100
|
+
client = WscSdk.client
|
101
|
+
```
|
102
|
+
#### Set up environment variables
|
103
|
+
|
104
|
+
For higher levels of security, and to keep sensitive keys out of your repositories, you can use environment variables to configure your clients.
|
105
|
+
|
106
|
+
In a terminal you can establish the environment variables like this:
|
107
|
+
|
108
|
+
```bash
|
109
|
+
export WSC_API_KEY=[your-api-key]
|
110
|
+
export WSC_API_ACCESS_KEY=[your-api-access-key]
|
111
|
+
```
|
112
|
+
|
113
|
+
Then your configuration block can be setup like this:
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
require 'wsc_sdk'
|
117
|
+
|
118
|
+
WscSdk.configure do |config|
|
119
|
+
config.api_key = ENV["WSC_API_KEY"]
|
120
|
+
config.access_key = ENV["WSC_API_ACCESS_KEY"]
|
121
|
+
config.logger = ::Logger.new(STDOUT)
|
122
|
+
end
|
123
|
+
|
124
|
+
client = WscSdk.client
|
125
|
+
```
|
126
|
+
|
127
|
+
#### Using the sandbox for testing
|
128
|
+
|
129
|
+
Wowza Streaming Cloud has a sandbox environment you can use for testing your code without incurring charges on your account.
|
130
|
+
|
131
|
+
You can switch the hostname of the SDK to point the sandbox server for testing using this configuration:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
require 'wsc_sdk'
|
135
|
+
|
136
|
+
WscSdk.configure do |config|
|
137
|
+
config.api_key = "[your sandbox API key]"
|
138
|
+
config.access_key = "[your sandbox access key]"
|
139
|
+
config.logger = ::Logger.new(STDOUT)
|
140
|
+
conifg.hostname = WscSdk::SANDBOX_HOSTNAME
|
141
|
+
end
|
142
|
+
|
143
|
+
client = WscSdk.client
|
144
|
+
```
|
145
|
+
|
146
|
+
### Access endpoints
|
147
|
+
|
148
|
+
You can access the controls for managing a model through endpoints. An endpoint is typically named for the model you're managing, but in plural form.
|
149
|
+
|
150
|
+
For example, you manage the `WscSdk::Models::Transcoder` model through the `WscSdk::Endpoints::Transcoders` endpoint.
|
151
|
+
|
152
|
+
You can access endpoints through the [client](#create-a-client) object.
|
153
|
+
|
154
|
+
Using the `transcoders` example, you can access functionality to manage models like this:
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
# Assign the transcoders endpoint to a variable
|
158
|
+
transcoders = client.transcoders
|
159
|
+
|
160
|
+
# List all transcoders
|
161
|
+
#
|
162
|
+
# Returns a ModelList object which behaves like a Hash. The keys of the Hash
|
163
|
+
# are the primary keys of the model, and the values are the model themselves.
|
164
|
+
#
|
165
|
+
list = transcoders.list
|
166
|
+
|
167
|
+
list.each do |id, transcoder|
|
168
|
+
# Do something with the items in the list.
|
169
|
+
end
|
170
|
+
|
171
|
+
# Find a transcoder
|
172
|
+
#
|
173
|
+
# Returns the model that matches the primary key provided. If the primary
|
174
|
+
# key doesn't exist, a WscSdk::Models::Error object is returned.
|
175
|
+
#
|
176
|
+
transcoders.find('some_id')
|
177
|
+
|
178
|
+
# Create a transcoder
|
179
|
+
#
|
180
|
+
# Returns the model of the newly created object. If the validation failed,
|
181
|
+
# or there was an issue sending the data to the API, then a
|
182
|
+
# WscSdk::Models::Error object is returned.
|
183
|
+
#
|
184
|
+
transcoders.create(some_transcoder_model)
|
185
|
+
|
186
|
+
# Update a transcoder
|
187
|
+
#
|
188
|
+
# Returns the model of the updated object. If the validation failed,
|
189
|
+
# or there was an issue sending the data to the API, then a
|
190
|
+
# WscSdk::Models::Error object is returned.
|
191
|
+
#
|
192
|
+
transcoders.update(some_transcoder_model)
|
193
|
+
|
194
|
+
# Delete a transcoder
|
195
|
+
#
|
196
|
+
# Returns the model data of the deleted object, with the primary key value
|
197
|
+
# removed. If there was an issue sending the data to the API, then a
|
198
|
+
# WscSdk::Models::Error object is returned.
|
199
|
+
#
|
200
|
+
transcoders.delete(some_transcoder_model)
|
201
|
+
```
|
202
|
+
|
203
|
+
The `Endpoint#list`, `Endpoint#find(id)`, `Endpoint#create(model_object)`, `Endpoint#update(model_object)`, and `Endpoint#delete(model_object)` methods are the most common methods inside of an endpoint, however these will change from model-to-model, so check the code [documentation](#documentation) for specific details on the model you're attempting to interact with.
|
204
|
+
|
205
|
+
### Use templates
|
206
|
+
This SDK provides predefined templates to make it easier to configure a model with common data values. Templates are available for live streams, transcoders, outputs, custom stream targets, Wowza stream targets, and ultra low latency stream targets.
|
207
|
+
|
208
|
+
You use a template when using an endpoint to create a model. For example, to create a transcoder that uses the RTMP protocol to push a stream from the source to Wowza Streaming Cloud, use a template like this:
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
# Build an RTMP/push transcoder using a predefined template
|
212
|
+
name = "My First SDK Transcoder"
|
213
|
+
transcoder_data = WscSdk::Templates::Transcoder.rtmp_push(name)
|
214
|
+
```
|
215
|
+
|
216
|
+
Values for *transcoder_type*, *billing_mode*, *broadcast_location*, *protocol*, *delivery_method* and more are set by default.
|
217
|
+
|
218
|
+
|
219
|
+
To override a preset value, add a modifier key:value pair like this:
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
# Build an RTMP/push transcoder using a predefined template with a modifier
|
223
|
+
name = "My First SDK Transcoder"
|
224
|
+
transcoder_data = WscSdk::Templates::Transcoder.rtmp_push(name, broadcast_location: "eu_germany")
|
225
|
+
```
|
226
|
+
|
227
|
+
You can see the details for each available template in the [Templates documentation](https://wowza.com/resources/wsc/sdk/ruby/WscSdk/Templates.html). Click **View source** to see the preset values.
|
228
|
+
|
229
|
+
### Manage lists
|
230
|
+
|
231
|
+
All of the endpoints that return lists allow you to control how the data is returned. You can configure the lists with following options:
|
232
|
+
|
233
|
+
- **Pagination**
|
234
|
+
- **Filtering**
|
235
|
+
|
236
|
+
#### Paginate lists
|
237
|
+
|
238
|
+
Most Wowza Streaming Cloud REST API endpoints allow you to paginate the results of lists. The SDK fully supports this functionality by passing optional parameters to `client.[endpoint].list` requests.
|
239
|
+
|
240
|
+
###### Pagination parameters:
|
241
|
+
|
242
|
+
- **page**: The page number of to request
|
243
|
+
- **per_page**: The number of items per page to request.
|
244
|
+
|
245
|
+
Using your [client](#create-a-client) object, you can request a paginated list like this:
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
client.transcoders.list(pagination: { page: 1, per_page: 20 })
|
249
|
+
```
|
250
|
+
|
251
|
+
The resulting list `Hash` will have a special key for the pagination information called `:pagination`. If you access this key, you'll get back information about the current pagination information.
|
252
|
+
|
253
|
+
#### Filter lists
|
254
|
+
|
255
|
+
**Note:** Currently only the transcoders endpoint allows for filtering items returned in the response.
|
256
|
+
|
257
|
+
To filter content returned in a list call, you can add the `filter:` key to the `list` call.
|
258
|
+
|
259
|
+
The filter is a Hash of acceptable field names and filter values. Although the API allows for more complex filtering, currently the SDK filter accepts only direct equality filtering.
|
260
|
+
|
261
|
+
Using your [client](#create-a-client) object, you can request a list of transcoders that are currently started, like this:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
client.transcoders.list(filter: { state: 'started' })
|
265
|
+
```
|
266
|
+
|
267
|
+
### Error handling
|
268
|
+
|
269
|
+
An SDK call that returns an unraised error will return it as a `WscSdk::Models::Error` instance.
|
270
|
+
|
271
|
+
To determine if a model or model list generated an error during it's request, you can call the `success?` method to determine the outcome.
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
transcoder_list = client.transcoders.list
|
275
|
+
|
276
|
+
if transcoder_list.success?
|
277
|
+
# Do some stuff with your list.
|
278
|
+
else
|
279
|
+
# If it wasn't a success, then the returned model is an instance of WscSdk::Models::Error.
|
280
|
+
puts "Your request for the transcoder list generated an error: #{transcoder_list.code}: #{transcoder_list.title}"
|
281
|
+
end
|
282
|
+
```
|
283
|
+
|
284
|
+
## Sending files through the SDK
|
285
|
+
|
286
|
+
Some API endpoints allow you to send files for use in configuring a
|
287
|
+
live stream, transcoder, player or hosted page. These files must be converted from their original format to a Base64-encoded string representation in order to be processed by Wowza Streaming Cloud.
|
288
|
+
|
289
|
+
There is a static convenience method in the client that will load a file from
|
290
|
+
your local system and properly encode it for delivery to the API.
|
291
|
+
|
292
|
+
```ruby
|
293
|
+
WscSdk::Client.file_to_base64("/path/to/some/file")
|
294
|
+
```
|
295
|
+
|
296
|
+
For example, if you want to embed a watermark image into a transcoded stream, your code might look like this:
|
297
|
+
|
298
|
+
```ruby
|
299
|
+
|
300
|
+
transcoder = $client.transcoders.build
|
301
|
+
|
302
|
+
transcoder.watermark_image = WscSdk::Client.file_to_base64("/path/to/some/file.jpg")
|
303
|
+
|
304
|
+
transcoder.save
|
305
|
+
```
|
306
|
+
|
307
|
+
## Access the entire Wowza Streaming Cloud REST API
|
308
|
+
|
309
|
+
This SDK is still under active development, so many endpoints haven't been built
|
310
|
+
in just yet. To help with this, we've exposed a low-level method inside the
|
311
|
+
client for handling any endpoint inside the API.
|
312
|
+
|
313
|
+
This method generates the necessary request headers, does some basic
|
314
|
+
interpretation of the request, and returns a Hash object of the response data.
|
315
|
+
It doesn't do any data validation or management. It's up to you to handle
|
316
|
+
the data going in and coming out of the request and make sure it's structured
|
317
|
+
according to the documentation.
|
318
|
+
|
319
|
+
See the [Wowza Streaming Cloud API reference](https://sandbox.cloud.wowza.com/api/current/docs) and [API documentation](https://www.wowza.com/docs/wowza-streaming-cloud-rest-api) for more information.
|
320
|
+
|
321
|
+
##### Examples
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
|
325
|
+
# Request a list of players
|
326
|
+
players_list = client.request_endpoint(:get, "/players")
|
327
|
+
|
328
|
+
# Display the list of players and their types
|
329
|
+
players_list["players"].each do |player|
|
330
|
+
puts "#{player["id"]}: #{player["type"]}"
|
331
|
+
end
|
332
|
+
|
333
|
+
# Get the details for the first player in the list
|
334
|
+
player_id = player_list["players"].first["id"]
|
335
|
+
player = client.request_endpoint(:get, "/players/#{player_id}")
|
336
|
+
|
337
|
+
# Display the player details
|
338
|
+
puts "Player:"
|
339
|
+
player["player"].each do |attribute, value|
|
340
|
+
puts " - #{attribute.to_s.ljust(25)} : #{value}"
|
341
|
+
end
|
342
|
+
|
343
|
+
# Update an existing player.
|
344
|
+
updated_player_data = {
|
345
|
+
player: {
|
346
|
+
hosted_page_title: "This is my updated Hosted Page with Player",
|
347
|
+
hosted_page_description: "new description for my hosted page"
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
updated_player = client.request_endpoint(:post, "/players/#{player_id}", updated_player_data)
|
352
|
+
puts "Player:"
|
353
|
+
player["player"].each do |attribute, value|
|
354
|
+
puts " - #{attribute.to_s.ljust(25)} : #{value}"
|
355
|
+
end
|
356
|
+
|
357
|
+
```
|
358
|
+
|
359
|
+
## SDK examples
|
360
|
+
|
361
|
+
Check out the ruby example files in this repo to learn how to use SDK functions to configure and manage models.
|
362
|
+
|
363
|
+
- [Set up a client](/examples/client.rb)
|
364
|
+
- [Work with live streams](/examples/live_streams)
|
365
|
+
- [Work with transcoders](/examples/transcoders)
|
366
|
+
- [Work with outputs](/examples/outputs)
|
367
|
+
- [Work with stream targets](/examples/stream_targets)
|
368
|
+
|
369
|
+
|
370
|
+
## Documentation
|
371
|
+
|
372
|
+
You can dig into the details in the [Wowza Streaming Cloud Ruby SDK reference documentation](https://wowza.com/resources/wsc/sdk/ruby/index.html).
|
373
|
+
|
374
|
+
|
375
|
+
## Contribute
|
376
|
+
|
377
|
+
For the moment, we're not accepting public contributions for the Wowza Streaming Cloud Ruby SDK. We may open the code up to contributions in the future. For now, relay your concerns and things you'd like to see added by emailing us at [cloud-feedback@wowza.com](mailto:cloud-feedback@wowza.com).
|
378
|
+
|
379
|
+
|
380
|
+
## Feedback
|
381
|
+
|
382
|
+
We welcome your feedback on the SDK, its documentation, and the experience of using it. For now, we have disabled GitHub issues for this repo. To provide feedback, email us at [cloud-feedback@wowza.com](mailto:cloud-feedback@wowza.com).
|
383
|
+
|
384
|
+
|
385
|
+
## Support
|
386
|
+
|
387
|
+
For now, we have disabled GitHub issues for this repo. To request assistance with the SDK, open a support ticket with [Wowza Support](https://www.wowza.com/portal/help).
|
388
|
+
|
389
|
+
|
390
|
+
## Code of conduct
|
391
|
+
|
392
|
+
Please adhere to the guidelines described in the [license](#license) for this SDK.
|
393
|
+
|
394
|
+
|
395
|
+
## License
|
396
|
+
|
397
|
+
This code is distributed under the [BSD-3 License](LICENSE.txt).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "wsc_sdk"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|