wamp_client 0.0.9 → 0.1.0

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -26
  3. data/lib/{wamp_client.rb → wamp/client.rb} +8 -8
  4. data/lib/{wamp_client → wamp/client}/auth.rb +13 -11
  5. data/lib/wamp/client/check.rb +86 -0
  6. data/lib/wamp/client/connection.rb +249 -0
  7. data/lib/{wamp_client → wamp/client}/defer.rb +29 -27
  8. data/lib/wamp/client/message.rb +1322 -0
  9. data/lib/{wamp_client → wamp/client}/serializer.rb +26 -24
  10. data/lib/wamp/client/session.rb +1001 -0
  11. data/lib/wamp/client/transport/base.rb +152 -0
  12. data/lib/{wamp_client → wamp/client}/transport/event_machine_base.rb +19 -17
  13. data/lib/wamp/client/transport/faye_web_socket.rb +85 -0
  14. data/lib/wamp/client/transport/web_socket_event_machine.rb +88 -0
  15. data/lib/{wamp_client → wamp/client}/version.rb +5 -3
  16. data/scripts/gen_message.rb +54 -53
  17. data/spec/spec_helper.rb +3 -3
  18. data/spec/{auth_spec.rb → wamp/client/auth_spec.rb} +2 -2
  19. data/spec/{check_spec.rb → wamp/client/check_spec.rb} +2 -2
  20. data/spec/{connection_spec.rb → wamp/client/connection_spec.rb} +7 -7
  21. data/spec/{message_spec.rb → wamp/client/message_spec.rb} +298 -298
  22. data/spec/{session_spec.rb → wamp/client/session_spec.rb} +134 -134
  23. data/spec/{transport_spec.rb → wamp/client/transport_spec.rb} +4 -4
  24. data/wamp_client.gemspec +2 -2
  25. metadata +50 -50
  26. data/lib/wamp_client/check.rb +0 -84
  27. data/lib/wamp_client/connection.rb +0 -247
  28. data/lib/wamp_client/message.rb +0 -1348
  29. data/lib/wamp_client/session.rb +0 -1000
  30. data/lib/wamp_client/transport/base.rb +0 -151
  31. data/lib/wamp_client/transport/faye_web_socket.rb +0 -83
  32. data/lib/wamp_client/transport/web_socket_event_machine.rb +0 -86
