Class: Wowza::REST::StreamGroup
- Inherits:
-
Object
- Object
- Wowza::REST::StreamGroup
- Includes:
- Assignment::Attributes
- Defined in:
- lib/wowza/rest/stream_group.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#instance_name ⇒ Object
Returns the value of attribute instance_name.
-
#is_transcode_result ⇒ Object
Returns the value of attribute is_transcode_result.
-
#members ⇒ Object
Returns the value of attribute members.
-
#name ⇒ Object
Returns the value of attribute name.
-
#server_name ⇒ Object
Returns the value of attribute server_name.
-
#stream_name ⇒ Object
Returns the value of attribute stream_name.
-
#vhost_name ⇒ Object
Returns the value of attribute vhost_name.
Class Method Summary collapse
Instance Method Summary collapse
- #application_path ⇒ Object
- #attributes ⇒ Object
- #connected? ⇒ Boolean
- #id ⇒ Object
-
#initialize(attributes = {}) ⇒ StreamGroup
constructor
A new instance of StreamGroup.
- #instance_path ⇒ Object
- #is_connected ⇒ Object
- #is_recording ⇒ Object
- #recording? ⇒ Boolean
- #reload! ⇒ Object
- #resource_path ⇒ Object
- #server_path ⇒ Object
- #streams ⇒ Object
- #vhost_path ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ StreamGroup
Returns a new instance of StreamGroup.
25 26 27 28 |
# File 'lib/wowza/rest/stream_group.rb', line 25 def initialize(attributes={}) assign_attributes(attributes) if attributes super() end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def app_id @app_id end |
#conn ⇒ Object
Returns the value of attribute conn.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def conn @conn end |
#instance_name ⇒ Object
Returns the value of attribute instance_name.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def instance_name @instance_name end |
#is_transcode_result ⇒ Object
Returns the value of attribute is_transcode_result.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def is_transcode_result @is_transcode_result end |
#members ⇒ Object
Returns the value of attribute members.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def members @members end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def name @name end |
#server_name ⇒ Object
Returns the value of attribute server_name.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def server_name @server_name end |
#stream_name ⇒ Object
Returns the value of attribute stream_name.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def stream_name @stream_name end |
#vhost_name ⇒ Object
Returns the value of attribute vhost_name.
7 8 9 |
# File 'lib/wowza/rest/stream_group.rb', line 7 def vhost_name @vhost_name end |
Class Method Details
.deserialize(attrs) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/wowza/rest/stream_group.rb', line 10 def self.deserialize(attrs) attrs = attrs.with_indifferent_access { name: attrs["groupName"], is_transcode_result: attrs["isTranscodeResult"], instance_name: attrs["instanceName"], server_name: attrs["serverName"], members: attrs["members"], } end |
.find_by(attrs) ⇒ Object
21 22 23 |
# File 'lib/wowza/rest/stream_group.rb', line 21 def self.find_by(attrs) new(attrs).reload! end |
Instance Method Details
#application_path ⇒ Object
97 98 99 |
# File 'lib/wowza/rest/stream_group.rb', line 97 def application_path "#{vhost_path}/applications/#{app_id}" end |
#attributes ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/wowza/rest/stream_group.rb', line 30 def attributes { name: name, is_connected: is_connected, is_recording: is_recording, source_ip: source_ip } end |
#connected? ⇒ Boolean
43 44 45 |
# File 'lib/wowza/rest/stream_group.rb', line 43 def connected? is_connected end |
#id ⇒ Object
109 110 111 |
# File 'lib/wowza/rest/stream_group.rb', line 109 def id name end |
#instance_path ⇒ Object
105 106 107 |
# File 'lib/wowza/rest/stream_group.rb', line 105 def instance_path "#{application_path}/instances/#{instance_name}" end |
#is_connected ⇒ Object
39 40 41 |
# File 'lib/wowza/rest/stream_group.rb', line 39 def is_connected @is_connected || false end |
#is_recording ⇒ Object
47 48 49 |
# File 'lib/wowza/rest/stream_group.rb', line 47 def is_recording @is_recording || false end |
#recording? ⇒ Boolean
51 52 53 |
# File 'lib/wowza/rest/stream_group.rb', line 51 def recording? is_recording end |
#reload! ⇒ Object
55 56 57 58 59 60 |
# File 'lib/wowza/rest/stream_group.rb', line 55 def reload! resp = conn.get resource_path attrs = JSON.parse(resp.body) assign_attributes(self.class.deserialize(attrs)) if attrs self end |
#resource_path ⇒ Object
73 74 75 |
# File 'lib/wowza/rest/stream_group.rb', line 73 def resource_path "#{instance_path}/streamgroups/#{id}" end |
#server_path ⇒ Object
81 82 83 |
# File 'lib/wowza/rest/stream_group.rb', line 81 def server_path "/v2/servers/#{server_name}" end |
#streams ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/wowza/rest/stream_group.rb', line 113 def streams (members || []).map do |stream_name| Stream.new({ name: stream_name, app_id: app_id, server_name: server_name, vhost_name: vhost_name, instance_name: instance_name, conn: conn }) end end |
#vhost_path ⇒ Object
89 90 91 |
# File 'lib/wowza/rest/stream_group.rb', line 89 def vhost_path "#{server_path}/vhosts/#{vhost_name}" end |