ruby_rabbitmq_janus 1.1.12 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +127 -0
  3. data/Rakefile +1 -3
  4. data/config/default.md +14 -14
  5. data/config/default.yml +12 -18
  6. data/config/requests.md +80 -0
  7. data/config/requests/{channel → peer}/answer.json +1 -1
  8. data/config/requests/{channel → peer}/offer.json +0 -0
  9. data/lib/generators/ruby_rabbitmq_janus/install_generator.rb +1 -0
  10. data/lib/rrj/errors/config.rb +8 -1
  11. data/lib/rrj/errors/error.rb +18 -5
  12. data/lib/rrj/errors/janus.rb +4 -2
  13. data/lib/rrj/errors/janus_message.rb +19 -15
  14. data/lib/rrj/errors/janus_response.rb +13 -26
  15. data/lib/rrj/errors/janus_transaction.rb +7 -13
  16. data/lib/rrj/errors/rabbit.rb +3 -9
  17. data/lib/rrj/info.rb +1 -1
  18. data/lib/rrj/init.rb +118 -68
  19. data/lib/rrj/janus/processus/concurrency.rb +8 -22
  20. data/lib/rrj/janus/processus/event.rb +13 -15
  21. data/lib/rrj/janus/processus/keepalive.rb +20 -15
  22. data/lib/rrj/janus/responses/response.rb +0 -1
  23. data/lib/rrj/janus/transactions/admin.rb +14 -22
  24. data/lib/rrj/janus/transactions/handle.rb +19 -33
  25. data/lib/rrj/janus/transactions/session.rb +13 -6
  26. data/lib/rrj/janus/transactions/transaction.rb +16 -24
  27. data/lib/rrj/rabbit/connect.rb +3 -4
  28. data/lib/rrj/rabbit/propertie.rb +6 -9
  29. data/lib/rrj/rabbit/publish/admin.rb +1 -1
  30. data/lib/rrj/rabbit/publish/base_publisher.rb +5 -0
  31. data/lib/rrj/rabbit/publish/listener.rb +1 -1
  32. data/lib/rrj/rabbit/publish/non_exclusive.rb +1 -1
  33. data/lib/rrj/tools/config.rb +44 -18
  34. data/lib/rrj/tools/log.rb +30 -15
  35. data/lib/rrj/tools/replaces/admin.rb +1 -3
  36. data/lib/rrj/tools/replaces/replace.rb +1 -6
  37. data/lib/rrj/tools/requests.rb +8 -8
  38. data/lib/rrj/tools/tools.rb +0 -1
  39. data/lib/ruby_rabbitmq_janus.rb +1 -0
  40. data/spec/request/admin/request_handle_info_spec.rb +3 -3
  41. data/spec/request/base/request_attach_spec.rb +7 -10
  42. data/spec/request/base/request_detach_spec.rb +6 -9
  43. data/spec/request/peer/request_answer_spec.rb +66 -0
  44. data/spec/request/peer/request_offer_spec.rb +113 -0
  45. data/spec/request/peer/request_trickle_spec.rb +9 -11
  46. data/spec/rrj/rrj_log_spec.rb +1 -6
  47. data/spec/spec_helper.rb +0 -1
  48. data/spec/support/examples.rb +6 -9
  49. data/spec/support/schemas/config/config.json +20 -32
  50. data/spec/support/schemas/request/peer/answer.json +15 -0
  51. data/spec/support/schemas/request/peer/offer.json +15 -0
  52. data/spec/support/schemas/request/peer/trickle.json +4 -12
  53. metadata +10 -19
  54. data/config/requests/channel/README.md +0 -29
  55. data/config/requests/channel/create.json +0 -9
  56. data/config/requests/channel/describe.json +0 -10
  57. data/config/requests/channel/destroy.json +0 -10
  58. data/config/requests/channel/exists.json +0 -10
  59. data/config/requests/channel/join.json +0 -11
  60. data/config/requests/channel/leave.json +0 -11
  61. data/config/requests/channel/list.json +0 -9
  62. data/config/requests/channel/select.json +0 -11
  63. data/config/requests/channel/trickle.json +0 -10
  64. data/config/requests/videocast/join.json +0 -12
  65. data/config/requests/videocast/leave.json +0 -11
  66. data/config/ruby-rabbitmq-janus.yml +0 -27
  67. data/lib/rrj/errors/request.rb +0 -21
  68. data/lib/rrj/tools/env.rb +0 -22
