ably-rest 1.1.4.rc → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/MAINTAINERS.md +1 -0
  4. data/README.md +3 -1
  5. data/ably-rest.gemspec +10 -4
  6. data/lib/ably-rest.rb +2 -0
  7. data/lib/submodules/ably-ruby/.github/workflows/check.yml +41 -0
  8. data/lib/submodules/ably-ruby/CHANGELOG.md +85 -0
  9. data/lib/submodules/ably-ruby/COPYRIGHT +1 -0
  10. data/lib/submodules/ably-ruby/LICENSE +173 -10
  11. data/lib/submodules/ably-ruby/MAINTAINERS.md +1 -0
  12. data/lib/submodules/ably-ruby/README.md +24 -18
  13. data/lib/submodules/ably-ruby/SPEC.md +1020 -922
  14. data/lib/submodules/ably-ruby/ably.gemspec +12 -7
  15. data/lib/submodules/ably-ruby/lib/ably.rb +1 -0
  16. data/lib/submodules/ably-ruby/lib/ably/agent.rb +3 -0
  17. data/lib/submodules/ably-ruby/lib/ably/auth.rb +12 -2
  18. data/lib/submodules/ably-ruby/lib/ably/exceptions.rb +6 -0
  19. data/lib/submodules/ably-ruby/lib/ably/models/connection_details.rb +2 -0
  20. data/lib/submodules/ably-ruby/lib/ably/models/message.rb +14 -0
  21. data/lib/submodules/ably-ruby/lib/ably/models/presence_message.rb +14 -0
  22. data/lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb +8 -0
  23. data/lib/submodules/ably-ruby/lib/ably/modules/ably.rb +11 -1
  24. data/lib/submodules/ably-ruby/lib/ably/realtime/channel.rb +7 -11
  25. data/lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb +3 -3
  26. data/lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_properties.rb +24 -0
  27. data/lib/submodules/ably-ruby/lib/ably/realtime/channel/publisher.rb +5 -0
  28. data/lib/submodules/ably-ruby/lib/ably/realtime/client.rb +9 -0
  29. data/lib/submodules/ably-ruby/lib/ably/realtime/client/incoming_message_dispatcher.rb +14 -6
  30. data/lib/submodules/ably-ruby/lib/ably/realtime/connection.rb +9 -5
  31. data/lib/submodules/ably-ruby/lib/ably/realtime/connection/websocket_transport.rb +67 -1
  32. data/lib/submodules/ably-ruby/lib/ably/realtime/presence.rb +0 -14
  33. data/lib/submodules/ably-ruby/lib/ably/rest/channel.rb +10 -3
  34. data/lib/submodules/ably-ruby/lib/ably/rest/client.rb +22 -21
  35. data/lib/submodules/ably-ruby/lib/ably/version.rb +1 -13
  36. data/lib/submodules/ably-ruby/spec/acceptance/realtime/auth_spec.rb +1 -1
  37. data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_history_spec.rb +25 -0
  38. data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb +24 -0
  39. data/lib/submodules/ably-ruby/spec/acceptance/realtime/client_spec.rb +72 -16
  40. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_failures_spec.rb +29 -12
  41. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_spec.rb +31 -33
  42. data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_history_spec.rb +3 -59
  43. data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_spec.rb +66 -157
  44. data/lib/submodules/ably-ruby/spec/acceptance/realtime/push_admin_spec.rb +3 -19
  45. data/lib/submodules/ably-ruby/spec/acceptance/rest/auth_spec.rb +6 -75
  46. data/lib/submodules/ably-ruby/spec/acceptance/rest/base_spec.rb +8 -4
  47. data/lib/submodules/ably-ruby/spec/acceptance/rest/channel_spec.rb +13 -0
  48. data/lib/submodules/ably-ruby/spec/acceptance/rest/client_spec.rb +144 -45
  49. data/lib/submodules/ably-ruby/spec/acceptance/rest/push_admin_spec.rb +3 -19
  50. data/lib/submodules/ably-ruby/spec/shared/client_initializer_behaviour.rb +131 -8
  51. data/lib/submodules/ably-ruby/spec/shared/model_behaviour.rb +1 -1
  52. data/lib/submodules/ably-ruby/spec/spec_helper.rb +12 -2
  53. data/lib/submodules/ably-ruby/spec/support/serialization_helper.rb +21 -0
  54. data/lib/submodules/ably-ruby/spec/unit/models/message_spec.rb +59 -0
  55. data/lib/submodules/ably-ruby/spec/unit/models/presence_message_spec.rb +49 -0
  56. data/lib/submodules/ably-ruby/spec/unit/models/protocol_message_spec.rb +48 -0
  57. data/lib/submodules/ably-ruby/spec/unit/realtime/channel_spec.rb +1 -1
  58. data/lib/submodules/ably-ruby/spec/unit/realtime/client_spec.rb +19 -6
  59. data/lib/submodules/ably-ruby/spec/unit/realtime/incoming_message_dispatcher_spec.rb +38 -0
  60. data/lib/submodules/ably-ruby/spec/unit/rest/channel_spec.rb +10 -0
  61. data/lib/submodules/ably-ruby/spec/unit/rest/client_spec.rb +20 -0
  62. data/spec/spec_helper.rb +5 -0
  63. data/spec/unit/client_spec.rb +30 -0
  64. metadata +56 -20
  65. data/lib/submodules/ably-ruby/.travis.yml +0 -18