@@ -0,0 +1,152 @@
1
+ =begin
2
+
3
+ Copyright (c) 2018 Eric Chapman
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ =end
27
+
28
+ require 'wamp/client/serializer'
29
+
30
+ module Wamp
31
+ module Client
32
+ module Transport
33
+ class Base
34
+
35
+ # Callback when the socket is opened
36
+ @on_open
37
+ def on_open(&on_open)
38
+ @on_open = on_open
39
+ end
40
+
41
+ # Callback when the socket is closed. Parameters are
42
+ # @param reason [String] String telling the reason it was closed
43
+ @on_close
44
+ def on_close(&on_close)
45
+ @on_close = on_close
46
+ end
47
+
48
+ # Callback when a message is received. Parameters are
49
+ # @param msg [Array] The parsed message that was received
50
+ @on_message
51
+ def on_message(&on_message)
52
+ @on_message = on_message
53
+ end
54
+
55
+ # Callback when there is an error. Parameters are
56
+ # @param msg [String] The message from the error
57
+ @on_error
58
+ def on_error(&on_error)
59
+ @on_error = on_error
60
+ end
61
+
62
+ # Simple setter for callbacks
63
+ def on(event, &callback)
64
+ case event
65
+ when :open
66
+ self.on_open(&callback)
67
+ when :close
68
+ self.on_close(&callback)
69
+ when :message
70
+ self.on_message(&callback)
71
+ when :error
72
+ self.on_error(&callback)
73
+ else
74
+ raise RuntimeError, "Unknown on(event) '#{event}'"
75
+ end
76
+ end
77
+
78
+ attr_accessor :uri, :proxy, :headers, :protocol, :serializer, :connected
79
+
80
+ # Constructor for the transport
81
+ # @param options [Hash] The connection options. the different options are as follows
82
+ # @option options [String] :uri The url to connect to
83
+ # @option options [String] :proxy The proxy to use
84
+ # @option options [String] :protocol The protocol
85
+ # @option options [Hash] :headers Custom headers to include during the connection
86
+ # @option options [WampClient::Serializer::Base] :serializer The serializer to use
87
+ def initialize(options)
88
+
89
+ # Initialize the parameters
90
+ self.connected = false
91
+ self.uri = options[:uri]
92
+ self.proxy = options[:proxy]
93
+ self.headers = options[:headers] || {}
94
+ self.protocol = options[:protocol] || 'wamp.2.json'
95
+ self.serializer = options[:serializer] || Wamp::Client::Serializer::JSONSerializer.new
96
+
97
+ # Add the wamp.2.json protocol header
98
+ self.headers['Sec-WebSocket-Protocol'] = self.protocol
99
+
100
+ # Initialize callbacks
101
+ @on_open = nil
102
+ @on_close = nil
103
+ @on_message = nil
104
+ @on_error = nil
105
+
106
+ end
107
+
108
+ # Connects to the WAMP Server using the transport
109
+ def connect
110
+ # Implement in subclass
111
+ end
112
+
113
+ # Disconnects from the WAMP Server
114
+ def disconnect
115
+ # Implement in subclass
116
+ end
117
+
118
+ # Returns true if the transport it connected
119
+ def connected?
120
+ self.connected
121
+ end
122
+
123
+ # Sends a Message
124
+ # @param [Array] msg - The message payload to send
125
+ def send_message(msg)
126
+ # Implement in subclass
127
+ end
128
+
129
+ # Process the callback when the timer expires
130
+ # @param [Integer] milliseconds - The number
131
+ # @param [block] callback - The callback that is fired when the timer expires
132
+ def self.add_timer(milliseconds, &callback)
133
+ # Implement in subclass
134
+ end
135
+ def add_timer(milliseconds, &callback)
136
+ self.class.add_timer(milliseconds, &callback)
137
+ end
138
+
139
+ # Method to start the event machine for the socket
140
+ def self.start_event_machine(&block)
141
+ # Implement in subclass
142
+ end
143
+
144
+ # Method to stop the vent machine
145
+ def self.stop_event_machine
146
+ # Implement in subclass
147
+ end
148
+
149
+ end
150
+ end
151
+ end
152
+ end
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
 
3
- Copyright (c) 2016 Eric Chapman
3
+ Copyright (c) 2018 Eric Chapman
4
4
 
5
5
  MIT License
6
6
 
@@ -28,27 +28,29 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  require 'eventmachine'
29
29
  require_relative 'base'
30
30
 
31
- module WampClient
32
- module Transport
33
- class EventMachineBase < Base
31
+ module Wamp
32
+ module Client
33
+ module Transport
34
+ class EventMachineBase < Base
34
35
 
35
- def self.start_event_machine(&block)
36
- EM.run do
37
- block.call
36
+ def self.start_event_machine(&block)
37
+ EM.run do
38
+ block.call
39
+ end
38
40
  end
39
- end
40
41
 
41
- def self.stop_event_machine
42
- EM.stop
43
- end
42
+ def self.stop_event_machine
43
+ EM.stop
44
+ end
44
45
 
45
- def self.add_timer(milliseconds, &callback)
46
- delay = (milliseconds.to_f/1000.0).ceil
47
- EM.add_timer(delay) {
48
- callback.call
49
- }
50
- end
46
+ def self.add_timer(milliseconds, &callback)
47
+ delay = (milliseconds.to_f/1000.0).ceil
48
+ EM.add_timer(delay) {
49
+ callback.call
50
+ }
51
+ end
51
52
 
53
+ end
52
54
  end
53
55
  end
54
56
  end
