wowza_cloud 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +108 -6
- data/lib/wowza_cloud/stream.rb +6 -2
- data/lib/wowza_cloud/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f93e795103b33a9131e0e72cc030d9c46243545e
|
|
4
|
+
data.tar.gz: c0de4989ea379eb0439d61297e51a44366268d61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0177b46405a10f260ce78f16088957e5a96367d6774e51ab8f74eea5dc630c4a2ae7c051e7db7b1092febe1ae774dec8f301063b82388d9126d57cd0991c2fc8
|
|
7
|
+
data.tar.gz: cd5e277d96478db8c75149813fb412e77ebe33ac010d5fd65f8b77c5e2ef9388e05ea80347cba4d928170b66c533784d64375c987af4a844ceffe6497a9b3436
|
data/README.md
CHANGED
|
@@ -5,10 +5,12 @@ API]('https://sandbox.cloud.wowza.com/apidocs/v1/'). The quickest way to get
|
|
|
5
5
|
started with this library would be to glance over the Wowza documentation, then
|
|
6
6
|
come back here and take a look at some of the examples below.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
As it stands right now, I've only implemented the endpoints that I have an
|
|
9
|
+
active need for. That means that the feature of the API that _you're_ looking
|
|
10
|
+
for may not be here. If that's the case, you've got two options. First, you
|
|
11
|
+
could try shooting me a message and asking me to build the feature in. If I've
|
|
12
|
+
got time, I'll take care of it for you. Alternatively, I'm all for accepting
|
|
13
|
+
pull requests, so feel free to add the feature for yourself.
|
|
12
14
|
|
|
13
15
|
## Installation
|
|
14
16
|
|
|
@@ -49,6 +51,7 @@ end
|
|
|
49
51
|
For non-Rails users, some variation of the above called somewhere before you
|
|
50
52
|
start using the gem should do.
|
|
51
53
|
|
|
54
|
+
|
|
52
55
|
### Getting a list of streams
|
|
53
56
|
|
|
54
57
|
One of the more basic things you'll want to do is to get a list of all of your
|
|
@@ -78,6 +81,19 @@ manipulate that particular stream.
|
|
|
78
81
|
The gem gives you a number of basic actions you can take for a particular
|
|
79
82
|
stream.
|
|
80
83
|
|
|
84
|
+
### Accessing basic attributes
|
|
85
|
+
|
|
86
|
+
All of the return values for a call to `/live_streams/{id}` are made available as
|
|
87
|
+
attributes on the `WowzaCloud::Stream` object. So, for instance, if you want to
|
|
88
|
+
get the broadcast location for a given stream, you can call:
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
stream.broadcast_location # => "us_west_california"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This will get you back the string value that corresponds to that attribute from
|
|
95
|
+
the API. This works for all of the keys in the return JSON from the API call.
|
|
96
|
+
|
|
81
97
|
#### Checking Stream Status
|
|
82
98
|
|
|
83
99
|
You can get the status, (also called state), of a stream by calling the
|
|
@@ -115,10 +131,96 @@ stream = WowzaCloud::Stream.get_stream('vxy4nprl')
|
|
|
115
131
|
stream.start # => 'starting'
|
|
116
132
|
# Reset a stream
|
|
117
133
|
stream.reset # => 'resetting'
|
|
118
|
-
# Stop a stream
|
|
119
|
-
stream.stop # => 'stopping'
|
|
134
|
+
# Stop a stream
|
|
135
|
+
stream.stop # => 'stopping'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Working With Schedules
|
|
139
|
+
|
|
140
|
+
Once again, I'd encourage you to refer to the official Wowza API documentation
|
|
141
|
+
for details about the schedule API. As of this writing, this gem only supports
|
|
142
|
+
retrieving schedule details and enabling or disabling schedules. Editing,
|
|
143
|
+
adding and removing are all unsupported at the moment, so you'll still have to
|
|
144
|
+
do that through the Wowza Cloud interface.
|
|
145
|
+
|
|
146
|
+
In any case, you can retrieve and work with schedules in much the same way
|
|
147
|
+
that you work with streams:
|
|
148
|
+
|
|
149
|
+
#### Getting a list of schedules
|
|
150
|
+
|
|
151
|
+
You can get a complete list of all your configured schedules like this:
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
schedules = WowzaCloud::Schedule.all
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This will return an array of `WowzaCloud::Schedule` instances.
|
|
158
|
+
|
|
159
|
+
### Accessing basic attributes
|
|
160
|
+
|
|
161
|
+
All of the return values for a call to `/schedules/{id}` are made available as
|
|
162
|
+
attributes on the `WowzaCloud::Schedule` object. So, for instance, if you want
|
|
163
|
+
to get the list of days the schedule runs for, you can call:
|
|
164
|
+
|
|
165
|
+
```ruby
|
|
166
|
+
schedule.recurrence_data # => "sunday,monday,tuesday,wednesday,thursday,friday,saturday"
|
|
120
167
|
```
|
|
121
168
|
|
|
169
|
+
This will get you back the string value that corresponds to that attribute from
|
|
170
|
+
the API. This works for all of the keys in the return JSON from the API call.
|
|
171
|
+
|
|
172
|
+
### Fetching a single schedule
|
|
173
|
+
|
|
174
|
+
Once you have the ID of the schedule you'd like to retrieve, you can fetch it's
|
|
175
|
+
data with the following:
|
|
176
|
+
|
|
177
|
+
```ruby
|
|
178
|
+
schedule = WowzaCloud::Schedule.get_schedule('myscheduleid')
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
This will return an instance of `WowzaCloud::Schedule` that you can then work
|
|
182
|
+
with as detailed below.
|
|
183
|
+
|
|
184
|
+
### Enabling a schedule
|
|
185
|
+
|
|
186
|
+
You can enable a particular schedule by calling the `enable` method:
|
|
187
|
+
|
|
188
|
+
```ruby
|
|
189
|
+
schedule.enable # => 'enabled'
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The return value of the enable call is the current status of the stream,
|
|
193
|
+
(should be "enabled").
|
|
194
|
+
|
|
195
|
+
### Disabling a schedule
|
|
196
|
+
|
|
197
|
+
Conversely, if you want to disable a schedule:
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
schedule.disable # => 'disabled'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
The return value is the same as for enabling -- the current status of the
|
|
204
|
+
schedule.
|
|
205
|
+
|
|
206
|
+
### Getting schedule status
|
|
207
|
+
|
|
208
|
+
If you want to know whether a schedule is enabled or disabled, you can find out
|
|
209
|
+
by calling the `status` instance method:
|
|
210
|
+
|
|
211
|
+
```ruby
|
|
212
|
+
schedule.status # => 'enabled'
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Fetching corresponding streams and schedules
|
|
216
|
+
|
|
217
|
+
Instances of `WowzaCloud::Stream` have a convenience method `schedule` that
|
|
218
|
+
will return `nil` if the Stream does not have an associated schedule, but an
|
|
219
|
+
appropriate instance of `WowzaCloud::Schedule` if a schedule does exist.
|
|
220
|
+
|
|
221
|
+
Similarly, instances of `WowzaCloud::Schedule` have a convenience method
|
|
222
|
+
`stream`, which will always return the appropriate instance of
|
|
223
|
+
a `WowzaCloud::Stream`.
|
|
122
224
|
|
|
123
225
|
## Development
|
|
124
226
|
|
data/lib/wowza_cloud/stream.rb
CHANGED
|
@@ -76,9 +76,13 @@ module WowzaCloud
|
|
|
76
76
|
return raw_response['live_stream']['state']
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
# Returns the schedule attached to this stream, if one exists
|
|
79
|
+
# Returns the first active schedule attached to this stream, if one exists
|
|
80
80
|
def schedule
|
|
81
|
-
Schedule.all.select{|s| s.transcoder_id == @id }.first
|
|
81
|
+
Schedule.all.select{|s| s.transcoder_id == @id s.state == 'enabled' }.first
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def schedules
|
|
85
|
+
Schedule.all.select{|s| s.transcoder_id == @id }
|
|
82
86
|
end
|
|
83
87
|
|
|
84
88
|
end
|
data/lib/wowza_cloud/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wowza_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steve Lewis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|