@@ -32,5 +32,43 @@ describe Ably::Realtime::Client::IncomingMessageDispatcher, :api_private do
32
32
  expect(subject).to receive_message_chain(:logger, :warn)
33
33
  msgbus.publish :protocol_message, Ably::Models::ProtocolMessage.new(:action => :attached, channel: 'unknown')
34
34
  end
35
+
36
+ context 'TO3l8' do
37
+ context 'on action presence' do
38
+ let(:presence) { 101.times.map { { data: 'x' * 655 } } }
39
+
40
+ let(:protocol_message) do
41
+ Ably::Models::ProtocolMessage.new(action: :presence, channel: 'default', presence: presence, connection_serial: 123123123)
42
+ end
43
+
44
+ it 'should raise a protocol error when message size exceeded 65536 bytes' do
45
+ allow(connection).to receive(:serial).and_return(12312312)
46
+ allow(subject).to receive(:update_connection_recovery_info)
47
+ allow(subject).to receive_message_chain(:logger, :debug)
48
+ allow(subject).to receive_message_chain(:logger, :warn)
49
+ expect(subject).to receive_message_chain(:logger, :fatal)
50
+
51
+ msgbus.publish :protocol_message, protocol_message
52
+ end
53
+ end
54
+
55
+ context 'on action message' do
56
+ let(:messages) { 101.times.map { { data: 'x' * 655 } } }
57
+
58
+ let(:protocol_message) do
59
+ Ably::Models::ProtocolMessage.new(action: :message, channel: 'default', messages: messages, connection_serial: 123123123)
60
+ end
61
+
62
+ it 'should raise a protocol error when message size exceeded 65536 bytes' do
63
+ allow(connection).to receive(:serial).and_return(12312312)
64
+ allow(subject).to receive(:update_connection_recovery_info)
65
+ allow(subject).to receive_message_chain(:logger, :debug)
66
+ allow(subject).to receive_message_chain(:logger, :warn)
67
+ expect(subject).to receive_message_chain(:logger, :fatal)
68
+
69
+ msgbus.publish :protocol_message, protocol_message
70
+ end
71
+ end
72
+ end
35
73
  end
36
74
  end
@@ -14,6 +14,10 @@ describe Ably::Rest::Channel do
14
14
 
15
15
  subject { Ably::Rest::Channel.new(client, channel_name) }
16
16
 
17
+ it 'should return Ably::Rest::Channel::MAX_MESSAGE_SIZE equal 65536 (TO3l8)' do
18
+ expect(Ably::Rest::Channel::MAX_MESSAGE_SIZE).to eq(65536)
19
+ end
20
+
17
21
  describe '#initializer' do
18
22
  let(:channel_name) { random_str.encode(encoding) }
19
23
 
@@ -126,5 +130,11 @@ describe Ably::Rest::Channel do
126
130
  expect { subject.publish(encoded_value, 'data') }.to raise_error ArgumentError, /must be a String/
127
131
  end
128
132
  end
133
+
134
+ context 'max message size exceeded' do
135
+ it 'should raise Ably::Exceptions::MaxMessageSizeExceeded' do
136
+ expect { subject.publish('x' * 65537, 'data') }.to raise_error Ably::Exceptions::MaxMessageSizeExceeded
137
+ end
138
+ end
129
139
  end
130
140
  end
@@ -38,6 +38,26 @@ describe Ably::Rest::Client do
38
38
  end
39
39
  end
40
40
 
41
+ context 'use agent' do
42
+ context 'set agent to non-default value' do
43
+ context 'default agent' do
44
+ let(:client_options) { { key: 'appid.keyuid:keysecret' } }
45
+
46
+ it 'should return default ably agent' do
47
+ expect(subject.agent).to eq(Ably::AGENT)
48
+ end
49
+ end
50
+
51
+ context 'custom agent' do
52
+ let(:client_options) { { key: 'appid.keyuid:keysecret', agent: 'example-gem/1.1.4 ably-ruby/1.1.5 ruby/3.0.0' } }
53
+
54
+ it 'should overwrite client.agent' do
55
+ expect(subject.agent).to eq('example-gem/1.1.4 ably-ruby/1.1.5 ruby/3.0.0')
56
+ end
57
+ end
58
+ end
59
+ end
60
+
41
61
  context ':use_token_auth' do
42
62
  context 'set to false' do
43
63
  context 'with a key and :tls => false' do
data/spec/spec_helper.rb CHANGED
@@ -15,6 +15,11 @@ require 'support/private_api_formatter'
15
15
  require 'support/protocol_helper'
16
16
  require 'support/random_helper'
17
17
  require 'support/test_logger_helper'
18
+ require 'support/serialization_helper'
19
+
20
+ RSpec.configure do |config|
21
+ config.include SerializationHelper
22
+ end
18
23
 
19
24
  # Load in all shared behaviours
20
25
  Dir.glob(File.expand_path("../lib/submodules/ably-ruby/spec/shared/*.rb", File.dirname(__FILE__))).each do |file|
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Ably::Rest::Client do
5
+ subject do
6
+ Ably::Rest::Client.new(client_options)
7
+ end
8
+
9
+ context 'initializer options' do
10
+ context 'default agent' do
11
+ let(:client_options) { { key: 'appid.keyuid:keysecret' } }
12
+
13
+ it 'should return Ably::AGENT identifier' do
14
+ expect(subject.agent).to eq(Ably::AGENT)
15
+ end
16
+
17
+ it 'should show ably-ruby ruby and ably-ruby-rest identifier' do
18
+ expect(subject.agent).to match(/^ably-ruby\/\d.\d.\d ruby\/\d.\d.\d ably-ruby-rest$/)
19
+ end
20
+ end
21
+
22
+ context 'custom agent' do
23
+ let(:client_options) { { key: 'appid.keyuid:keysecret', agent: 'my-custom-agent/1.1' } }
24
+
25
+ it 'should show my-custom-agent/1.1' do
26
+ expect(subject.agent).to eq('my-custom-agent/1.1')
27
+ end
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ably-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4.rc
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew O'Riordan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-16 00:00:00.000000000 Z
11
+ date: 2021-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: excon
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.55'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.55'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: typhoeus
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -81,33 +95,33 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: 2.0.0
83
97
  - !ruby/object:Gem::Dependency
84
- name: rake
98
+ name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '13.0'
103
+ version: 1.3.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '13.0'
110
+ version: 1.3.0
97
111
  - !ruby/object:Gem::Dependency
98
- name: bundler
112
+ name: rake
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 2.2.1
117
+ version: '11.3'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: 2.2.1
124
+ version: '11.3'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: redcarpet
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +142,42 @@ dependencies:
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 3.10.0
145
+ version: 3.2.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: 3.10.0
152
+ version: 3.2.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rspec-retry
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0.6'
159
+ version: '0.4'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0.6'
166
+ version: '0.4'
167
+ - !ruby/object:Gem::Dependency
168
+ name: webrick
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
153
181
  - !ruby/object:Gem::Dependency
154
182
  name: yard
155
183
  requirement: !ruby/object:Gem::Requirement
@@ -235,6 +263,7 @@ files:
235
263
  - CHANGELOG.md
236
264
  - Gemfile
237
265
  - LICENSE
266
+ - MAINTAINERS.md
238
267
  - README.md
239
268
  - Rakefile
240
269
  - SPEC.md
@@ -242,18 +271,21 @@ files:
242
271
  - lib/ably-rest.rb
243
272
  - lib/ably-rest/modules/eventmachine_deferrable.rb
244
273
  - lib/submodules/ably-ruby/.editorconfig
274
+ - lib/submodules/ably-ruby/.github/workflows/check.yml
245
275
  - lib/submodules/ably-ruby/.gitignore
246
276
  - lib/submodules/ably-ruby/.gitmodules
247
277
  - lib/submodules/ably-ruby/.rspec
248
- - lib/submodules/ably-ruby/.travis.yml
249
278
  - lib/submodules/ably-ruby/CHANGELOG.md
279
+ - lib/submodules/ably-ruby/COPYRIGHT
250
280
  - lib/submodules/ably-ruby/Gemfile
251
281
  - lib/submodules/ably-ruby/LICENSE
282
+ - lib/submodules/ably-ruby/MAINTAINERS.md
252
283
  - lib/submodules/ably-ruby/README.md
253
284
  - lib/submodules/ably-ruby/Rakefile
254
285
  - lib/submodules/ably-ruby/SPEC.md
255
286
  - lib/submodules/ably-ruby/ably.gemspec
256
287
  - lib/submodules/ably-ruby/lib/ably.rb
288
+ - lib/submodules/ably-ruby/lib/ably/agent.rb
257
289
  - lib/submodules/ably-ruby/lib/ably/auth.rb
258
290
  - lib/submodules/ably-ruby/lib/ably/exceptions.rb
259
291
  - lib/submodules/ably-ruby/lib/ably/logger.rb
@@ -305,6 +337,7 @@ files:
305
337
  - lib/submodules/ably-ruby/lib/ably/realtime/auth.rb
306
338
  - lib/submodules/ably-ruby/lib/ably/realtime/channel.rb
307
339
  - lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb
340
+ - lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_properties.rb
308
341
  - lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_state_machine.rb
309
342
  - lib/submodules/ably-ruby/lib/ably/realtime/channel/publisher.rb
310
343
  - lib/submodules/ably-ruby/lib/ably/realtime/channel/push_channel.rb
@@ -388,6 +421,7 @@ files:
388
421
  - lib/submodules/ably-ruby/spec/support/protocol_helper.rb
389
422
  - lib/submodules/ably-ruby/spec/support/random_helper.rb
390
423
  - lib/submodules/ably-ruby/spec/support/rest_testapp_before_retry.rb
424
+ - lib/submodules/ably-ruby/spec/support/serialization_helper.rb
391
425
  - lib/submodules/ably-ruby/spec/support/test_app.rb
392
426
  - lib/submodules/ably-ruby/spec/support/test_logger_helper.rb
393
427
  - lib/submodules/ably-ruby/spec/unit/auth_spec.rb
@@ -439,6 +473,7 @@ files:
439
473
  - spec/acceptance/rest_spec.rb
440
474
  - spec/spec_helper.rb
441
475
  - spec/unit/base_spec.rb
476
+ - spec/unit/client_spec.rb
442
477
  - spec/unit/models_spec.rb
443
478
  - spec/unit/modules_spec.rb
444
479
  - spec/unit/rest_spec.rb
@@ -447,7 +482,7 @@ homepage: http://github.com/ably/ably-ruby-rest
447
482
  licenses:
448
483
  - Apache 2
449
484
  metadata: {}
450
- post_install_message:
485
+ post_install_message:
451
486
  rdoc_options: []
452
487
  require_paths:
453
488
  - lib
@@ -458,18 +493,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
458
493
  version: '0'
459
494
  required_rubygems_version: !ruby/object:Gem::Requirement
460
495
  requirements:
461
- - - ">"
496
+ - - ">="
462
497
  - !ruby/object:Gem::Version
463
- version: 1.3.1
498
+ version: '0'
464
499
  requirements: []
465
500
  rubygems_version: 3.0.3
466
- signing_key:
501
+ signing_key:
467
502
  specification_version: 4
468
503
  summary: A Ruby REST only client library for ably.io realtime messaging
469
504
  test_files:
470
505
  - spec/acceptance/rest_spec.rb
471
506
  - spec/spec_helper.rb
472
507
  - spec/unit/base_spec.rb
508
+ - spec/unit/client_spec.rb
473
509
  - spec/unit/models_spec.rb
474
510
  - spec/unit/modules_spec.rb
475
511
  - spec/unit/rest_spec.rb
@@ -1,18 +0,0 @@
1
- env:
2
- - RSPEC_RETRY=true PARALLEL_TEST_PROCESSORS=2 PROTOCOL=json
3
- - RSPEC_RETRY=true PARALLEL_TEST_PROCESSORS=2 PROTOCOL=msgpack
4
- language: ruby
5
- rvm:
6
- - 1.9.3
7
- - 2.1.10
8
- - 2.2.10
9
- - 2.3.8
10
- - 2.5.5
11
- - 2.6.0
12
- - 2.6.1
13
- - 2.6.2
14
- - 2.6.3
15
- script: spec/run_parallel_tests
16
- notifications:
17
- slack:
18
- secure: Xe8MwDcV2C8XLGk6O6Co31LpQiRSxsmS7Toy5vM7rHds5fnVRBNn5iX6Q5mXMdLOlnsMhjKLt7zl4fsBOZv+siQ+Us0omZSIYpXCYSCIj8nofReF0Lj8M4oa6lFSL5OuygO7PH+wLKTRxQURGZ6Pi1nHU+RE5izRmsewQHkhtY0=