@@ -0,0 +1,85 @@
1
+ =begin
2
+
3
+ Copyright (c) 2018 Eric Chapman
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ =end
27
+
28
+ require_relative 'event_machine_base'
29
+
30
+ # This implementation uses the 'faye-websocket' Gem.
31
+ module Wamp
32
+ module Client
33
+ module Transport
34
+ class FayeWebSocket < EventMachineBase
35
+ attr_accessor :socket
36
+
37
+ def initialize(options)
38
+ super(options)
39
+ self.socket = nil
40
+
41
+ # Only make them include the gem if they are going to use it
42
+ require 'faye/websocket'
43
+ end
44
+
45
+ def connect
46
+ options = { :headers => self.headers }
47
+ options[:proxy] = self.proxy if self.proxy != nil
48
+ self.socket = Faye::WebSocket::Client.new(self.uri, [self.protocol], options)
49
+
50
+ self.socket.on(:open) do |event|
51
+ self.connected = true
52
+ @on_open.call if @on_open
53
+ end
54
+
55
+ self.socket.on(:message) do |event|
56
+ @on_message.call(self.serializer.deserialize(event.data)) if @on_message
57
+ end
58
+
59
+ self.socket.on(:close) do |event|
60
+ self.connected = false
61
+ @on_close.call(event.reason) if @on_close
62
+ end
63
+
64
+ self.socket.on(:error) do |event|
65
+ @on_error.call(event.message) if @on_error
66
+ end
67
+ end
68
+
69
+ def disconnect
70
+ self.socket.close
71
+ self.connected = false
72
+ end
73
+
74
+ def send_message(msg)
75
+ if self.connected
76
+ self.socket.send(self.serializer.serialize(msg))
77
+ else
78
+ raise RuntimeError, "Socket must be open to call 'send_message'"
79
+ end
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,88 @@
1
+ =begin
2
+
3
+ Copyright (c) 2018 Eric Chapman
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ =end
27
+
28
+ require_relative 'event_machine_base'
29
+
30
+ # This implementation uses the 'websocket-eventmachine-client' Gem.
31
+ # This is the default if no transport is included
32
+ module Wamp
33
+ module Client
34
+ module Transport
35
+ class WebSocketEventMachine < EventMachineBase
36
+ attr_accessor :socket
37
+
38
+ def initialize(options)
39
+ super(options)
40
+ self.socket = nil
41
+
42
+ # Only make them include the gem if they are going to use it
43
+ require 'websocket-eventmachine-client'
44
+
45
+ # Raise an exception if proxy was included (not supported)
46
+ if self.proxy != nil
47
+ raise RuntimeError, "The WebSocketEventMachine transport does not support 'proxy'. Try using 'faye-websocket' transport instead"
48
+ end
49
+ end
50
+
51
+ def connect
52
+ self.socket = WebSocket::EventMachine::Client.connect(
53
+ :uri => self.uri,
54
+ :headers => self.headers
55
+ )
56
+
57
+ self.socket.onopen do
58
+ self.connected = true
59
+ @on_open.call if @on_open
60
+ end
61
+
62
+ self.socket.onmessage do |msg, type|
63
+ @on_message.call(self.serializer.deserialize(msg)) if @on_message
64
+ end
65
+
66
+ self.socket.onclose do |code, reason|
67
+ self.connected = false
68
+ @on_close.call(reason) if @on_close
69
+ end
70
+ end
71
+
72
+ def disconnect
73
+ self.connected = !self.socket.close # close returns 'true' if the connection was closed immediately
74
+ end
75
+
76
+ def send_message(msg)
77
+ if self.connected
78
+ self.socket.send(self.serializer.serialize(msg), {type: 'text'})
79
+ else
80
+ raise RuntimeError, "Socket must be open to call 'send_message'"
81
+ end
82
+ end
83
+
84
+ end
85
+ end
86
+ end
87
+ end
88
+
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
 
3
- Copyright (c) 2016 Eric Chapman
3
+ Copyright (c) 2018 Eric Chapman
4
4
 
5
5
  MIT License
6
6
 
@@ -25,6 +25,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
25
 
26
26
  =end
27
27
 
28
- module WampClient
29
- VERSION = '0.0.9'
28
+ module Wamp
29
+ module Client
30
+ VERSION = '0.1.0'
31
+ end
30
32
  end
@@ -69,49 +69,50 @@ count = 0
69
69
  message_type_lookup.each do |name, value|
70
70
 
71
71
  # Generate the defines
72
- message_type_define += " #{name} = #{value}\n"
72
+ message_type_define += " #{name} = #{value}\n"
73
73
 
74
74
  # Generate the lookup
75
75
  if count == 0
76
- message_lookup_define += ' if'
76
+ message_lookup_define += ' if'
77
77
  else
78
- message_lookup_define += ' elsif'
78
+ message_lookup_define += ' elsif'
79
79
  end
80
80
  message_lookup_define += " params[0] == Types::#{name}\n"
81
- message_lookup_define += " object = WampClient::Message::#{name.downcase.capitalize}.parse(params)\n"
81
+ message_lookup_define += " object = Wamp::Client::Message::#{name.downcase.capitalize}.parse(params)\n"
82
82
 
