Sha256: f46de5e8b5799ed6445f83b6afabbc99c62528eb8cb74f3c54b31a08fb1a3407

Contents?: true

Size: 1008 Bytes

Versions: 15

Compression:

Stored size: 1008 Bytes

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Janus
    # Modules for manipulate responses sending by Janus
    module Responses
      # Response for events message
      class Standard < Response
        # Return a response simple for client
        def for_plugin
          case request['janus']
          when 'success' then request['plugindata']['data']
          when 'ack' then {}
          end
        rescue => error
          Tools::Log.instance.debug "Request error : #{request}"
          raise Errors::JanusResponsePluginData, error
        end

        # Return a integer to session
        def session
          data_id
        end

        # Return a integer to handle
        def sender
          data_id
        end

        private

        # Read a hash and return an identifier
        def data_id
          analysis
          request['data']['id'].to_i
        rescue => error
          raise Errors::JanusResponseDataId, error
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-1.1.11 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.10 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.9 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.8 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.7 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.6 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.5 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.4 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.3 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.2 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.1 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.1.0 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.0.8 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.0.7 lib/rrj/janus/responses/standard.rb
ruby_rabbitmq_janus-1.0.6 lib/rrj/janus/responses/standard.rb