wsc_sdk 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +146 -0
  3. data/.circleci/docker/build/Dockerfile +3 -0
  4. data/.circleci/helpers/add_preamble.rb +29 -0
  5. data/.circleci/helpers/build_docs.sh +5 -0
  6. data/.circleci/helpers/build_gem.sh +5 -0
  7. data/.circleci/helpers/debundle-context.sh +14 -0
  8. data/.circleci/helpers/finalize_release.sh +24 -0
  9. data/.circleci/helpers/publish_docs.sh +10 -0
  10. data/.circleci/helpers/release_gem.sh +8 -0
  11. data/.circleci/helpers/setup.sh +11 -0
  12. data/.circleci/helpers/setup_aws.sh +13 -0
  13. data/.circleci/helpers/setup_gem.sh +2 -0
  14. data/.circleci/helpers/setup_git.sh +27 -0
  15. data/.circleci/helpers/setup_rubygems.sh +15 -0
  16. data/.circleci/helpers/test_integration.sh +12 -0
  17. data/.circleci/helpers/test_unit.sh +6 -0
  18. data/.circleci/jobs/publish-production.sh +17 -0
  19. data/.circleci/jobs/publish-staging.sh +17 -0
  20. data/.circleci/jobs/release-production.sh +21 -0
  21. data/.circleci/jobs/test-integration.sh +9 -0
  22. data/.circleci/jobs/test-unit.sh +9 -0
  23. data/.circleci/tag_repo.rb +46 -0
  24. data/.gitignore +28 -0
  25. data/.rspec +2 -0
  26. data/.yard/config +2 -0
  27. data/.yard/template/default/fulldoc/html/css/custom.css +151 -0
  28. data/.yard/template/default/layout/html/footer.erb +0 -0
  29. data/.yard/template/default/layout/html/headers.erb +10 -0
  30. data/.yard/template/default/layout/html/layout.erb +45 -0
  31. data/.yard/template/default/layout/html/setup.rb +24 -0
  32. data/.yardopts +1 -0
  33. data/CODE_OF_CONDUCT.md +74 -0
  34. data/Gemfile +6 -0
  35. data/Gemfile.lock +99 -0
  36. data/LICENSE.txt +28 -0
  37. data/README.md +397 -0
  38. data/Rakefile +2 -0
  39. data/bin/console +14 -0
  40. data/bin/setup +8 -0
  41. data/doc/Hash.html +291 -0
  42. data/doc/WscSdk.html +570 -0
  43. data/doc/WscSdk/ApiResponse.html +242 -0
  44. data/doc/WscSdk/Attributes.html +128 -0
  45. data/doc/WscSdk/Attributes/Mode.html +191 -0
  46. data/doc/WscSdk/Attributes/Type.html +389 -0
  47. data/doc/WscSdk/Client.html +2677 -0
  48. data/doc/WscSdk/Configuration.html +595 -0
  49. data/doc/WscSdk/Endpoint.html +2974 -0
  50. data/doc/WscSdk/Endpoints.html +141 -0
  51. data/doc/WscSdk/Endpoints/CustomStreamTargets.html +383 -0
  52. data/doc/WscSdk/Endpoints/LiveStreams.html +197 -0
  53. data/doc/WscSdk/Endpoints/OutputStreamTargets.html +180 -0
  54. data/doc/WscSdk/Endpoints/Outputs.html +180 -0
  55. data/doc/WscSdk/Endpoints/StreamTargets.html +446 -0
  56. data/doc/WscSdk/Endpoints/Transcoders.html +197 -0
  57. data/doc/WscSdk/Endpoints/UllStreamTargets.html +383 -0
  58. data/doc/WscSdk/Endpoints/WowzaStreamTargets.html +383 -0
  59. data/doc/WscSdk/Enum.html +225 -0
  60. data/doc/WscSdk/Enums.html +321 -0
  61. data/doc/WscSdk/Enums/BillingMode.html +188 -0
  62. data/doc/WscSdk/Enums/BroadcastLocation.html +396 -0
  63. data/doc/WscSdk/Enums/BufferSize.html +301 -0
  64. data/doc/WscSdk/Enums/ClosedCaptionType.html +221 -0
  65. data/doc/WscSdk/Enums/CustomProvider.html +252 -0
  66. data/doc/WscSdk/Enums/DeliveryMethod.html +188 -0
  67. data/doc/WscSdk/Enums/DeliveryType.html +188 -0
  68. data/doc/WscSdk/Enums/Encoder.html +460 -0
  69. data/doc/WscSdk/Enums/Errors.html +555 -0
  70. data/doc/WscSdk/Enums/IdleTimeout.html +398 -0
  71. data/doc/WscSdk/Enums/ImagePosition.html +220 -0
  72. data/doc/WscSdk/Enums/ModelMode.html +175 -0
  73. data/doc/WscSdk/Enums/ModelType.html +373 -0
  74. data/doc/WscSdk/Enums/PlayerType.html +188 -0
  75. data/doc/WscSdk/Enums/Protocol.html +204 -0
  76. data/doc/WscSdk/Enums/TargetDeliveryProtocol.html +188 -0
  77. data/doc/WscSdk/Enums/TranscoderType.html +188 -0
  78. data/doc/WscSdk/Enums/UserRegion.html +383 -0
  79. data/doc/WscSdk/Enums/WowzaProvider.html +188 -0
  80. data/doc/WscSdk/Errors.html +683 -0
  81. data/doc/WscSdk/Loggable.html +346 -0
  82. data/doc/WscSdk/Model.html +3316 -0
  83. data/doc/WscSdk/ModelList.html +442 -0
  84. data/doc/WscSdk/ModelTemplate.html +267 -0
  85. data/doc/WscSdk/Models.html +141 -0
  86. data/doc/WscSdk/Models/CustomStreamTarget.html +192 -0
  87. data/doc/WscSdk/Models/Error.html +351 -0
  88. data/doc/WscSdk/Models/LiveStream.html +601 -0
  89. data/doc/WscSdk/Models/LiveStreamConnectionCode.html +192 -0
  90. data/doc/WscSdk/Models/LiveStreamState.html +200 -0
  91. data/doc/WscSdk/Models/LiveStreamStats.html +200 -0
  92. data/doc/WscSdk/Models/LiveStreamThumbnailUrl.html +200 -0
  93. data/doc/WscSdk/Models/Output.html +294 -0
  94. data/doc/WscSdk/Models/OutputStreamTarget.html +274 -0
  95. data/doc/WscSdk/Models/StreamTarget.html +273 -0
  96. data/doc/WscSdk/Models/Transcoder.html +793 -0
  97. data/doc/WscSdk/Models/TranscoderBooleanStat.html +278 -0
  98. data/doc/WscSdk/Models/TranscoderConnectionCode.html +192 -0
  99. data/doc/WscSdk/Models/TranscoderFloatStat.html +278 -0
  100. data/doc/WscSdk/Models/TranscoderIntegerStat.html +278 -0
  101. data/doc/WscSdk/Models/TranscoderState.html +196 -0
  102. data/doc/WscSdk/Models/TranscoderStats.html +196 -0
  103. data/doc/WscSdk/Models/TranscoderStreamTargetState.html +192 -0
  104. data/doc/WscSdk/Models/TranscoderStringStat.html +278 -0
  105. data/doc/WscSdk/Models/TranscoderThumbnailUrl.html +196 -0
  106. data/doc/WscSdk/Models/UllStreamTarget.html +360 -0
  107. data/doc/WscSdk/Models/WowzaStreamTarget.html +380 -0
  108. data/doc/WscSdk/Pagination.html +1277 -0
  109. data/doc/WscSdk/Schema.html +861 -0
  110. data/doc/WscSdk/SchemaAttribute.html +2400 -0
  111. data/doc/WscSdk/Templates.html +141 -0
  112. data/doc/WscSdk/Templates/CustomStreamTarget.html +1045 -0
  113. data/doc/WscSdk/Templates/LiveStream.html +1432 -0
  114. data/doc/WscSdk/Templates/Output.html +829 -0
  115. data/doc/WscSdk/Templates/Transcoder.html +699 -0
  116. data/doc/WscSdk/Templates/UllStreamTarget.html +411 -0
  117. data/doc/WscSdk/Templates/WowzaStreamTarget.html +447 -0
  118. data/doc/WscSdk/TranscoderSharedMethods.html +1113 -0
  119. data/doc/_index.html +705 -0
  120. data/doc/class_list.html +51 -0
  121. data/doc/css/bootstrap.css +5 -0
  122. data/doc/css/common.css +1 -0
  123. data/doc/css/custom.css +151 -0
  124. data/doc/css/full_list.css +58 -0
  125. data/doc/css/style.css +496 -0
  126. data/doc/file.README.html +570 -0
  127. data/doc/file_list.html +56 -0
  128. data/doc/frames.html +17 -0
  129. data/doc/images/wsc-ruby-1800x400.png +0 -0
  130. data/doc/index.html +570 -0
  131. data/doc/js/app.js +292 -0
  132. data/doc/js/full_list.js +216 -0
  133. data/doc/js/jquery.js +4 -0
  134. data/doc/method_list.html +1731 -0
  135. data/doc/top-level-namespace.html +182 -0
  136. data/examples/client.rb +40 -0
  137. data/examples/helpers.rb +100 -0
  138. data/examples/live_streams/create.rb +39 -0
  139. data/examples/live_streams/delete.rb +32 -0
  140. data/examples/live_streams/find.rb +22 -0
  141. data/examples/live_streams/flood.rb +126 -0
  142. data/examples/live_streams/list.rb +24 -0
  143. data/examples/live_streams/regenerate_connection_code.rb +29 -0
  144. data/examples/live_streams/reset.rb +32 -0
  145. data/examples/live_streams/reset_and_wait.rb +51 -0
  146. data/examples/live_streams/start.rb +33 -0
  147. data/examples/live_streams/start_and_wait.rb +51 -0
  148. data/examples/live_streams/state.rb +33 -0
  149. data/examples/live_streams/stats.rb +43 -0
  150. data/examples/live_streams/stop.rb +33 -0
  151. data/examples/live_streams/stop_and_wait.rb +51 -0
  152. data/examples/live_streams/thumbnail_url.rb +46 -0
  153. data/examples/live_streams/update.rb +43 -0
  154. data/examples/live_streams/workflow.rb +165 -0
  155. data/examples/output_stream_targets/create.rb +56 -0
  156. data/examples/output_stream_targets/delete.rb +45 -0
  157. data/examples/output_stream_targets/find.rb +37 -0
  158. data/examples/output_stream_targets/list.rb +36 -0
  159. data/examples/output_stream_targets/update.rb +56 -0
  160. data/examples/outputs/create.rb +49 -0
  161. data/examples/outputs/delete.rb +39 -0
  162. data/examples/outputs/find.rb +31 -0
  163. data/examples/outputs/list.rb +29 -0
  164. data/examples/outputs/update.rb +50 -0
  165. data/examples/stream_targets/custom/create.rb +42 -0
  166. data/examples/stream_targets/custom/delete.rb +31 -0
  167. data/examples/stream_targets/custom/find.rb +23 -0
  168. data/examples/stream_targets/custom/list.rb +24 -0
  169. data/examples/stream_targets/custom/update.rb +43 -0
  170. data/examples/stream_targets/list.rb +24 -0
  171. data/examples/stream_targets/ull/create.rb +41 -0
  172. data/examples/stream_targets/ull/delete.rb +31 -0
  173. data/examples/stream_targets/ull/find.rb +23 -0
  174. data/examples/stream_targets/ull/list.rb +24 -0
  175. data/examples/stream_targets/ull/update.rb +43 -0
  176. data/examples/stream_targets/wowza/create.rb +42 -0
  177. data/examples/stream_targets/wowza/delete.rb +31 -0
  178. data/examples/stream_targets/wowza/find.rb +23 -0
  179. data/examples/stream_targets/wowza/list.rb +23 -0
  180. data/examples/stream_targets/wowza/update.rb +43 -0
  181. data/examples/transcoders/create.rb +39 -0
  182. data/examples/transcoders/delete.rb +31 -0
  183. data/examples/transcoders/find.rb +23 -0
  184. data/examples/transcoders/list.rb +24 -0
  185. data/examples/transcoders/reset.rb +32 -0
  186. data/examples/transcoders/reset_and_wait.rb +48 -0
  187. data/examples/transcoders/start.rb +33 -0
  188. data/examples/transcoders/start_and_wait.rb +50 -0
  189. data/examples/transcoders/state.rb +33 -0
  190. data/examples/transcoders/stats.rb +43 -0
  191. data/examples/transcoders/stop.rb +33 -0
  192. data/examples/transcoders/stop_and_wait.rb +50 -0
  193. data/examples/transcoders/thumbnail_url.rb +46 -0
  194. data/examples/transcoders/update.rb +43 -0
  195. data/images/wsc-ruby-1800x400.png +0 -0
  196. data/lib/wsc_sdk.rb +81 -0
  197. data/lib/wsc_sdk/client.rb +417 -0
  198. data/lib/wsc_sdk/configuration.rb +21 -0
  199. data/lib/wsc_sdk/constants.rb +29 -0
  200. data/lib/wsc_sdk/endpoint.rb +492 -0
  201. data/lib/wsc_sdk/endpoints/custom_stream_targets.rb +44 -0
  202. data/lib/wsc_sdk/endpoints/live_streams.rb +34 -0
  203. data/lib/wsc_sdk/endpoints/output_stream_targets.rb +17 -0
  204. data/lib/wsc_sdk/endpoints/outputs.rb +17 -0
  205. data/lib/wsc_sdk/endpoints/stream_targets.rb +45 -0
  206. data/lib/wsc_sdk/endpoints/transcoders.rb +38 -0
  207. data/lib/wsc_sdk/endpoints/ull_stream_targets.rb +44 -0
  208. data/lib/wsc_sdk/endpoints/wowza_stream_targets.rb +44 -0
  209. data/lib/wsc_sdk/enums.rb +31 -0
  210. data/lib/wsc_sdk/enums/billing_mode.rb +20 -0
  211. data/lib/wsc_sdk/enums/broadcast_location.rb +58 -0
  212. data/lib/wsc_sdk/enums/buffer_size.rb +41 -0
  213. data/lib/wsc_sdk/enums/closed_caption_type.rb +26 -0
  214. data/lib/wsc_sdk/enums/custom_provider.rb +32 -0
  215. data/lib/wsc_sdk/enums/delivery_method.rb +20 -0
  216. data/lib/wsc_sdk/enums/delivery_type.rb +20 -0
  217. data/lib/wsc_sdk/enums/encoder.rb +71 -0
  218. data/lib/wsc_sdk/enums/idle_timeout.rb +50 -0
  219. data/lib/wsc_sdk/enums/image_position.rb +26 -0
  220. data/lib/wsc_sdk/enums/player_type.rb +20 -0
  221. data/lib/wsc_sdk/enums/protocol.rb +23 -0
  222. data/lib/wsc_sdk/enums/target_delivery_protocol.rb +20 -0
  223. data/lib/wsc_sdk/enums/transcoder_type.rb +20 -0
  224. data/lib/wsc_sdk/enums/wowza_provider.rb +20 -0
  225. data/lib/wsc_sdk/errors.rb +115 -0
  226. data/lib/wsc_sdk/model.rb +515 -0
  227. data/lib/wsc_sdk/model_list.rb +42 -0
  228. data/lib/wsc_sdk/model_template.rb +27 -0
  229. data/lib/wsc_sdk/models/custom_stream_target.rb +34 -0
  230. data/lib/wsc_sdk/models/error.rb +53 -0
  231. data/lib/wsc_sdk/models/live_stream.rb +130 -0
  232. data/lib/wsc_sdk/models/live_stream_connection_code.rb +31 -0
  233. data/lib/wsc_sdk/models/live_stream_state.rb +20 -0
  234. data/lib/wsc_sdk/models/live_stream_stats.rb +20 -0
  235. data/lib/wsc_sdk/models/live_stream_thumbnail_url.rb +20 -0
  236. data/lib/wsc_sdk/models/output.rb +61 -0
  237. data/lib/wsc_sdk/models/output_stream_target.rb +37 -0
  238. data/lib/wsc_sdk/models/stream_target.rb +29 -0
  239. data/lib/wsc_sdk/models/transcoder.rb +135 -0
  240. data/lib/wsc_sdk/models/transcoder_boolean_stat.rb +41 -0
  241. data/lib/wsc_sdk/models/transcoder_connection_code.rb +29 -0
  242. data/lib/wsc_sdk/models/transcoder_float_stat.rb +40 -0
  243. data/lib/wsc_sdk/models/transcoder_integer_stat.rb +40 -0
  244. data/lib/wsc_sdk/models/transcoder_state.rb +31 -0
  245. data/lib/wsc_sdk/models/transcoder_stats.rb +51 -0
  246. data/lib/wsc_sdk/models/transcoder_stream_target_state.rb +29 -0
  247. data/lib/wsc_sdk/models/transcoder_string_stat.rb +40 -0
  248. data/lib/wsc_sdk/models/transcoder_thumbnail_url.rb +29 -0
  249. data/lib/wsc_sdk/models/ull_stream_target.rb +54 -0
  250. data/lib/wsc_sdk/models/wowza_stream_target.rb +60 -0
  251. data/lib/wsc_sdk/modules/api_response.rb +24 -0
  252. data/lib/wsc_sdk/modules/loggable.rb +44 -0
  253. data/lib/wsc_sdk/modules/transcoder_shared_methods.rb +221 -0
  254. data/lib/wsc_sdk/pagination.rb +89 -0
  255. data/lib/wsc_sdk/schema.rb +140 -0
  256. data/lib/wsc_sdk/schema_attribute.rb +349 -0
  257. data/lib/wsc_sdk/templates/custom_stream_target.rb +154 -0
  258. data/lib/wsc_sdk/templates/live_stream.rb +234 -0
  259. data/lib/wsc_sdk/templates/output.rb +133 -0
  260. data/lib/wsc_sdk/templates/transcoder.rb +97 -0
  261. data/lib/wsc_sdk/templates/ull_stream_target.rb +49 -0
  262. data/lib/wsc_sdk/templates/wowza_stream_target.rb +57 -0
  263. data/lib/wsc_sdk/version.rb +7 -0
  264. data/wsc_sdk.gemspec +48 -0
  265. metadata +460 -0
@@ -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
+
@@ -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).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here