wamp_client 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -32
  3. data/lib/wamp/client/auth.rb +0 -27
  4. data/lib/wamp/client/check.rb +0 -27
  5. data/lib/wamp/client/connection.rb +40 -113
  6. data/lib/wamp/client/event.rb +78 -0
  7. data/lib/wamp/client/manager/base.rb +39 -0
  8. data/lib/wamp/client/manager/base_multiple.rb +37 -0
  9. data/lib/wamp/client/manager/establish.rb +168 -0
  10. data/lib/wamp/client/manager/registration.rb +183 -0
  11. data/lib/wamp/client/manager/require.rb +3 -0
  12. data/lib/wamp/client/manager/subscription.rb +55 -0
  13. data/lib/wamp/client/request/base.rb +125 -0
  14. data/lib/wamp/client/request/call.rb +111 -0
  15. data/lib/wamp/client/request/publish.rb +72 -0
  16. data/lib/wamp/client/request/register.rb +79 -0
  17. data/lib/wamp/client/request/require.rb +6 -0
  18. data/lib/wamp/client/request/subscribe.rb +78 -0
  19. data/lib/wamp/client/request/unregister.rb +71 -0
  20. data/lib/wamp/client/request/unsubscribe.rb +72 -0
  21. data/lib/wamp/client/response.rb +136 -0
  22. data/lib/wamp/client/serializer.rb +0 -29
  23. data/lib/wamp/client/session.rb +172 -839
  24. data/lib/wamp/client/transport/base.rb +4 -77
  25. data/lib/wamp/client/transport/event_machine_base.rb +0 -27
  26. data/lib/wamp/client/transport/faye_web_socket.rb +4 -31
  27. data/lib/wamp/client/transport/web_socket_event_machine.rb +3 -30
  28. data/lib/wamp/client/version.rb +1 -28
  29. data/lib/wamp/client.rb +1 -28
  30. data/spec/spec_helper.rb +3 -137
  31. data/spec/support/faye_web_socket_client_stub.rb +43 -0
  32. data/spec/support/test_transport.rb +50 -0
  33. data/spec/support/web_socket_event_machine_client_stub.rb +39 -0
  34. data/spec/wamp/client/connection_spec.rb +4 -4
  35. data/spec/wamp/client/session_spec.rb +135 -135
  36. data/spec/wamp/client/transport_spec.rb +2 -2
  37. data/wamp_client.gemspec +10 -9
  38. metadata +59 -38
  39. data/lib/wamp/client/defer.rb +0 -70
@@ -86,7 +86,7 @@ describe Wamp::Client::Transport do
86
86
  let(:socket) { transport.socket }
