Sha256: e9253f55940dfac7c782bc6cdbcc0527642b1215a9bf2bc4a6555a52d834ccb7

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

module OpenTok
  #  A class for working with OpenTok connections.
  class Connections
    # @private
    def initialize(client)
      @client = client
    end

    # Force a client to disconnect from an OpenTok session.
    #
    # A client must be actively connected to the OpenTok session for you to disconnect it.
    #
    # @param [String] session_id The session ID of the OpenTok session.
    # @param [String] connection_id The connection ID of the client in the session.
    #
    # @raise [ArgumentError] The connection_id or session_id is invalid.
    # @raise [OpenTokAuthenticationError] You are not authorized to disconnect the connection. Check your authentication credentials.
    # @raise [OpenTokConnectionError] The client specified by the connection_id  property is not connected to the session.
    #
    def forceDisconnect(session_id, connection_id )
      raise ArgumentError, "session_id not provided" if session_id.to_s.empty?
      raise ArgumentError, "connection_id not provided" if connection_id.to_s.empty?
      response = @client.forceDisconnect(session_id, connection_id)
      (200..300).include? response.code
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
opentok-4.12.0 lib/opentok/connections.rb
opentok-4.11.0 lib/opentok/connections.rb
opentok-4.10.0 lib/opentok/connections.rb
opentok-4.9.0 lib/opentok/connections.rb
opentok-4.8.1 lib/opentok/connections.rb
opentok-4.8.0 lib/opentok/connections.rb
opentok-4.7.1 lib/opentok/connections.rb
opentok-4.7.0 lib/opentok/connections.rb
opentok-4.6.0 lib/opentok/connections.rb
opentok-4.5.1 lib/opentok/connections.rb
opentok-4.5.0 lib/opentok/connections.rb
opentok-4.4.0 lib/opentok/connections.rb
opentok-4.3.0 lib/opentok/connections.rb