@@ -1,29 +0,0 @@
1
- # Channel
2
-
3
- How to use gem for channels
4
-
5
- For each example initialize a gem with command : `t = RubyRabbitmqJanus::RRJ.new`
6
-
7
- ## List channels
8
-
9
- ```ruby
10
- # Create a session
11
- create = t.ask('create')
12
- session = t.response(create)
13
-
14
- # Attach a session to plugin
15
- attach = t.ask('attach', session)
16
- session = t.response(attach)
17
-
18
- # List a channels
19
- list = t.ask('channel::list', session)
20
- session = t.response(list)
21
-
22
- # Detach a session
23
- detach = t.ask('detach', session)
24
- session = t.response(detach)
25
-
26
- # Destroy a session
27
- destroy = t.ask('destroy', session)
28
- session = t.response(destroy)
29
- ```
@@ -1,9 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "create"
8
- }
9
- }
@@ -1,10 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "describe",
8
- "channel": "<number>"
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "destroy",
8
- "channel": "<number>"
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "exists",
8
- "channel": "<number>"
9
- }
10
- }
@@ -1,11 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "join",
8
- "channel": "<number>",
9
- "type": "<string>"
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "leave",
8
- "videocast": "<number>",
9
- "channel": "<number>"
10
- }
11
- }
@@ -1,9 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "list"
8
- }
9
- }
@@ -1,11 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "select",
8
- "channel": "<number>",
9
- "videocast": "<number>"
10
- }
11
- }
@@ -1,10 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "trickle",
8
- "candidate": "<array>"
9
- }
10
- }
@@ -1,12 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "join",
8
- "channel": "<number>",
9
- "videocast": "<number>",
10
- "type": "<string>"
11
- }
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "janus": "message",
3
- "session_id": "<number>",
4
- "handle_id": "<number>",
5
- "transaction": "<string>",
6
- "body": {
7
- "request": "leave",
8
- "videocast": "<number>",
9
- "channel": "<number>"
10
- }
11
- }
@@ -1,27 +0,0 @@
1
- rabbit:
2
- host: localhost
3
- port: 5672
4
- vhost: /
5
- user: dazzl_admin
6
- pass: koMpmVU8
7
- admin_pass: Guj9khoN
8
-
9
- queues:
10
- queue_from: from-janus
11
- queue_to: to-janus
12
- admin:
13
- queue_from: from-janus-admin
14
- queue_to: to-janus-admin
15
-
16
- janus:
17
- plugins:
18
- - janus.plugin.dazzl.videocontrol
19
-
20
- gem:
21
- log:
22
- level: DEBUG
23
- session:
24
- keepalive: 59
25
- thread:
26
- enable: false
27
- number: 1
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyRabbitmqJanus
4
- module Errors
5
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
6
- # Define errors with Rabbitmq when connection is failed
7
- class RequestTemplateNotExist < Errors::RRJError
8
- def initialize(request_name)
9
- super "The template request (#{request_name}) does not exist", :fatal
10
- end
11
- end
12
-
13
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
14
- # Define errors if request folder does not exist
15
- class RequestFolerDoesntExist < Errors::RRJError
16
- def initialize
17
- super 'The requests folder does not exist', :fatal
18
- end
19
- end
20
- end
21
- end
data/lib/rrj/tools/env.rb DELETED
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
- # :reek:UtilityFunction
3
-
4
- module RubyRabbitmqJanus
5
- # Contains all tools necessary in this gem
6
- module Tools
7
- # Class for tools used in gem
8
- class Env
9
- include Singleton
10
-
11
- # Test if a string contains a word ENV
12
- def test_env_var(configuration, key)
13
- test = configuration[key.to_s]
14
- if test.is_a?(String) && test.include?('ENV')
15
- ENV[test.gsub("ENV['", '').gsub("']", '')]
16
- else
17
- test
18
- end
19
- end
20
- end
21
- end
22
- end