Class: OpenTok::Connection
- Inherits:
-
Object
- Object
- OpenTok::Connection
- Defined in:
- lib/opentok/connection.rb
Overview
Represents a connection in an OpenTok session.
Instance Attribute Summary collapse
-
#connection_id ⇒ String
The ID of the connection.
-
#connection_state ⇒ String
The state of the connection.
-
#created_at ⇒ Integer
The timestamp when the connection was created, expressed in milliseconds since the Unix epoch.
Instance Method Summary collapse
-
#force_disconnect ⇒ Object
Forces the disconnection of this connection from the OpenTok session.
-
#to_json ⇒ Object
A JSON-encoded string representation of the connection.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/opentok/connection.rb', line 37 def method_missing(method, *args, &block) camelized_method = method.to_s.camelize(:lower) if @json.has_key? camelized_method and args.empty? @json[camelized_method] else super method, *args, &block end end |
Instance Attribute Details
#connection_id ⇒ String
The ID of the connection.
15 16 17 |
# File 'lib/opentok/connection.rb', line 15 def connection_id @connection_id end |
#connection_state ⇒ String
The state of the connection.
15 16 17 |
# File 'lib/opentok/connection.rb', line 15 def connection_state @connection_state end |
#created_at ⇒ Integer
The timestamp when the connection was created, expressed in milliseconds since the Unix epoch.
15 16 17 |
# File 'lib/opentok/connection.rb', line 15 def created_at @created_at end |
Instance Method Details
#force_disconnect ⇒ Object
Forces the disconnection of this connection from the OpenTok session.
A client must be actively connected to the OpenTok session for you to disconnect it.
32 33 34 |
# File 'lib/opentok/connection.rb', line 32 def force_disconnect @interface.forceDisconnect(@session_id, @json['connectionId']) end |
#to_json ⇒ Object
A JSON-encoded string representation of the connection.
25 26 27 |
# File 'lib/opentok/connection.rb', line 25 def to_json @json.to_json end |