ruby_rabbitmq_janus 2.0.0.pre.96 → 2.0.0.pre.97

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f14fc77ab3aa5dc82b9c014c1cbd37025e0a51e7
4
- data.tar.gz: 8d354558eb4dde7213c5efa58b0f7a2939f8f28c
3
+ metadata.gz: bfdfed54c591a5d3503fb20030ad4de68722bb0a
4
+ data.tar.gz: 6f3bf55297412cf3562efe905996e6782a78d272
5
5
  SHA512:
6
- metadata.gz: ac316b42ccef9c011f50d1225b22608aebf4e6664d2a1f2948fc1741dcdd4023a383d83b298eb6af6a173a67c51b0694d5f255938b563cc018271809eaa9bf64
7
- data.tar.gz: 2a416778dc6778a1e97b44cbc5cd3856b8688771a6f4da92b2ab575ba4ab7028a6901600b35f5caa04432096641c09a874e8141daa7f1627df4d3ba5f8c4c77a
6
+ metadata.gz: 963d69675530787c2e56a3c2cdaf5c41c5333d97c389ee8212d3035fc7bdd2366baae876d158f6320c672f0168fc0118b2e18420e596d09c29e3d36df2320948
7
+ data.tar.gz: 6e9352e010b0b8b057d149bb1842e18951c02408774fe9e47c580cb614c43862453ddecf5bba0c467ba70d02669dbcc1ed76f61f8f7c2c68885f61840fc70f7f
@@ -51,6 +51,8 @@ module RubyRabbitmqJanus
51
51
  end
52
52
 
53
53
  # Return request to json format
54
+ #
55
+ # @return [String] Request to JSON format
54
56
  def to_json
55
57
  @request.to_json
56
58
  rescue => error
@@ -58,6 +60,8 @@ module RubyRabbitmqJanus
58
60
  end
59
61
 
60
62
  # Return request to json format with nice format
63
+ #
64
+ # @return [String] Request to JSON format with indent
61
65
  def to_nice_json
62
66
  JSON.pretty_generate to_hash
63
67
  rescue => error
@@ -65,6 +69,8 @@ module RubyRabbitmqJanus
65
69
  end
66
70
 
67
71
  # Return request to hash format
72
+ #
73
+ # @return [Hash] Request to Hash format
68
74
  def to_hash
69
75
  @request
70
76
  rescue => error
@@ -72,6 +78,8 @@ module RubyRabbitmqJanus
72
78
  end
73
79
 
74
80
  # Return correlation to message
81
+ #
82
+ # @return [String] Correlation string
75
83
  def correlation
76
84
  @properties.correlation
77
85
  end
@@ -6,7 +6,10 @@ module RubyRabbitmqJanus
6
6
  module Responses
7
7
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
8
8
  #
9
- # Read and decryt a response to janus
9
+ # # Read and parse a response to janus.
10
+ #
11
+ # Read a message in rabbitmq queue. This message is formatted to JSON
12
+ # or Hash format. For developpment it's possible to used a `nice` JSON.
10
13
  class Response
11
14
  # Instanciate a response
12
15
  #
@@ -23,26 +26,29 @@ module RubyRabbitmqJanus
23
26
  end
24
27
 
25
28
  # Return request to json format
29
+ #
30
+ # @return [String] Response to JSON format
26
31
  def to_json
27
32
  @request.to_json
28
33
  rescue => error
29
- Tools::Log.instance.debug "Request error [to_json] : #{@request}"
30
34
  raise Errors::JanusResponseJson, [error, @request]
31
35
  end
32
36
 
33
37
  # Return request to json format with nice format
38
+ #
39
+ # @return [String] Response to JSON format with indent
34
40
  def to_nice_json
35
41
  JSON.pretty_generate to_hash
36
42
  rescue => error
37
- Tools::Log.instance.debug "Request error [to_nice_json] : #{@request}"
38
43
  raise Errors::JanusResponsePrettyJson, error
39
44
  end
40
45
 
41
46
  # Return request to hash format
47
+ #
48
+ # @return [Hash] Response to Hash foramt
42
49
  def to_hash
43
50
  @request
44
51
  rescue => error
45
- Tools::Log.instance.debug "Request error [to_hash] : #{@request}"
46
52
  raise Errors::JanusResponseHash, [error, @request]
47
53
  end
48
54
 
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Janus::Messages::Message, type: :messages,
6
+ name: :message do
7
+ before { gateway }
8
+ let(:template) { 'base::info' }
9
+ let(:msg_new) { RubyRabbitmqJanus::Janus::Messages::Message.new(template) }
10
+
11
+ describe '#to_json' do
12
+ let(:message) { msg_new.to_json }
13
+
14
+ include_examples 'message is', String
15
+ end
16
+
17
+ describe '#to_hash' do
18
+ let(:message) { msg_new.to_nice_json }
19
+
20
+ include_examples 'message is', String
21
+ end
22
+
23
+ describe '#to_nice_json' do
24
+ let(:message) { msg_new.to_hash }
25
+
26
+ include_examples 'message is', Hash
27
+ end
28
+
29
+ describe '#correlation' do
30
+ it { expect(msg_new.correlation).to be_kind_of(String) }
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RubyRabbitmqJanus::Janus::Messages::Standard, type: :messages,
6
+ name: :standard do
7
+ let(:template) { 'base::info' }
8
+ let(:msg_new) { RubyRabbitmqJanus::Janus::Messages::Standard.new(template) }
9
+
10
+ describe '#options' do
11
+ it { expect(msg_new.options).to be_kind_of(Hash) }
12
+ end
13
+ end
data/spec/spec_helper.rb CHANGED
@@ -42,7 +42,8 @@ RSpec.configure do |config|
42
42
  config.before(:example, level: :base) { gateway }
43
43
  config.before(:example, level: :peer) { gateway }
44
44
  config.before(:example, level: :admin) { gateway_admin }
45
- config.before(:example, name: :response) { gateway }
45
+ config.before(:example, type: :responses) { gateway }
46
+ config.before(:example, type: :messages) { gateway }
46
47
  config.before(:example, name: :admin) { gateway_admin }
47
48
  config.before(:example, name: :event) { gateway }
48
49
  config.before(:example, name: :standard) { gateway }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples 'message is' do |type|
4
+ it { expect(message).to be_kind_of(type) }
5
+ end
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: 2.0.0.pre.96
4
+ version: 2.0.0.pre.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-16 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -354,6 +354,8 @@ files:
354
354
  - spec/request/peer/request_offer_spec.rb
355
355
  - spec/request/peer/request_trickle_spec.rb
356
356
  - spec/request/peer/request_trickles_spec.rb
357
+ - spec/rrj/messages/messages_message_spec.rb
358
+ - spec/rrj/messages/messages_standard_spec.rb
357
359
  - spec/rrj/responses/responses_admin_spec.rb
358
360
  - spec/rrj/responses/responses_event_spec.rb
359
361
  - spec/rrj/responses/responses_response_spec.rb
@@ -370,6 +372,7 @@ files:
370
372
  - spec/spec_helper.rb
371
373
  - spec/support/aruba.rb
372
374
  - spec/support/examples_config.rb
375
+ - spec/support/examples_message.rb
373
376
  - spec/support/examples_request.rb
374
377
  - spec/support/examples_response.rb
375
378
  - spec/support/schemas/config/config.json