87
87
  before(:each) {
88
88
  allow(WebSocket::EventMachine::Client).to receive(:connect) { |options|
89
- SpecHelper::WebSocketEventMachineClientStub.new
89
+ WebSocketEventMachineClientStub.new
90
90
  }
91
91
 
92
92
  transport.connect
@@ -152,7 +152,7 @@ describe Wamp::Client::Transport do
152
152
  let(:socket) { transport.socket }
153
153
  before(:each) {
154
154
  allow(Faye::WebSocket::Client).to receive(:new) { |uri, protocols, options|
155
- SpecHelper::FayeWebSocketClientStub.new
155
+ FayeWebSocketClientStub.new
156
156
  }
157
157
 
158
158
  transport.connect
data/wamp_client.gemspec CHANGED
@@ -18,15 +18,16 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '>= 1.7'
22
- spec.add_development_dependency 'rake', '>= 10.0'
23
- spec.add_development_dependency 'rspec', '>= 3.5.0'
24
- spec.add_development_dependency 'rspec-eventmachine', '>= 0.2.0'
25
- spec.add_development_dependency 'simplecov'
26
- spec.add_development_dependency 'codecov'
27
- spec.add_development_dependency 'faye-websocket', '>= 0.10.4'
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rspec', '~> 3.5'
24
+ spec.add_development_dependency 'rspec-eventmachine', '~> 0.2'
25
+ spec.add_development_dependency 'simplecov', '~> 0.12'
26
+ spec.add_development_dependency 'codecov', '~> 0.1.9'
27
+ spec.add_development_dependency 'faye-websocket', '~> 0.10.4'
28
+
28
29
  spec.required_ruby_version = '>= 2.0'
29
30
 
30
- spec.add_dependency 'websocket-eventmachine-client', '>= 1.1.0'
31
- spec.add_dependency 'json'
31
+ spec.add_dependency 'websocket-eventmachine-client', '~> 1.1'
32
+ spec.add_dependency 'json', '~> 2.0'
32
33
  end
metadata CHANGED
@@ -1,141 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wamp_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Chapman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-08 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 3.5.0
47
+ version: '3.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 3.5.0
54
+ version: '3.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-eventmachine
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.0
61
+ version: '0.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.0
68
+ version: '0.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: codecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.1.9
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.1.9
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: faye-websocket
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.10.4
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.10.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: websocket-eventmachine-client
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.0
117
+ version: '1.1'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
- version: 1.1.0
124
+ version: '1.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: json
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '2.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '2.0'
139
139
  description: An implementation of The Web Application Messaging Protocol (WAMP)
140
140
  email:
141
141
  - eric.chappy@gmail.com
@@ -143,8 +143,8 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - ".gitignore"
147
- - ".ruby-version"
146
+ - .gitignore
147
+ - .ruby-version
148
148
  - Gemfile
149
149
  - LICENSE.txt
150
150
  - README.md
@@ -154,8 +154,23 @@ files:
154
154
  - lib/wamp/client/auth.rb
155
155
  - lib/wamp/client/check.rb
156
156
  - lib/wamp/client/connection.rb
157
- - lib/wamp/client/defer.rb
157
+ - lib/wamp/client/event.rb
158
+ - lib/wamp/client/manager/base.rb
159
+ - lib/wamp/client/manager/base_multiple.rb
160
+ - lib/wamp/client/manager/establish.rb
161
+ - lib/wamp/client/manager/registration.rb
162
+ - lib/wamp/client/manager/require.rb
163
+ - lib/wamp/client/manager/subscription.rb
158
164
  - lib/wamp/client/message.rb
165
+ - lib/wamp/client/request/base.rb
166
+ - lib/wamp/client/request/call.rb
167
+ - lib/wamp/client/request/publish.rb
168
+ - lib/wamp/client/request/register.rb
169
+ - lib/wamp/client/request/require.rb
170
+ - lib/wamp/client/request/subscribe.rb
171
+ - lib/wamp/client/request/unregister.rb
172
+ - lib/wamp/client/request/unsubscribe.rb
173
+ - lib/wamp/client/response.rb
159
174
  - lib/wamp/client/serializer.rb
160
175
  - lib/wamp/client/session.rb
161
176
  - lib/wamp/client/transport/base.rb
@@ -165,6 +180,9 @@ files:
165
180
  - lib/wamp/client/version.rb
166
181
  - scripts/gen_message.rb
167
182
  - spec/spec_helper.rb
183
+ - spec/support/faye_web_socket_client_stub.rb
184
+ - spec/support/test_transport.rb
185
+ - spec/support/web_socket_event_machine_client_stub.rb
168
186
  - spec/wamp/client/auth_spec.rb
169
187
  - spec/wamp/client/check_spec.rb
170
188
  - spec/wamp/client/connection_spec.rb
@@ -183,22 +201,25 @@ require_paths:
183
201
  - lib
184
202
  required_ruby_version: !ruby/object:Gem::Requirement
185
203
  requirements:
186
- - - ">="
204
+ - - '>='
187
205
  - !ruby/object:Gem::Version
188
206
  version: '2.0'
189
207
  required_rubygems_version: !ruby/object:Gem::Requirement
190
208
  requirements:
191
- - - ">="
209
+ - - '>='
192
210
  - !ruby/object:Gem::Version
193
211
  version: '0'
194
212
  requirements: []
195
213
  rubyforge_project:
196
- rubygems_version: 2.5.1
214
+ rubygems_version: 2.4.8
197
215
  signing_key:
198
216
  specification_version: 4
199
217
  summary: Web Application Messaging Protocol Client
200
218
  test_files:
201
219
  - spec/spec_helper.rb
220
+ - spec/support/faye_web_socket_client_stub.rb
221
+ - spec/support/test_transport.rb
222
+ - spec/support/web_socket_event_machine_client_stub.rb
202
223
  - spec/wamp/client/auth_spec.rb
203
224
  - spec/wamp/client/check_spec.rb
204
225
  - spec/wamp/client/connection_spec.rb
@@ -1,70 +0,0 @@
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
- module Wamp
29
- module Client
30
- module Defer
31
-
32
- class CallDefer
33
- attr_accessor :request, :registration
34
-
35
- @on_complete
36
- def on_complete(&on_complete)
37
- @on_complete = on_complete
38
- end
39
-
40
- @on_error
41
- def on_error(&on_error)
42
- @on_error = on_error
43
- end
44
-
45
- def succeed(result)
46
- @on_complete.call(self, result) if @on_complete
47
- end
48
-
49
- def fail(error)
50
- @on_error.call(self, error) if @on_error
51
- end
52
-
53
- end
54
-
55
- class ProgressiveCallDefer < CallDefer
56
-
57
- @on_progress
58
- def on_progress(&on_progress)
59
- @on_progress = on_progress
60
- end
61
-
62
- def progress(result)
63
- @on_progress.call(self, result) if @on_progress
64
- end
65
-
66
- end
67
-
68
- end
69
- end
70
- end