wamp_client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38ed148dd65f5a524eef4a6f6d6adaf6d832b2e4
4
- data.tar.gz: 6987c5eea6218af8562546b159a1355a8fc9493f
3
+ metadata.gz: d954c0c77e2006ba7498cf8c756a1fe62e7b36fb
4
+ data.tar.gz: ab84a9c9600defb28803571f11e64991b09fd6c0
5
5
  SHA512:
6
- metadata.gz: 7576c79cf402f373b7126c97e7af3c70c9b62217c27afe4c7fe0ab25359eb0fa489945bec2e9c6c5b972f4dc4b665d8829e7f60d0707b5540e3506e3ad4ae16e
7
- data.tar.gz: 771b11d86f4a5efa8aa13af794b07b031d656ea43f58315b01b5a50fe945495944a4ecb95ff595b690870a7a058956b3abb4412ecae1bceb9ad7f3c1165c2f7e
6
+ metadata.gz: 816e1df133c17b32942d883965da83279c8b928a307c94753cd1d1acb95dafe0d3e3062e9412c65248ef692cc292ac227a91fa320a4c092292bb1e7529ca5734
7
+ data.tar.gz: a90b9afafb5db01bc0d2d5b58e0efb27795bdb1c07f5b851e7989f05d3dd7d395c831427b3be5a8c2d08557e75b746b32fa4fca515fce6d5fcd2fa7860418911
data/README.md CHANGED
@@ -8,6 +8,8 @@ Client for talking to a WAMP Router. This is defined [here](https://tools.ietf.
8
8
 
9
9
  ## Revision History
10
10
 
11
+ - v0.0.7:
12
+ - Added 'session' to the 'details' in the callbacks and handlers
11
13
  - v0.0.6:
12
14
  - Added call cancelling
13
15
  - Added call timeout
@@ -181,7 +183,9 @@ All handlers are called with the following parameters
181
183
 
182
184
  - args [Array] - Array of arguments
183
185
  - kwargs [Hash] - Hash of key/value arguments
184
- - details [Hash] - Hash containing some details about the call
186
+ - details [Hash] - Hash containing some details about the call. Details include
187
+ - session [WampClient::Session] - The session
188
+ - etc.
185
189
 
186
190
  Some examples of this are shown below
187
191
 
@@ -208,7 +212,10 @@ All callbacks are called with the following parameters
208
212
 
209
213
  - result [Object] - Some object with the result information (depends on the call)
210
214
  - error [Hash] - Hash containing "error", "args", and "kwargs" if an error occurred
211
- - details [Hash] - Hash containing some details about the call
215
+ - details [Hash] - Hash containing some details about the call. Details include
216
+ - type [String] - The type of message
217
+ - session [WampClient::Session] - The session
218
+ - etc.
212
219
 
213
220
  An example of this is shown below
214
221
 
@@ -424,6 +424,7 @@ module WampClient
424
424
  details = {}
425
425
  details[:topic] = s[:t] unless details[:topic]
426
426
  details[:type] = 'subscribe'
427
+ details[:session] = self
427
428
 
428
429
  n_s = Subscription.new(s[:t], s[:h], s[:o], self, msg.subscription)
429
430
  self._subscriptions[msg.subscription] = n_s
@@ -444,6 +445,7 @@ module WampClient
444
445
  details = msg.details || {}
445
446
  details[:topic] = s[:t] unless details[:topic]
446
447
  details[:type] = 'subscribe'
448
+ details[:session] = self
447
449
 
448
450
  c = s[:c]
449
451
  c.call(nil, self._error_to_hash(msg), details) if c
@@ -462,6 +464,7 @@ module WampClient
462
464
  if s
463
465
  details = msg.details || {}
464
466
  details[:publication] = msg.published_publication
467
+ details[:session] = self
465
468
 
466
469
  h = s.handler
467
470
  h.call(args, kwargs, details) if h
@@ -505,6 +508,7 @@ module WampClient
505
508
  details = {}
506
509
  details[:topic] = s[:s].topic
507
510
  details[:type] = 'unsubscribe'
511
+ details[:session] = self
508
512
 
509
513
  c = s[:c]
510
514
  c.call(n_s, nil, details) if c
@@ -524,6 +528,7 @@ module WampClient
524
528
  details = msg.details || {}
525
529
  details[:topic] = s[:s].topic unless details[:topic]
526
530
  details[:type] = 'unsubscribe'
531
+ details[:session] = self
527
532
 
528
533
  c = s[:c]
529
534
  c.call(nil, self._error_to_hash(msg), details) if c
@@ -572,6 +577,7 @@ module WampClient
572
577
  details[:topic] = p[:t]
573
578
  details[:type] = 'publish'
574
579
  details[:publication] = msg.publication
580
+ details[:session] = self
575
581
 
576
582
  c = p[:c]
577
583
  c.call(p, nil, details) if c
@@ -590,6 +596,7 @@ module WampClient
590
596
  details = msg.details || {}
591
597
  details[:topic] = s[:t] unless details[:topic]
592
598
  details[:type] = 'publish'
599
+ details[:session] = self
593
600
 
594
601
  c = s[:c]
595
602
  c.call(nil, self._error_to_hash(msg), details) if c
@@ -639,6 +646,7 @@ module WampClient
639
646
  details = {}
640
647
  details[:procedure] = r[:p]
641
648
  details[:type] = 'register'
649
+ details[:session] = self
642
650
 
643
651
  c = r[:c]
644
652
  c.call(n_r, nil, details) if c
@@ -657,6 +665,7 @@ module WampClient
657
665
  details = msg.details || {}
658
666
  details[:procedure] = r[:p] unless details[:procedure]
659
667
  details[:type] = 'register'
668
+ details[:session] = self
660
669
 
661
670
  c = r[:c]
662
671
  c.call(nil, self._error_to_hash(msg), details) if c
@@ -717,6 +726,7 @@ module WampClient
717
726
 
718
727
  details = msg.details || {}
719
728
  details[:request] = request
729
+ details[:session] = self
720
730
 
721
731
  r = self._registrations[msg.registered_registration]
722
732
  if r
@@ -835,6 +845,7 @@ module WampClient
835
845
  details = {}
836
846
  details[:procedure] = r_s.procedure
837
847
  details[:type] = 'unregister'
848
+ details[:session] = self
838
849
 
839
850
  c = r[:c]
840
851
  c.call(r_s, nil, details) if c
@@ -853,6 +864,7 @@ module WampClient
853
864
  details = msg.details || {}
854
865
  details[:procedure] = r[:r].procedure unless details[:procedure]
855
866
  details[:type] = 'unregister'
867
+ details[:session] = self
856
868
 
857
869
  c = r[:c]
858
870
  c.call(nil, self._error_to_hash(msg), details) if c
@@ -918,6 +930,7 @@ module WampClient
918
930
  if call
919
931
  details[:procedure] = call[:p] unless details[:procedure]
920
932
  details[:type] = 'call'
933
+ details[:session] = self
921
934
 
922
935
  c = call[:c]
923
936
  c.call(CallResult.new(msg.yield_arguments, msg.yield_argumentskw), nil, details) if c
@@ -936,6 +949,7 @@ module WampClient
936
949
  details = msg.details || {}
937
950
  details[:procedure] = call[:p] unless details[:procedure]
938
951
  details[:type] = 'call'
952
+ details[:session] = self
939
953
 
940
954
  c = call[:c]
941
955
  c.call(nil, self._error_to_hash(msg), details) if c
@@ -26,5 +26,5 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
26
  =end
27
27
 
28
28
  module WampClient
29
- VERSION = '0.0.6'
29
+ VERSION = '0.0.7'
30
30
  end
data/spec/session_spec.rb CHANGED
@@ -167,7 +167,7 @@ describe WampClient::Session do
167
167
  expect(subscription).not_to be_nil
168
168
  expect(subscription.id).to eq(3456)
169
169
  expect(error).to be_nil
170
- expect(details).to eq({topic: 'test.topic', type: 'subscribe'})
170
+ expect(details).to eq({topic: 'test.topic', type: 'subscribe', session: session})
171
171
  end
172
172
 
173
173
  request_id = session._requests[:subscribe].keys.first
@@ -197,7 +197,7 @@ describe WampClient::Session do
197
197
 
198
198
  expect(subscription).to be_nil
199
199
  expect(error[:error]).to eq('this.failed')
200
- expect(details).to eq({fail: true, topic: 'test.topic', type: 'subscribe'})
200
+ expect(details).to eq({fail: true, topic: 'test.topic', type: 'subscribe', session: session})
201
201
  end
202
202
 
203
203
  request_id = session._requests[:subscribe].keys.first
@@ -222,7 +222,7 @@ describe WampClient::Session do
222
222
  handler = lambda do |args, kwargs, details|
223
223
  count += 1
224
224
 
225
- expect(details).to eq({test:1, publication:7890})
225
+ expect(details).to eq({test:1, publication:7890, session: session})
226
226
  expect(args).to eq([2])
227
227
  expect(kwargs).to eq({param: 'value'})
228
228
  end
@@ -299,7 +299,7 @@ describe WampClient::Session do
299
299
 
300
300
  expect(subscription.id).to eq(@subscription.id)
301
301
  expect(error).to be_nil
302
- expect(details).to eq({topic: 'test.topic', type: 'unsubscribe'})
302
+ expect(details).to eq({topic: 'test.topic', type: 'unsubscribe', session: session})
303
303
  end
304
304
 
305
305
  @request_id = session._requests[:unsubscribe].keys.first
@@ -344,7 +344,7 @@ describe WampClient::Session do
344
344
 
345
345
  expect(subscription).to be_nil
346
346
  expect(error[:error]).to eq('this.failed')
347
- expect(details).to eq({fail: true, topic: 'test.topic', type: 'unsubscribe'})
347
+ expect(details).to eq({fail: true, topic: 'test.topic', type: 'unsubscribe', session: session})
348
348
  end
349
349
 
350
350
  @request_id = session._requests[:unsubscribe].keys.first
@@ -420,7 +420,7 @@ describe WampClient::Session do
420
420
 
421
421
  expect(publication).not_to be_nil
422
422
  expect(error).to be_nil
423
- expect(details).to eq({topic: 'test.topic', type: 'publish', publication: 5678})
423
+ expect(details).to eq({topic: 'test.topic', type: 'publish', session: session, publication: 5678})
424
424
  end
425
425
 
426
426
  @request_id = session._requests[:publish].keys.first
@@ -446,7 +446,7 @@ describe WampClient::Session do
446
446
 
447
447
  expect(publication).to be_nil
448
448
  expect(error[:error]).to eq('this.failed')
449
- expect(details).to eq({fail: true, topic: 'test.topic', type: 'publish'})
449
+ expect(details).to eq({fail: true, topic: 'test.topic', type: 'publish', session: session})
450
450
  end
451
451
 
452
452
  @request_id = session._requests[:publish].keys.first
@@ -509,7 +509,7 @@ describe WampClient::Session do
509
509
  expect(registration).not_to be_nil
510
510
  expect(registration.id).to eq(3456)
511
511
  expect(error).to be_nil
512
- expect(details).to eq({procedure: 'test.procedure', type: 'register'})
512
+ expect(details).to eq({procedure: 'test.procedure', type: 'register', session: session})
513
513
  end
514
514
  request_id = session._requests[:register].keys.first
515
515
 
@@ -538,7 +538,7 @@ describe WampClient::Session do
538
538
 
539
539
  expect(registration).to be_nil
540
540
  expect(error[:error]).to eq('this.failed')
541
- expect(details).to eq({fail: true, procedure: 'test.procedure', type: 'register'})
541
+ expect(details).to eq({fail: true, procedure: 'test.procedure', type: 'register', session: session})
542
542
  end
543
543
 
544
544
  request_id = session._requests[:register].keys.first
@@ -923,7 +923,7 @@ describe WampClient::Session do
923
923
 
924
924
  expect(registration.id).to eq(@registration.id)
925
925
  expect(error).to be_nil
926
- expect(details).to eq({procedure: 'test.procedure', type: 'unregister'})
926
+ expect(details).to eq({procedure: 'test.procedure', type: 'unregister', session: session})
927
927
  end
928
928
 
929
929
  @request_id = session._requests[:unregister].keys.first
@@ -968,7 +968,7 @@ describe WampClient::Session do
968
968
 
969
969
  expect(registration).to be_nil
970
970
  expect(error[:error]).to eq('this.failed')
971
- expect(details).to eq({fail: true, procedure:'test.procedure', type: 'unregister'})
971
+ expect(details).to eq({fail: true, procedure:'test.procedure', type: 'unregister', session: session})
972
972
  end
973
973
 
974
974
  @request_id = session._requests[:unregister].keys.first
@@ -1033,7 +1033,7 @@ describe WampClient::Session do
1033
1033
  expect(result.args).to eq(['test'])
1034
1034
  expect(result.kwargs).to eq({test:true})
1035
1035
  expect(error).to be_nil
1036
- expect(details).to eq({procedure: 'test.procedure', type: 'call'})
1036
+ expect(details).to eq({procedure: 'test.procedure', type: 'call', session: session})
1037
1037
  end
1038
1038
 
1039
1039
  @request_id = session._requests[:call].keys.first
@@ -1059,7 +1059,7 @@ describe WampClient::Session do
1059
1059
 
1060
1060
  expect(result).to be_nil
1061
1061
  expect(error[:error]).to eq('this.failed')
1062
- expect(details).to eq({fail: true, procedure: 'test.procedure', type: 'call'})
1062
+ expect(details).to eq({fail: true, procedure: 'test.procedure', type: 'call', session: session})
1063
1063
  end
1064
1064
 
1065
1065
  @request_id = session._requests[:call].keys.first
@@ -1086,7 +1086,7 @@ describe WampClient::Session do
1086
1086
 
1087
1087
  expect(result).to be_nil
1088
1088
  expect(error[:error]).to eq('this.cancelled')
1089
- expect(details).to eq({fail: true, procedure: 'test.procedure', type: 'call'})
1089
+ expect(details).to eq({fail: true, procedure: 'test.procedure', type: 'call', session: session})
1090
1090
  end
1091
1091
 
1092
1092
  @request_id = session._requests[:call].keys.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wamp_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Chapman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-18 00:00:00.000000000 Z
11
+ date: 2016-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler