ruby_rabbitmq_janus 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rrj/info.rb +1 -1
- data/lib/rrj/init.rb +15 -2
- data/lib/rrj/janus/processus/event.rb +2 -2
- data/lib/rrj/janus/responses/event.rb +5 -0
- data/lib/rrj/janus/responses/response.rb +1 -2
- data/lib/rrj/janus/transactions/transaction.rb +2 -3
- data/lib/rrj/rabbit/connect.rb +1 -1
- data/lib/rrj/rabbit/publish/admin.rb +1 -0
- data/lib/rrj/rabbit/publish/exclusive.rb +1 -0
- data/lib/rrj/rabbit/publish/listener.rb +1 -0
- data/lib/rrj/rabbit/publish/non_exclusive.rb +1 -0
- data/lib/rrj/tools/config.rb +0 -1
- data/lib/rrj/tools/env.rb +1 -1
- data/lib/rrj/tools/log.rb +1 -2
- data/lib/rrj/tools/replaces.rb +2 -2
- data/listen.rb +11 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4878f39325bc19260e50a953e77acfadfda78eb9
|
4
|
+
data.tar.gz: bea625c521c11a72fec35463c9dcd502d0cb740f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d6da165b55dac47eabfcf856b8689f053a673de18b7df026c2364803f135d6dcdf494fd74f8f5b462fb81fea9dcb6b3be7846355d331841ee9fdf2b75de2144
|
7
|
+
data.tar.gz: 4742b640660dbc6aee4e4c8dff7a1bb99f9b8fd8af5281c211dde372ec571cb8c92178a59f951149bb587170482197f59ad1673a82678efd7e0b4b87ecd56ded
|
data/lib/rrj/info.rb
CHANGED
data/lib/rrj/init.rb
CHANGED
@@ -15,9 +15,10 @@ module RubyRabbitmqJanus
|
|
15
15
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
16
16
|
# Initialize gem and create automatically an session with Janus
|
17
17
|
# @!attribute [r] session
|
18
|
+
# @return [Fixnum] Renturn an session number created in instanciate gem
|
18
19
|
# :reek:BooleanParameter and :reek:ControlParameter and :reek:DataClump
|
19
20
|
class RRJ
|
20
|
-
attr_reader :session
|
21
|
+
attr_reader :session
|
21
22
|
|
22
23
|
# Returns a new instance of RubyRabbitmqJanus
|
23
24
|
def initialize
|
@@ -119,7 +120,19 @@ module RubyRabbitmqJanus
|
|
119
120
|
@transaction.handle_running_stop
|
120
121
|
end
|
121
122
|
|
122
|
-
# Start an short transaction
|
123
|
+
# Start an short transaction. Create an handle and send a message to queue.
|
124
|
+
# This queue is not exclusive, so this message is sending in queue 'to-janus' and a
|
125
|
+
# response is return in queue 'from-janus'
|
126
|
+
# @example Send an request trickle
|
127
|
+
# candidate = {
|
128
|
+
# 'candidate' => {
|
129
|
+
# 'sdpMid' => 'video',
|
130
|
+
# 'sdpMLineIndex' => 1,
|
131
|
+
# 'candidate' => '...'
|
132
|
+
# }
|
133
|
+
# }
|
134
|
+
# RubyRabbitmqJanus::RRJ.new.handle_message_simple('peer::trickle', candidate)
|
135
|
+
# #=> { 'janus' => 'trickle', ..., 'candidate' => { 'completed' : true } } }
|
123
136
|
def handle_message_simple(type, replace = {}, add = {})
|
124
137
|
@transaction = Janus::Transactions::Handle.new(@session)
|
125
138
|
@transaction.handle_connect_and_stop(false) do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:InstanceVariableAssumption and :reek:NilCheck
|
3
|
+
# :reek:TooManyInstanceVariables and :reek:TooManyStatements
|
2
4
|
|
3
5
|
module RubyRabbitmqJanus
|
4
6
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
5
7
|
module Janus
|
6
8
|
module Concurrencies
|
7
9
|
# For listen standard queue ("from-janus" by default)
|
8
|
-
# :reek:InstanceVariableAssumption and :reek:NilCheck
|
9
|
-
# :reek:TooManyInstanceVariables and :reek:TooManyStatements
|
10
10
|
class Event < Concurrency
|
11
11
|
include Singleton
|
12
12
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:TooManyMethods and :reek:DuplicateMethodCall
|
2
3
|
|
3
4
|
module RubyRabbitmqJanus
|
4
5
|
module Janus
|
@@ -6,7 +7,6 @@ module RubyRabbitmqJanus
|
|
6
7
|
module Responses
|
7
8
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
8
9
|
# Read and decryt a response to janus
|
9
|
-
# :reek:TooManyMethods
|
10
10
|
class Response
|
11
11
|
# Instanciate a response
|
12
12
|
def initialize(response_janus)
|
@@ -49,7 +49,6 @@ module RubyRabbitmqJanus
|
|
49
49
|
attr_accessor :request
|
50
50
|
|
51
51
|
# Analysis response and send exception if janus return an error
|
52
|
-
# :reek:DuplicateMethodCall
|
53
52
|
def analysis
|
54
53
|
raise Errors::JanusResponseSimple, @request if error_simple?
|
55
54
|
raise Errors::JanusResponsePlugin, @request['plugindata']['data'] \
|
@@ -1,4 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:TooManyInstanceVariables and :reek:ControlParameter
|
3
|
+
# :reek:ControlParameter and :reek:BooleanParameter
|
2
4
|
|
3
5
|
module RubyRabbitmqJanus
|
4
6
|
module Janus
|
@@ -6,7 +8,6 @@ module RubyRabbitmqJanus
|
|
6
8
|
module Transactions
|
7
9
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
8
10
|
# This class work with janus and send a series of message
|
9
|
-
# :reek:TooManyInstanceVariables
|
10
11
|
class Transaction
|
11
12
|
# Initialize an transaction
|
12
13
|
def initialize(session)
|
@@ -30,7 +31,6 @@ module RubyRabbitmqJanus
|
|
30
31
|
attr_reader :rabbit, :session, :response, :handle, :publish
|
31
32
|
|
32
33
|
# determine queue used
|
33
|
-
# :reek:ControlParameter and :reek:BooleanParameter
|
34
34
|
def choose_queue(exclusive)
|
35
35
|
chan = @rabbit.channel
|
36
36
|
@publish = if exclusive
|
@@ -52,7 +52,6 @@ module RubyRabbitmqJanus
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# Read a response if is a exclusive message
|
55
|
-
# :reek:ControlParameter
|
56
55
|
def read_response(publish, exclusive)
|
57
56
|
if exclusive
|
58
57
|
Tools::Log.instance.info '... and read a janus response'
|
data/lib/rrj/rabbit/connect.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:FeatureEnvy
|
2
3
|
|
3
4
|
module RubyRabbitmqJanus
|
4
5
|
module Rabbit
|
@@ -49,7 +50,6 @@ module RubyRabbitmqJanus
|
|
49
50
|
private
|
50
51
|
|
51
52
|
# Read option for bunny instance (connection with rabbitmq)
|
52
|
-
# :reek:FeatureEnvy
|
53
53
|
def read_options_server
|
54
54
|
cfg = Tools::Config.instance.options['rabbit']
|
55
55
|
opts = {}
|
data/lib/rrj/tools/config.rb
CHANGED
@@ -31,7 +31,6 @@ module RubyRabbitmqJanus
|
|
31
31
|
# Load configuration file yaml
|
32
32
|
# @return [Yaml] Configuration file
|
33
33
|
# @param file [String] Path to configuration file (with name)
|
34
|
-
# :reek:UtilityFunction { public_methods_only: true }
|
35
34
|
def load_configuration(file)
|
36
35
|
Tools::Log.instance.info("Loading configuration file : #{file}")
|
37
36
|
YAML.load(File.read(file))
|
data/lib/rrj/tools/env.rb
CHANGED
data/lib/rrj/tools/log.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:Attribute and :reek:UtilityFunction
|
2
3
|
|
3
4
|
module RubyRabbitmqJanus
|
4
5
|
module Tools
|
@@ -17,7 +18,6 @@ module RubyRabbitmqJanus
|
|
17
18
|
UNKNOWN: Logger::UNKNOWN
|
18
19
|
}.freeze
|
19
20
|
|
20
|
-
# This method smell :reek:Attribute
|
21
21
|
attr_accessor :level, :progname
|
22
22
|
|
23
23
|
# Returns a new instance to Log
|
@@ -93,7 +93,6 @@ module RubyRabbitmqJanus
|
|
93
93
|
log
|
94
94
|
end
|
95
95
|
|
96
|
-
# This method smell :reek:UtilityFunction
|
97
96
|
def test_level?(this_level)
|
98
97
|
this_level >= Log.instance.level ? true : false
|
99
98
|
end
|
data/lib/rrj/tools/replaces.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# :reek:TooManyMethods and :reek:NilCheck
|
2
3
|
|
3
4
|
module RubyRabbitmqJanus
|
4
5
|
module Tools
|
5
6
|
# Format message request with good data to HASH format
|
6
7
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
7
|
-
# :reek:TooManyMethods
|
8
8
|
# rubocop:disable Metrics/ClassLength
|
9
9
|
class Replace
|
10
10
|
# Initialize a tool replace
|
@@ -73,6 +73,7 @@ module RubyRabbitmqJanus
|
|
73
73
|
Tools::Log.instance.warn "Error candidate replace : #{message}"
|
74
74
|
end
|
75
75
|
|
76
|
+
# Save candidate or candidates in request
|
76
77
|
def save_candidate(value)
|
77
78
|
if @opts.key?('candidates')
|
78
79
|
@request['candidates'] = value
|
@@ -135,7 +136,6 @@ module RubyRabbitmqJanus
|
|
135
136
|
end
|
136
137
|
|
137
138
|
# Test presence of key in many hash
|
138
|
-
# :reek:NilCheck
|
139
139
|
def test_presence?(presence_of_key)
|
140
140
|
@opts.key?(presence_of_key) && \
|
141
141
|
@request.key?('body') && \
|
data/listen.rb
CHANGED
@@ -6,19 +6,16 @@ require 'ruby_rabbitmq_janus'
|
|
6
6
|
@t = RubyRabbitmqJanus::RRJ.new
|
7
7
|
@e = RubyRabbitmqJanus::Janus::Concurrencies::Event.instance
|
8
8
|
|
9
|
-
# :reek:NilCheck and :reek:TooManyStatements
|
10
9
|
def case_event(data, jsep)
|
11
|
-
puts "REASON : Event : #{data
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
update_jsep(jsep) unless jsep.nil?
|
10
|
+
puts "REASON : Event : #{data} -- #{jsep}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def case_hangup(data)
|
14
|
+
puts "REASON : Hangup : #{data}"
|
18
15
|
end
|
19
16
|
|
20
|
-
def
|
21
|
-
puts "
|
17
|
+
def case_error(data)
|
18
|
+
puts "REASON : Error : #{data}"
|
22
19
|
end
|
23
20
|
|
24
21
|
def case_stop
|
@@ -26,14 +23,17 @@ def case_stop
|
|
26
23
|
Thread.current.stop
|
27
24
|
end
|
28
25
|
|
29
|
-
events = lambda do |reason, data
|
26
|
+
events = lambda do |reason, data, jsep = nil|
|
30
27
|
puts "Execute block code with reason : #{reason}"
|
31
28
|
case reason
|
32
29
|
when 'event' then case_event(data, jsep)
|
30
|
+
when 'hangup' then case_hangup(data)
|
31
|
+
when 'error' then case_error(data)
|
33
32
|
when 'stop' then case_stop
|
34
33
|
else
|
35
34
|
puts 'REASON default'
|
36
35
|
end
|
36
|
+
puts " --\n\r"
|
37
37
|
end
|
38
38
|
|
39
39
|
puts '## Start listen Block'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_rabbitmq_janus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VAILLANT Jeremy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|