83
83
  count += 1
84
84
  end
85
85
 
86
- source_file_header = "require 'wamp_client/check'
86
+ source_file_header = "require 'wamp/client/check'
87
87
 
88
88
  # !!!!THIS FILE IS AUTOGENERATED. DO NOT HAND EDIT!!!!
89
89
 
90
- module WampClient
91
- module Message
90
+ module Wamp
91
+ module Client
92
+ module Message
92
93
 
93
- module Types
94
- #{message_type_define} end
94
+ module Types
95
+ #{message_type_define} end
95
96
 
96
- class Base
97
- include WampClient::Check
97
+ class Base
98
+ include Wamp::Client::Check
98
99
 
99
- def payload
100
- []
101
- end
100
+ def payload
101
+ []
102
+ end
102
103
 
103
- # @param params [Array]
104
- def self.parse(params)
105
- object = nil
106
- #{message_lookup_define} end
104
+ # @param params [Array]
105
+ def self.parse(params)
106
+ object = nil
107
+ #{message_lookup_define} end
107
108
 
108
- object
109
+ object
110
+ end
109
111
  end
110
-
111
- end
112
112
  "
113
113
 
114
114
  source_file_footer = "
115
+ end
115
116
  end
116
117
  end
117
118
  "
@@ -120,7 +121,7 @@ test_file_header = "require 'spec_helper'
120
121
 
121
122
  # !!!!THIS FILE IS AUTOGENERATED. DO NOT HAND EDIT!!!!
122
123
 
123
- describe WampClient::Message do
124
+ describe Wamp::Client::Message do
124
125
  "
125
126
 
126
127
  test_file_footer = "
@@ -330,7 +331,7 @@ messages.each do |message|
330
331
  required_count = 0
331
332
  param_formats = ''
332
333
  message[:formats].each do |format|
333
- param_formats += ' # ' + format + "\n"
334
+ param_formats += ' # ' + format + "\n"
334
335
 
335
336
  # Generate the params
336
337
  temp_format = format.delete(' ')
@@ -367,14 +368,14 @@ messages.each do |message|
367
368
  # Source File
368
369
  ###############################################
369
370
  source_file += "\n"
370
- source_file += ' # ' + message[:name].capitalize + "\n"
371
- source_file += ' # ' + message[:description] + "\n"
372
- source_file += " # Formats:\n"
371
+ source_file += ' # ' + message[:name].capitalize + "\n"
372
+ source_file += ' # ' + message[:description] + "\n"
373
+ source_file += " # Formats:\n"
373
374
  source_file += param_formats
374
- source_file += ' class ' + message[:name].capitalize + " < Base\n"
375
+ source_file += ' class ' + message[:name].capitalize + " < Base\n"
375
376
 
376
377
  # Generate the local variables
377
- source_file += ' attr_accessor'
378
+ source_file += ' attr_accessor'
378
379
  count = 0
379
380
  params.each do |param|
380
381
  source_file += ',' unless count == 0
@@ -384,20 +385,20 @@ messages.each do |message|
384
385
  source_file += "\n"
385
386
 
386
387
  # Generate the constructor
387
- source_file += "\n def initialize("
388
+ source_file += "\n def initialize("
388
389
  count = 0
389
390
  checks = ''
390
391
  setters = ''
391
392
  params.each do |param|
392
- setters += " self.#{param[:name]} = #{param[:name]}\n"
393
+ setters += " self.#{param[:name]} = #{param[:name]}\n"
393
394
 
394
395
  source_file += ', ' if count > 0
395
396
  if param[:required]
396
397
  source_file += "#{param[:name]}"
397
- checks += " self.class.check_#{param[:type]}('#{param[:name]}', #{param[:name]})\n"
398
+ checks += " self.class.check_#{param[:type]}('#{param[:name]}', #{param[:name]})\n"
398
399
  else
399
400
  source_file += "#{param[:name]}=nil"
400
- checks += " self.class.check_#{param[:type]}('#{param[:name]}', #{param[:name]}, true)\n"
401
+ checks += " self.class.check_#{param[:type]}('#{param[:name]}', #{param[:name]}, true)\n"
401
402
  end
402
403
 
403
404
  count += 1
@@ -405,38 +406,38 @@ messages.each do |message|
405
406
  source_file += ")\n\n"
406
407
  source_file += checks + "\n"
407
408
  source_file += setters + "\n"
408
- source_file += " end\n"
409
+ source_file += " end\n"
409
410
 
410
411
  # Generate the 'type' method
411
- source_file += "\n def self.type\n Types::#{message[:name].upcase}\n end\n"
412
+ source_file += "\n def self.type\n Types::#{message[:name].upcase}\n end\n"
412
413
 
413
414
  # Generate the parser
414
- source_file += "\n def self.parse(params)\n"
415
- source_file += "\n self.check_gte('params list', #{required_count+1}, params.count)\n"
416
- source_file += " self.check_equal('message type', self.type, params[0])\n"
417
- source_file += "\n params.shift\n self.new(*params)\n"
418
- source_file += "\n end\n"
415
+ source_file += "\n def self.parse(params)\n"
416
+ source_file += "\n self.check_gte('params list', #{required_count+1}, params.count)\n"
417
+ source_file += " self.check_equal('message type', self.type, params[0])\n"
418
+ source_file += "\n params.shift\n self.new(*params)\n"
419
+ source_file += "\n end\n"
419
420
 
420
421
  # Generate the payload
421
- source_file += "\n def payload\n"
422
+ source_file += "\n def payload\n"
422
423
 
423
424
  optional_params = []
424
425
  params.each do |param|
425
426
  unless param[:required]
426
427
  optional_params.push(param)
427
- source_file += " self.#{param[:name]} ||= #{empty_value_from_type(param[:type])}\n"
428
+ source_file += " self.#{param[:name]} ||= #{empty_value_from_type(param[:type])}\n"
428
429
  end
429
430
  end
430
431
  source_file += "\n"
431
432
 
432
- source_file += " payload = [self.class.type]\n"
433
+ source_file += " payload = [self.class.type]\n"
433
434
  optional_count = 0
434
435
  params.each do |param|
435
436
  if param[:required]
436
- source_file += " payload.push(self.#{param[:name]})\n"
437
+ source_file += " payload.push(self.#{param[:name]})\n"
437
438
  else
438
439
  optional_count += 1
439
- source_file += "\n return payload if (self.#{param[:name]}.empty?"
440
+ source_file += "\n return payload if (self.#{param[:name]}.empty?"
440
441
 
441
442
  # Insert remaining parameters
442
443
  for i in optional_count..(optional_params.size-1) do
@@ -444,19 +445,19 @@ messages.each do |message|
444
445
  end
445
446
 
446
447
  source_file += ")\n"
447
- source_file += " payload.push(self.#{param[:name]})\n"
448
+ source_file += " payload.push(self.#{param[:name]})\n"
448
449
  end
449
450
  end
450
- source_file += "\n payload\n"
451
- source_file += " end\n"
451
+ source_file += "\n payload\n"
452
+ source_file += " end\n"
452
453
 
453
454
  # Generate the string
454
- source_file += "\n def to_s\n"
455
- source_file += " '#{message[:name].upcase} > ' + self.payload.to_s\n"
456
- source_file += " end\n"
455
+ source_file += "\n def to_s\n"
456
+ source_file += " '#{message[:name].upcase} > ' + self.payload.to_s\n"
457
+ source_file += " end\n"
457
458
 
458
459
 
459
- source_file += "\n end\n"
460
+ source_file += "\n end\n"
460
461
 
461
462
  ###############################################
462
463
  # Test File
@@ -469,7 +470,7 @@ messages.each do |message|
469
470
  end
470
471
  end
471
472
 
472
- class_name = "WampClient::Message::#{message[:name].capitalize}"
473
+ class_name = "Wamp::Client::Message::#{message[:name].capitalize}"
473
474
 
474
475
  test_file += "\n describe #{class_name} do\n"
475
476
 
@@ -500,7 +501,7 @@ messages.each do |message|
500
501
  # Generate Global Parser Test
501
502
  test_file += "\n it 'globally parses the message and creates an object' do\n"
502
503
  test_file += " params = [#{message_type_lookup[message[:name].upcase]},#{value_array.join(',')}]\n"
503
- test_file += " object = WampClient::Message::Base.parse(params)\n\n"
504
+ test_file += " object = Wamp::Client::Message::Base.parse(params)\n\n"
504
505
  params.each do |param|
505
506
  if param[:required]
506
507
  test_file += " expect(object.#{param[:name]}).to eq(#{value_from_type(param[:type])})\n"