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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2db8acbb5827fdcb882cab2c42262c46b3ebaeb0
4
- data.tar.gz: 0750eb7cc1c9a655578d852e2ff18478902f72db
3
+ metadata.gz: f93e795103b33a9131e0e72cc030d9c46243545e
4
+ data.tar.gz: c0de4989ea379eb0439d61297e51a44366268d61
5
5
  SHA512:
6
- metadata.gz: 6879358fb5ef38d0ac404b2dff544f3c2e4337f417cb23c04a3757186c1d10f2fb92697f3a1f713f5bd14a5c8ca22e6e6c7ab7db331d00bffac8003b4f3fc8e5
7
- data.tar.gz: ef30e3bb176a409a0c40ef16f3d6a73a43ec7e7a3733d0001e6955473cd0807cfcae6410ef25ea3baac56e1f8755a78b2948516b5850ca84e93cc65b69de7b94
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
- Thus far, this only covers the live streams portion of the API, and is missing
9
- delete, create and update from that section. I'm planning on adding more
10
- functionality as I need it, but feel free to add a pull request if there's
11
- something missing here that you'd like to see.
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module WowzaCloud
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
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.1
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-04-22 00:00:00.000000000 Z
11
+ date: 2017-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty