ably 0.1.5 → 0.1.6

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -1
  3. data/ably.gemspec +4 -3
  4. data/lib/ably.rb +6 -2
  5. data/lib/ably/auth.rb +24 -16
  6. data/lib/ably/exceptions.rb +16 -5
  7. data/lib/ably/{realtime/models → models}/error_info.rb +9 -11
  8. data/lib/ably/models/idiomatic_ruby_wrapper.rb +57 -26
  9. data/lib/ably/{realtime/models → models}/message.rb +45 -38
  10. data/lib/ably/{realtime/models → models}/nil_channel.rb +4 -4
  11. data/lib/ably/{rest/models/paged_resource.rb → models/paginated_resource.rb} +21 -10
  12. data/lib/ably/models/presence_message.rb +126 -0
  13. data/lib/ably/{realtime/models → models}/protocol_message.rb +76 -38
  14. data/lib/ably/models/token.rb +74 -0
  15. data/lib/ably/modules/channels_collection.rb +49 -0
  16. data/lib/ably/modules/conversions.rb +2 -0
  17. data/lib/ably/modules/event_emitter.rb +43 -8
  18. data/lib/ably/modules/event_machine_helpers.rb +1 -0
  19. data/lib/ably/modules/http_helpers.rb +9 -2
  20. data/lib/ably/modules/message_pack.rb +14 -0
  21. data/lib/ably/modules/model_common.rb +29 -0
  22. data/lib/ably/modules/{state.rb → state_emitter.rb} +8 -7
  23. data/lib/ably/realtime.rb +37 -7
  24. data/lib/ably/realtime/channel.rb +154 -31
  25. data/lib/ably/realtime/channels.rb +47 -0
  26. data/lib/ably/realtime/client.rb +39 -33
  27. data/lib/ably/realtime/client/incoming_message_dispatcher.rb +50 -21
  28. data/lib/ably/realtime/client/outgoing_message_dispatcher.rb +9 -11
  29. data/lib/ably/realtime/connection.rb +148 -79
  30. data/lib/ably/realtime/connection/connection_state_machine.rb +111 -0
  31. data/lib/ably/realtime/connection/websocket_transport.rb +161 -0
  32. data/lib/ably/realtime/presence.rb +270 -0
  33. data/lib/ably/rest.rb +14 -3
  34. data/lib/ably/rest/channel.rb +3 -3
  35. data/lib/ably/rest/channels.rb +26 -12
  36. data/lib/ably/rest/client.rb +42 -25
  37. data/lib/ably/rest/middleware/exceptions.rb +21 -23
  38. data/lib/ably/rest/middleware/external_exceptions.rb +8 -10
  39. data/lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb +17 -0
  40. data/lib/ably/rest/middleware/parse_json.rb +9 -2
  41. data/lib/ably/rest/middleware/parse_message_pack.rb +6 -2
  42. data/lib/ably/rest/presence.rb +4 -4
  43. data/lib/ably/version.rb +1 -1
  44. data/spec/acceptance/realtime/channel_history_spec.rb +125 -0
  45. data/spec/acceptance/realtime/channel_spec.rb +135 -63
  46. data/spec/acceptance/realtime/connection_spec.rb +86 -0
  47. data/spec/acceptance/realtime/message_spec.rb +116 -94
  48. data/spec/acceptance/realtime/presence_history_spec.rb +0 -0
  49. data/spec/acceptance/realtime/presence_spec.rb +277 -0
  50. data/spec/acceptance/rest/auth_spec.rb +351 -347
  51. data/spec/acceptance/rest/base_spec.rb +43 -26
  52. data/spec/acceptance/rest/channel_spec.rb +88 -83
  53. data/spec/acceptance/rest/channels_spec.rb +32 -28
  54. data/spec/acceptance/rest/presence_spec.rb +83 -63
  55. data/spec/acceptance/rest/stats_spec.rb +38 -37
  56. data/spec/acceptance/rest/time_spec.rb +10 -6
  57. data/spec/integration/modules/{state_spec.rb → state_emitter_spec.rb} +16 -2
  58. data/spec/spec_helper.rb +14 -0
  59. data/spec/support/api_helper.rb +4 -0
  60. data/spec/support/model_helper.rb +28 -9
  61. data/spec/support/protocol_msgbus_helper.rb +8 -1
  62. data/spec/support/test_app.rb +24 -14
  63. data/spec/unit/{realtime → models}/error_info_spec.rb +4 -4
  64. data/spec/unit/models/idiomatic_ruby_wrapper_spec.rb +46 -9
  65. data/spec/unit/models/message_spec.rb +229 -0
  66. data/spec/unit/{rest/paged_resource_spec.rb → models/paginated_resource_spec.rb} +19 -11
  67. data/spec/unit/models/presence_message_spec.rb +230 -0
  68. data/spec/unit/models/protocol_message_spec.rb +280 -0
  69. data/spec/unit/{token_spec.rb → models/token_spec.rb} +18 -22
  70. data/spec/unit/modules/conversions_spec.rb +1 -1
  71. data/spec/unit/modules/event_emitter_spec.rb +36 -4
  72. data/spec/unit/realtime/channel_spec.rb +76 -2
  73. data/spec/unit/realtime/channels_spec.rb +50 -0
  74. data/spec/unit/realtime/client_spec.rb +31 -1
  75. data/spec/unit/realtime/connection_spec.rb +8 -15
  76. data/spec/unit/realtime/incoming_message_dispatcher_spec.rb +6 -6
  77. data/spec/unit/realtime/presence_spec.rb +100 -0
  78. data/spec/unit/rest/channels_spec.rb +48 -0
  79. metadata +72 -38
  80. data/lib/ably/realtime/models/shared.rb +0 -17
  81. data/lib/ably/rest/models/message.rb +0 -64
  82. data/lib/ably/rest/models/presence_message.rb +0 -21
  83. data/lib/ably/token.rb +0 -80
  84. data/spec/unit/realtime/message_spec.rb +0 -117
  85. data/spec/unit/realtime/protocol_message_spec.rb +0 -172
  86. data/spec/unit/rest/message_spec.rb +0 -75
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require "support/protocol_msgbus_helper"
3
3
 
4
4
  describe Ably::Realtime::Channel do
5
- let(:client) { double(:client) }
5
+ let(:client) { double('client').as_null_object }
6
6
  let(:channel_name) { 'test' }
7
7
 
8
8
  subject do
@@ -23,5 +23,79 @@ describe Ably::Realtime::Channel do
23
23
  end
24
24
  end
25
25
 
26
- it_behaves_like 'an incoming protocol message bus'
26
+ context 'msgbus' do
27
+ let(:message) do
28
+ Ably::Models::Message.new({
29
+ 'name' => 'test',
30
+ 'data' => 'payload'
31
+ }, instance_double('Ably::Models::ProtocolMessage'))
32
+ end
33
+ let(:msgbus) { subject.__incoming_msgbus__ }
34
+
35
+ specify 'supports messages' do
36
+ received = 0
37
+ msgbus.subscribe(:message) { received += 1 }
38
+ expect { msgbus.publish(:message, message) }.to change { received }.to(1)
39
+ end
40
+
41
+ specify 'fail with unacceptable STATE event names' do
42
+ expect { msgbus.subscribe(:invalid) }.to raise_error KeyError
43
+ expect { msgbus.publish(:invalid) }.to raise_error KeyError
44
+ expect { msgbus.unsubscribe(:invalid) }.to raise_error KeyError
45
+ end
46
+ end
47
+
48
+ context 'subscriptions' do
49
+ let(:message_history) { Hash.new { |hash, key| hash[key] = 0 } }
50
+ let(:event_name) { 'click' }
51
+ let(:message) { instance_double('Ably::Models::Message', name: event_name) }
52
+
53
+ context '#subscribe' do
54
+ specify 'to all events' do
55
+ subject.subscribe { |message| message_history[:received] += 1}
56
+ subject.__incoming_msgbus__.publish(:message, message)
57
+ expect(message_history[:received]).to eql(1)
58
+ end
59
+
60
+ specify 'to specific events' do
61
+ subject.subscribe(event_name) { |message| message_history[:received] += 1 }
62
+ subject.subscribe('move') { |message| message_history[:received] += 1 }
63
+ subject.__incoming_msgbus__.publish(:message, message)
64
+ expect(message_history[:received]).to eql(1)
65
+ end
66
+ end
67
+
68
+ context '#unsubscribe' do
69
+ let(:callback) do
70
+ Proc.new { |message| message_history[:received] += 1 }
71
+ end
72
+ before do
73
+ subject.subscribe(event_name, &callback)
74
+ end
75
+
76
+ specify 'to all events' do
77
+ subject.unsubscribe &callback
78
+ subject.__incoming_msgbus__.publish(:message, message)
79
+ expect(message_history[:received]).to eql(0)
80
+ end
81
+
82
+ specify 'to specific events' do
83
+ subject.unsubscribe event_name, &callback
84
+ subject.__incoming_msgbus__.publish(:message, message)
85
+ expect(message_history[:received]).to eql(0)
86
+ end
87
+
88
+ specify 'to specific non-matching events' do
89
+ subject.unsubscribe 'move', &callback
90
+ subject.__incoming_msgbus__.publish(:message, message)
91
+ expect(message_history[:received]).to eql(1)
92
+ end
93
+
94
+ specify 'all callbacks by not providing a callback' do
95
+ subject.unsubscribe event_name
96
+ subject.__incoming_msgbus__.publish(:message, message)
97
+ expect(message_history[:received]).to eql(0)
98
+ end
99
+ end
100
+ end
27
101
  end
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+
3
+ describe Ably::Realtime::Channels do
4
+ let(:connection) { instance_double('Ably::Realtime::Connection', on: true) }
5
+ let(:client) { instance_double('Ably::Realtime::Client', connection: connection) }
6
+ let(:channel_name) { 'unique' }
7
+ let(:options) { { 'bizarre' => 'value' } }
8
+
9
+ subject { Ably::Realtime::Channels.new(client) }
10
+
11
+ context 'creating channels' do
12
+ it '#get creates a channel' do
13
+ expect(Ably::Realtime::Channel).to receive(:new).with(client, channel_name, options)
14
+ subject.get(channel_name, options)
15
+ end
16
+
17
+ it '#get will reuse the channel object' do
18
+ channel = subject.get(channel_name, options)
19
+ expect(channel).to be_a(Ably::Realtime::Channel)
20
+ expect(subject.get(channel_name, options).object_id).to eql(channel.object_id)
21
+ end
22
+
23
+ it '[] creates a channel' do
24
+ expect(Ably::Realtime::Channel).to receive(:new).with(client, channel_name, options)
25
+ subject.get(channel_name, options)
26
+ end
27
+ end
28
+
29
+ context '#fetch' do
30
+ it 'retrieves a channel if it exists' do
31
+ channel = subject.get(channel_name, options)
32
+ expect(subject.fetch(channel_name)).to eql(channel)
33
+ end
34
+
35
+ it 'calls the block if channel is missing' do
36
+ block_called = false
37
+ subject.fetch(channel_name) { block_called = true }
38
+ expect(block_called).to eql(true)
39
+ end
40
+ end
41
+
42
+ context 'destroying channels' do
43
+ it '#release detatches and then releases the channel resoures' do
44
+ released_channel = subject.get(channel_name, options)
45
+ expect(released_channel).to receive(:detach).and_yield
46
+ subject.release(channel_name)
47
+ expect(subject.get(channel_name, options).object_id).to_not eql(released_channel.object_id)
48
+ end
49
+ end
50
+ end
@@ -2,7 +2,37 @@ require 'spec_helper'
2
2
  require "support/protocol_msgbus_helper"
3
3
 
4
4
  describe Ably::Realtime::Client do
5
+ let(:client_options) { 'appid.keyuid:keysecret' }
5
6
  subject do
6
- Ably::Realtime::Client.new('appid.keyuid:keysecret')
7
+ Ably::Realtime::Client.new(client_options)
8
+ end
9
+
10
+ context 'delegation to the Rest Client' do
11
+ let(:options) { { arbitrary: 'value' } }
12
+
13
+ it 'passes on the options to the initializer' do
14
+ rest_client = instance_double('Ably::Rest::Client', auth: instance_double('Ably::Auth'), options: {})
15
+ expect(Ably::Rest::Client).to receive(:new).with(client_options).and_return(rest_client)
16
+ subject
17
+ end
18
+
19
+ specify '#time' do
20
+ expect(subject.rest_client).to receive(:time)
21
+ subject.time
22
+ end
23
+
24
+ specify '#stats' do
25
+ expect(subject.rest_client).to receive(:stats).with(options)
26
+ subject.stats options
27
+ end
28
+
29
+ context 'for attribute' do
30
+ [:environment, :use_tls?, :logger, :log_level].each do |attribute|
31
+ specify "##{attribute}" do
32
+ expect(subject.rest_client).to receive(attribute)
33
+ subject.public_send attribute
34
+ end
35
+ end
36
+ end
7
37
  end
8
38
  end
@@ -1,24 +1,17 @@
1
1
  require 'spec_helper'
2
- require "support/protocol_msgbus_helper"
2
+ require 'support/protocol_msgbus_helper'
3
+ require 'support/event_machine_helper'
3
4
 
4
5
  describe Ably::Realtime::Connection do
5
- let(:client) { double(:client) }
6
- let(:klass) { Class.new(Ably::Realtime::Connection) do; end }
6
+ let(:client) { instance_double('Ably::Realtime::Client', logger: double('logger').as_null_object) }
7
7
 
8
- before do
9
- # Override self.new with a generic implementation of new as EventMachine::Connection
10
- # overrides self.new by default, and using EventMachine in unit tests is unnecessary
11
- klass.instance_eval do
12
- def self.new(*args)
13
- obj = self.allocate
14
- obj.orig_send :initialize, *args
15
- obj
16
- end
17
- end
8
+ subject do
9
+ Ably::Realtime::Connection.new(client)
18
10
  end
19
11
 
20
- subject do
21
- klass.new(client)
12
+ before do
13
+ expect(EventMachine::Timer).to receive(:new)
14
+ expect(EventMachine).to receive(:next_tick)
22
15
  end
23
16
 
24
17
  describe 'callbacks' do
@@ -4,14 +4,14 @@ describe Ably::Realtime::Client::IncomingMessageDispatcher do
4
4
  let(:msgbus) do
5
5
  Ably::Util::PubSub.new
6
6
  end
7
+ let(:connection) do
8
+ instance_double('Ably::Realtime::Connection', __incoming_protocol_msgbus__: msgbus, update_connection_id: true)
9
+ end
7
10
  let(:client) do
8
- double(:client,
9
- connection: double('connection', __incoming_protocol_msgbus__: msgbus),
10
- channels: {}
11
- )
11
+ instance_double('Ably::Realtime::Client', channels: {})
12
12
  end
13
13
 
14
- subject { Ably::Realtime::Client::IncomingMessageDispatcher.new(client) }
14
+ subject { Ably::Realtime::Client::IncomingMessageDispatcher.new(client, connection) }
15
15
 
16
16
  context '#initialize' do
17
17
  it 'should subscribe to protocol messages from the connection' do
@@ -30,7 +30,7 @@ describe Ably::Realtime::Client::IncomingMessageDispatcher do
30
30
  it 'should warn if a message is received for a non-existent channel' do
31
31
  allow(subject).to receive_message_chain(:logger, :debug)
32
32
  expect(subject).to receive_message_chain(:logger, :warn)
33
- msgbus.publish :message, Ably::Realtime::Models::ProtocolMessage.new(:action => :attached, channel: 'unknown')
33
+ msgbus.publish :message, Ably::Models::ProtocolMessage.new(:action => :attached, channel: 'unknown')
34
34
  end
35
35
  end
36
36
  end
@@ -0,0 +1,100 @@
1
+ require 'spec_helper'
2
+ require "support/protocol_msgbus_helper"
3
+
4
+ describe Ably::Realtime::Presence do
5
+ let(:channel) { double('Ably::Realtime::Channel').as_null_object }
6
+
7
+ subject do
8
+ Ably::Realtime::Presence.new(channel)
9
+ end
10
+
11
+ describe 'callbacks' do
12
+ specify 'are supported for valid STATE events' do
13
+ state = nil
14
+ subject.on(:initialized) { state = :entered }
15
+ expect { subject.trigger(:initialized) }.to change { state }.to(:entered)
16
+ end
17
+
18
+ specify 'fail with unacceptable STATE event names' do
19
+ expect { subject.on(:invalid) }.to raise_error KeyError
20
+ expect { subject.trigger(:invalid) }.to raise_error KeyError
21
+ expect { subject.off(:invalid) }.to raise_error KeyError
22
+ end
23
+ end
24
+
25
+ context 'msgbus' do
26
+ let(:message) do
27
+ Ably::Models::PresenceMessage.new({
28
+ 'action' => 0,
29
+ 'member_id' => SecureRandom.hex,
30
+ }, instance_double('Ably::Models::ProtocolMessage'))
31
+ end
32
+ let(:msgbus) { subject.__incoming_msgbus__ }
33
+
34
+ specify 'supports messages' do
35
+ received = 0
36
+ msgbus.subscribe(:presence) { received += 1 }
37
+ expect { msgbus.publish(:presence, message) }.to change { received }.to(1)
38
+ end
39
+
40
+ specify 'fail with unacceptable STATE event names' do
41
+ expect { msgbus.subscribe(:invalid) }.to raise_error KeyError
42
+ expect { msgbus.publish(:invalid) }.to raise_error KeyError
43
+ expect { msgbus.unsubscribe(:invalid) }.to raise_error KeyError
44
+ end
45
+ end
46
+
47
+ context 'subscriptions' do
48
+ let(:message_history) { Hash.new { |hash, key| hash[key] = 0 } }
49
+ let(:presence_action) { Ably::Models::PresenceMessage::ACTION.Enter }
50
+ let(:message) { instance_double('Ably::Models::PresenceMessage', action: presence_action, member_id: SecureRandom.hex) }
51
+
52
+ context '#subscribe' do
53
+ specify 'to all presence state actions' do
54
+ subject.subscribe { |message| message_history[:received] += 1}
55
+ subject.__incoming_msgbus__.publish(:presence, message)
56
+ expect(message_history[:received]).to eql(1)
57
+ end
58
+
59
+ specify 'to specific presence state actions' do
60
+ subject.subscribe(presence_action) { |message| message_history[:received] += 1 }
61
+ subject.subscribe(:leave) { |message| message_history[:received] += 1 }
62
+ subject.__incoming_msgbus__.publish(:presence, message)
63
+ expect(message_history[:received]).to eql(1)
64
+ end
65
+ end
66
+
67
+ context '#unsubscribe' do
68
+ let(:callback) do
69
+ Proc.new { |message| message_history[:received] += 1 }
70
+ end
71
+ before do
72
+ subject.subscribe(presence_action, &callback)
73
+ end
74
+
75
+ specify 'to all presence state actions' do
76
+ subject.unsubscribe &callback
77
+ subject.__incoming_msgbus__.publish(:presence, message)
78
+ expect(message_history[:received]).to eql(0)
79
+ end
80
+
81
+ specify 'to specific presence state actions' do
82
+ subject.unsubscribe presence_action, &callback
83
+ subject.__incoming_msgbus__.publish(:presence, message)
84
+ expect(message_history[:received]).to eql(0)
85
+ end
86
+
87
+ specify 'to specific non-matching presence state actions' do
88
+ subject.unsubscribe :leave, &callback
89
+ subject.__incoming_msgbus__.publish(:presence, message)
90
+ expect(message_history[:received]).to eql(1)
91
+ end
92
+
93
+ specify 'all callbacks by not providing a callback' do
94
+ subject.unsubscribe presence_action
95
+ subject.__incoming_msgbus__.publish(:presence, message)
96
+ expect(message_history[:received]).to eql(0)
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ describe Ably::Rest::Channels do
4
+ let(:client) { instance_double('Ably::Rest::Client') }
5
+ let(:channel_name) { 'unique' }
6
+ let(:options) { { 'bizarre' => 'value' } }
7
+
8
+ subject { Ably::Rest::Channels.new(client) }
9
+
10
+ context 'creating channels' do
11
+ it '#get creates a channel' do
12
+ expect(Ably::Rest::Channel).to receive(:new).with(client, channel_name, options)
13
+ subject.get(channel_name, options)
14
+ end
15
+
16
+ it '#get will reuse the channel object' do
17
+ channel = subject.get(channel_name, options)
18
+ expect(channel).to be_a(Ably::Rest::Channel)
19
+ expect(subject.get(channel_name, options).object_id).to eql(channel.object_id)
20
+ end
21
+
22
+ it '[] creates a channel' do
23
+ expect(Ably::Rest::Channel).to receive(:new).with(client, channel_name, options)
24
+ subject.get(channel_name, options)
25
+ end
26
+ end
27
+
28
+ context '#fetch' do
29
+ it 'retrieves a channel if it exists' do
30
+ channel = subject.get(channel_name, options)
31
+ expect(subject.fetch(channel_name)).to eql(channel)
32
+ end
33
+
34
+ it 'calls the block if channel is missing' do
35
+ block_called = false
36
+ subject.fetch(channel_name) { block_called = true }
37
+ expect(block_called).to eql(true)
38
+ end
39
+ end
40
+
41
+ context 'destroying channels' do
42
+ it '#release releases the channel resoures' do
43
+ released_channel = subject.get(channel_name, options)
44
+ subject.release(channel_name)
45
+ expect(subject.get(channel_name, options).object_id).to_not eql(released_channel.object_id)
46
+ end
47
+ end
48
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ably
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Marshall
@@ -9,22 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-23 00:00:00.000000000 Z
12
+ date: 2014-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: statesman
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0.beta2
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 1.0.0.beta2
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: faraday
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -57,30 +71,30 @@ dependencies:
57
71
  name: websocket-driver
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - ">="
74
+ - - "~>"
61
75
  - !ruby/object:Gem::Version
62
- version: '0'
76
+ version: '0.3'
63
77
  type: :runtime
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ">="
81
+ - - "~>"
68
82
  - !ruby/object:Gem::Version
69
- version: '0'
83
+ version: '0.3'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: msgpack
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - ">="
88
+ - - "~>"
75
89
  - !ruby/object:Gem::Version
76
- version: '0'
90
+ version: '0.5'
77
91
  type: :runtime
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - ">="
95
+ - - "~>"
82
96
  - !ruby/object:Gem::Version
83
- version: '0'
97
+ version: '0.5'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: bundler
86
100
  requirement: !ruby/object:Gem::Requirement
@@ -182,43 +196,53 @@ files:
182
196
  - lib/ably.rb
183
197
  - lib/ably/auth.rb
184
198
  - lib/ably/exceptions.rb
199
+ - lib/ably/models/error_info.rb
185
200
  - lib/ably/models/idiomatic_ruby_wrapper.rb
201
+ - lib/ably/models/message.rb
202
+ - lib/ably/models/nil_channel.rb
203
+ - lib/ably/models/paginated_resource.rb
204
+ - lib/ably/models/presence_message.rb
205
+ - lib/ably/models/protocol_message.rb
206
+ - lib/ably/models/token.rb
207
+ - lib/ably/modules/channels_collection.rb
186
208
  - lib/ably/modules/conversions.rb
187
209
  - lib/ably/modules/enum.rb
188
210
  - lib/ably/modules/event_emitter.rb
189
211
  - lib/ably/modules/event_machine_helpers.rb
190
212
  - lib/ably/modules/http_helpers.rb
191
- - lib/ably/modules/state.rb
213
+ - lib/ably/modules/message_pack.rb
214
+ - lib/ably/modules/model_common.rb
215
+ - lib/ably/modules/state_emitter.rb
192
216
  - lib/ably/realtime.rb
193
217
  - lib/ably/realtime/channel.rb
218
+ - lib/ably/realtime/channels.rb
194
219
  - lib/ably/realtime/client.rb
195
220
  - lib/ably/realtime/client/incoming_message_dispatcher.rb
196
221
  - lib/ably/realtime/client/outgoing_message_dispatcher.rb
197
222
  - lib/ably/realtime/connection.rb
198
- - lib/ably/realtime/models/error_info.rb
199
- - lib/ably/realtime/models/message.rb
200
- - lib/ably/realtime/models/nil_channel.rb
201
- - lib/ably/realtime/models/protocol_message.rb
202
- - lib/ably/realtime/models/shared.rb
223
+ - lib/ably/realtime/connection/connection_state_machine.rb
224
+ - lib/ably/realtime/connection/websocket_transport.rb
225
+ - lib/ably/realtime/presence.rb
203
226
  - lib/ably/rest.rb
204
227
  - lib/ably/rest/channel.rb
205
228
  - lib/ably/rest/channels.rb
206
229
  - lib/ably/rest/client.rb
207
230
  - lib/ably/rest/middleware/exceptions.rb
208
231
  - lib/ably/rest/middleware/external_exceptions.rb
232
+ - lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb
209
233
  - lib/ably/rest/middleware/parse_json.rb
210
234
  - lib/ably/rest/middleware/parse_message_pack.rb
211
- - lib/ably/rest/models/message.rb
212
- - lib/ably/rest/models/paged_resource.rb
213
- - lib/ably/rest/models/presence_message.rb
214
235
  - lib/ably/rest/presence.rb
215
- - lib/ably/token.rb
216
236
  - lib/ably/util/crypto.rb
217
237
  - lib/ably/util/pub_sub.rb
218
238
  - lib/ably/version.rb
219
239
  - spec/acceptance/crypto.rb
240
+ - spec/acceptance/realtime/channel_history_spec.rb
220
241
  - spec/acceptance/realtime/channel_spec.rb
242
+ - spec/acceptance/realtime/connection_spec.rb
221
243
  - spec/acceptance/realtime/message_spec.rb
244
+ - spec/acceptance/realtime/presence_history_spec.rb
245
+ - spec/acceptance/realtime/presence_spec.rb
222
246
  - spec/acceptance/rest/auth_spec.rb
223
247
  - spec/acceptance/rest/base_spec.rb
224
248
  - spec/acceptance/rest/channel_spec.rb
@@ -226,7 +250,7 @@ files:
226
250
  - spec/acceptance/rest/presence_spec.rb
227
251
  - spec/acceptance/rest/stats_spec.rb
228
252
  - spec/acceptance/rest/time_spec.rb
229
- - spec/integration/modules/state_spec.rb
253
+ - spec/integration/modules/state_emitter_spec.rb
230
254
  - spec/integration/rest/auth.rb
231
255
  - spec/spec_helper.rb
232
256
  - spec/support/api_helper.rb
@@ -234,23 +258,26 @@ files:
234
258
  - spec/support/model_helper.rb
235
259
  - spec/support/protocol_msgbus_helper.rb
236
260
  - spec/support/test_app.rb
261
+ - spec/unit/models/error_info_spec.rb
237
262
  - spec/unit/models/idiomatic_ruby_wrapper_spec.rb
263
+ - spec/unit/models/message_spec.rb
264
+ - spec/unit/models/paginated_resource_spec.rb
265
+ - spec/unit/models/presence_message_spec.rb
266
+ - spec/unit/models/protocol_message_spec.rb
267
+ - spec/unit/models/token_spec.rb
238
268
  - spec/unit/modules/conversions_spec.rb
239
269
  - spec/unit/modules/enum_spec.rb
240
270
  - spec/unit/modules/event_emitter_spec.rb
241
271
  - spec/unit/modules/pub_sub_spec.rb
242
272
  - spec/unit/realtime/channel_spec.rb
273
+ - spec/unit/realtime/channels_spec.rb
243
274
  - spec/unit/realtime/client_spec.rb
244
275
  - spec/unit/realtime/connection_spec.rb
245
- - spec/unit/realtime/error_info_spec.rb
246
276
  - spec/unit/realtime/incoming_message_dispatcher_spec.rb
247
- - spec/unit/realtime/message_spec.rb
248
- - spec/unit/realtime/protocol_message_spec.rb
277
+ - spec/unit/realtime/presence_spec.rb
249
278
  - spec/unit/realtime/realtime_spec.rb
279
+ - spec/unit/rest/channels_spec.rb
250
280
  - spec/unit/rest/client_spec.rb
251
- - spec/unit/rest/message_spec.rb
252
- - spec/unit/rest/paged_resource_spec.rb
253
- - spec/unit/token_spec.rb
254
281
  homepage: http://github.com/ably/ably-ruby
255
282
  licenses:
256
283
  - MIT
@@ -277,8 +304,12 @@ specification_version: 4
277
304
  summary: A Ruby client library for ably.io, the real-time messaging service
278
305
  test_files:
279
306
  - spec/acceptance/crypto.rb
307
+ - spec/acceptance/realtime/channel_history_spec.rb
280
308
  - spec/acceptance/realtime/channel_spec.rb
309
+ - spec/acceptance/realtime/connection_spec.rb
281
310
  - spec/acceptance/realtime/message_spec.rb
311
+ - spec/acceptance/realtime/presence_history_spec.rb
312
+ - spec/acceptance/realtime/presence_spec.rb
282
313
  - spec/acceptance/rest/auth_spec.rb
283
314
  - spec/acceptance/rest/base_spec.rb
284
315
  - spec/acceptance/rest/channel_spec.rb
@@ -286,7 +317,7 @@ test_files:
286
317
  - spec/acceptance/rest/presence_spec.rb
287
318
  - spec/acceptance/rest/stats_spec.rb
288
319
  - spec/acceptance/rest/time_spec.rb
289
- - spec/integration/modules/state_spec.rb
320
+ - spec/integration/modules/state_emitter_spec.rb
290
321
  - spec/integration/rest/auth.rb
291
322
  - spec/spec_helper.rb
292
323
  - spec/support/api_helper.rb
@@ -294,21 +325,24 @@ test_files:
294
325
  - spec/support/model_helper.rb
295
326
  - spec/support/protocol_msgbus_helper.rb
296
327
  - spec/support/test_app.rb
328
+ - spec/unit/models/error_info_spec.rb
297
329
  - spec/unit/models/idiomatic_ruby_wrapper_spec.rb
330
+ - spec/unit/models/message_spec.rb
331
+ - spec/unit/models/paginated_resource_spec.rb
332
+ - spec/unit/models/presence_message_spec.rb
333
+ - spec/unit/models/protocol_message_spec.rb
334
+ - spec/unit/models/token_spec.rb
298
335
  - spec/unit/modules/conversions_spec.rb
299
336
  - spec/unit/modules/enum_spec.rb
300
337
  - spec/unit/modules/event_emitter_spec.rb
301
338
  - spec/unit/modules/pub_sub_spec.rb
302
339
  - spec/unit/realtime/channel_spec.rb
340
+ - spec/unit/realtime/channels_spec.rb
303
341
  - spec/unit/realtime/client_spec.rb
304
342
  - spec/unit/realtime/connection_spec.rb
305
- - spec/unit/realtime/error_info_spec.rb
306
343
  - spec/unit/realtime/incoming_message_dispatcher_spec.rb
307
- - spec/unit/realtime/message_spec.rb
308
- - spec/unit/realtime/protocol_message_spec.rb
344
+ - spec/unit/realtime/presence_spec.rb
309
345
  - spec/unit/realtime/realtime_spec.rb
346
+ - spec/unit/rest/channels_spec.rb
310
347
  - spec/unit/rest/client_spec.rb
311
- - spec/unit/rest/message_spec.rb
312
- - spec/unit/rest/paged_resource_spec.rb
313
- - spec/unit/token_spec.rb
314
348
  has_rdoc: