Class: Wowza::REST::Stream
- Inherits:
-
Object
- Object
- Wowza::REST::Stream
- Includes:
- Assignment::Attributes
- Defined in:
- lib/wowza/rest/stream.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_connected ⇒ Object
Returns the value of attribute is_connected.
-
#is_recording ⇒ Object
Returns the value of attribute is_recording.
-
#name ⇒ Object
Returns the value of attribute name.
-
#server_name ⇒ Object
Returns the value of attribute server_name.
-
#source_ip ⇒ Object
Returns the value of attribute source_ip.
-
#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 = {}) ⇒ Stream
constructor
A new instance of Stream.
- #instance_path ⇒ Object
- #recording? ⇒ Boolean
- #reload! ⇒ Object
- #resource_path ⇒ Object
- #server_path ⇒ Object
- #vhost_path ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Stream
Returns a new instance of Stream.
24 25 26 27 |
# File 'lib/wowza/rest/stream.rb', line 24 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.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.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.rb', line 7 def instance_name @instance_name end |
#is_connected ⇒ Object
Returns the value of attribute is_connected.
7 8 9 |
# File 'lib/wowza/rest/stream.rb', line 7 def is_connected @is_connected end |
#is_recording ⇒ Object
Returns the value of attribute is_recording.
7 8 9 |
# File 'lib/wowza/rest/stream.rb', line 7 def is_recording @is_recording end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/wowza/rest/stream.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.rb', line 7 def server_name @server_name end |
#source_ip ⇒ Object
Returns the value of attribute source_ip.
7 8 9 |
# File 'lib/wowza/rest/stream.rb', line 7 def source_ip @source_ip end |
#vhost_name ⇒ Object
Returns the value of attribute vhost_name.
7 8 9 |
# File 'lib/wowza/rest/stream.rb', line 7 def vhost_name @vhost_name end |
Class Method Details
.deserialize(attrs) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/wowza/rest/stream.rb', line 10 def self.deserialize(attrs) attrs = attrs.with_indifferent_access { name: attrs["name"], is_connected: attrs["isConnected"], is_recording: attrs["isRecordingSet"], source_ip: attrs["sourceIp"], } end |
.find_by(attrs) ⇒ Object
20 21 22 |
# File 'lib/wowza/rest/stream.rb', line 20 def self.find_by(attrs) new(attrs).reload! end |
Instance Method Details
#application_path ⇒ Object
91 92 93 |
# File 'lib/wowza/rest/stream.rb', line 91 def application_path "#{vhost_path}/applications/#{app_id}" end |
#attributes ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/wowza/rest/stream.rb', line 29 def attributes { name: name, is_connected: is_connected, is_recording: is_recording, source_ip: source_ip } end |
#connected? ⇒ Boolean
42 43 44 |
# File 'lib/wowza/rest/stream.rb', line 42 def connected? is_connected end |
#id ⇒ Object
103 104 105 |
# File 'lib/wowza/rest/stream.rb', line 103 def id name end |
#instance_path ⇒ Object
99 100 101 |
# File 'lib/wowza/rest/stream.rb', line 99 def instance_path "#{application_path}/instances/#{instance_name}" end |
#recording? ⇒ Boolean
50 51 52 |
# File 'lib/wowza/rest/stream.rb', line 50 def recording? is_recording end |
#reload! ⇒ Object
54 55 56 57 58 59 |
# File 'lib/wowza/rest/stream.rb', line 54 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
67 68 69 |
# File 'lib/wowza/rest/stream.rb', line 67 def resource_path "#{instance_path}/incomingstreams/#{id}" end |
#server_path ⇒ Object
75 76 77 |
# File 'lib/wowza/rest/stream.rb', line 75 def server_path "/v2/servers/#{server_name}" end |
#vhost_path ⇒ Object
83 84 85 |
# File 'lib/wowza/rest/stream.rb', line 83 def vhost_path "#{server_path}/vhosts/#{vhost_name}" end |