ably 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +185 -0
  4. data/LICENSE +15 -0
  5. data/README.md +8 -4
  6. data/SPEC.md +999 -531
  7. data/ably.gemspec +1 -1
  8. data/lib/ably.rb +1 -1
  9. data/lib/ably/auth.rb +114 -87
  10. data/lib/ably/exceptions.rb +40 -14
  11. data/lib/ably/models/message.rb +3 -5
  12. data/lib/ably/models/paginated_result.rb +3 -12
  13. data/lib/ably/models/presence_message.rb +8 -2
  14. data/lib/ably/models/protocol_message.rb +15 -3
  15. data/lib/ably/models/stat.rb +1 -1
  16. data/lib/ably/models/token_details.rb +1 -1
  17. data/lib/ably/modules/channels_collection.rb +7 -1
  18. data/lib/ably/modules/conversions.rb +1 -1
  19. data/lib/ably/modules/encodeable.rb +6 -3
  20. data/lib/ably/modules/message_pack.rb +2 -2
  21. data/lib/ably/modules/model_common.rb +1 -1
  22. data/lib/ably/modules/state_machine.rb +2 -2
  23. data/lib/ably/realtime.rb +1 -0
  24. data/lib/ably/realtime/auth.rb +191 -0
  25. data/lib/ably/realtime/channel.rb +97 -25
  26. data/lib/ably/realtime/channel/channel_manager.rb +11 -3
  27. data/lib/ably/realtime/client.rb +22 -6
  28. data/lib/ably/realtime/connection.rb +74 -41
  29. data/lib/ably/realtime/connection/connection_manager.rb +48 -33
  30. data/lib/ably/realtime/presence.rb +17 -3
  31. data/lib/ably/rest/channel.rb +43 -16
  32. data/lib/ably/rest/client.rb +57 -26
  33. data/lib/ably/rest/middleware/exceptions.rb +3 -1
  34. data/lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb +4 -2
  35. data/lib/ably/rest/presence.rb +1 -0
  36. data/lib/ably/version.rb +1 -1
  37. data/spec/acceptance/realtime/auth_spec.rb +242 -0
  38. data/spec/acceptance/realtime/channel_spec.rb +277 -5
  39. data/spec/acceptance/realtime/channels_spec.rb +64 -0
  40. data/spec/acceptance/realtime/client_spec.rb +26 -5
  41. data/spec/acceptance/realtime/connection_failures_spec.rb +23 -6
  42. data/spec/acceptance/realtime/connection_spec.rb +167 -16
  43. data/spec/acceptance/realtime/message_spec.rb +9 -8
  44. data/spec/acceptance/realtime/presence_history_spec.rb +1 -0
  45. data/spec/acceptance/realtime/presence_spec.rb +121 -10
  46. data/spec/acceptance/realtime/stats_spec.rb +13 -1
  47. data/spec/acceptance/rest/auth_spec.rb +161 -79
  48. data/spec/acceptance/rest/base_spec.rb +3 -3
  49. data/spec/acceptance/rest/channel_spec.rb +142 -15
  50. data/spec/acceptance/rest/channels_spec.rb +23 -0
  51. data/spec/acceptance/rest/client_spec.rb +180 -18
  52. data/spec/acceptance/rest/message_spec.rb +8 -8
  53. data/spec/acceptance/rest/presence_spec.rb +136 -25
  54. data/spec/acceptance/rest/stats_spec.rb +60 -4
  55. data/spec/shared/client_initializer_behaviour.rb +54 -3
  56. data/spec/unit/auth_spec.rb +7 -6
  57. data/spec/unit/models/message_spec.rb +1 -9
  58. data/spec/unit/models/paginated_result_spec.rb +1 -18
  59. data/spec/unit/models/presence_message_spec.rb +1 -1
  60. data/spec/unit/models/protocol_message_spec.rb +21 -1
  61. data/spec/unit/realtime/channel_spec.rb +10 -3
  62. data/spec/unit/realtime/channels_spec.rb +27 -8
  63. data/spec/unit/rest/channel_spec.rb +0 -8
  64. data/spec/unit/rest/client_spec.rb +7 -7
  65. metadata +13 -7
  66. data/LICENSE.txt +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f57c29988fe001f1524fdfc79036ded998a106e3
4
- data.tar.gz: 22a1a07b82930174dc9fd270fe28765b26a14b1d
3
+ metadata.gz: 4a4a37e1a1ac2bddad5dadd6b97b77dbc93acc76
4
+ data.tar.gz: 69ebb5298665efbf1ad4d9255b76cd8c581b27e5
5
5
  SHA512:
6
- metadata.gz: c438babd2ef3b0e82ff72e9a5b68e8f9d78b0fcc927e4c7c81ae15af1b9fd35fd10210bf1683a20de77834b3089170bb475a24e507c00f6b0053986c4c63b1ed
7
- data.tar.gz: 11b46d0850d6642045f1aa157624ad24b5a8e9a28da65db4fd1b8a142f78477ca62dd5bbaee1dcf6a60fc4789326bbb6530965068e2d300810b4141aab017762
6
+ metadata.gz: a0566f39324a88f7d00efea0292fd04af77b423581df8e920127a425b22328464035fc36f678fdebe40c2b4fb68b8f653e86c7b1a29ad14a0086f138acc582cb
7
+ data.tar.gz: ef77958e46559356a6db5929ec630c69ab1d398916e20d82c10a2836ef73d834fcc5020a8809a3f56f2efa44132bd58b77cdf385e804f51187ced597962be016
@@ -1,3 +1,4 @@
1
+ sudo: false
1
2
  env: RSPEC_RETRY=true
2
3
  language: ruby
3
4
  rvm:
@@ -0,0 +1,185 @@
1
+ # Change Log
2
+
3
+ ## [v0.8.3](https://github.com/ably/ably-ruby/tree/v0.8.3)
4
+
5
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.2...v0.8.3)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Implement :queue\_messages option [\#36](https://github.com/ably/ably-ruby/issues/36)
10
+
11
+ - Check that a non 200-299 status code for REST requests uses fallback hosts [\#35](https://github.com/ably/ably-ruby/issues/35)
12
+
13
+ - Move stats fixtures into ably-common [\#34](https://github.com/ably/ably-ruby/issues/34)
14
+
15
+ - Add tests for messages with no data or name fields [\#21](https://github.com/ably/ably-ruby/issues/21)
16
+
17
+ - Namespace MsgPack as MsgPack5 because compliance is not merged in [\#12](https://github.com/ably/ably-ruby/issues/12)
18
+
19
+ - Add test coverage for receiving messages more than once i.e. historical messages resent somehow on reconnect [\#11](https://github.com/ably/ably-ruby/issues/11)
20
+
21
+ - Add async methods for Authentication in the realtime library [\#8](https://github.com/ably/ably-ruby/issues/8)
22
+
23
+ **Fixed bugs:**
24
+
25
+ - Check that a non 200-299 status code for REST requests uses fallback hosts [\#35](https://github.com/ably/ably-ruby/issues/35)
26
+
27
+ **Closed issues:**
28
+
29
+ - Scope default token params in arguments [\#55](https://github.com/ably/ably-ruby/issues/55)
30
+
31
+ - Channel options can be reset when accessing a channel with \#get [\#46](https://github.com/ably/ably-ruby/issues/46)
32
+
33
+ **Merged pull requests:**
34
+
35
+ - Separate token params for auth [\#57](https://github.com/ably/ably-ruby/pull/57) ([mattheworiordan](https://github.com/mattheworiordan))
36
+
37
+ - Ensure files are required in a consistent order [\#51](https://github.com/ably/ably-ruby/pull/51) ([SimonWoolf](https://github.com/SimonWoolf))
38
+
39
+ ## [v0.8.2](https://github.com/ably/ably-ruby/tree/v0.8.2) (2015-05-20)
40
+
41
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.1...v0.8.2)
42
+
43
+ **Implemented enhancements:**
44
+
45
+ - Ensure Array object can be used in place of Hash for payload [\#44](https://github.com/ably/ably-ruby/issues/44)
46
+
47
+ - Change connect\_automatically option to auto\_connect for consistency [\#42](https://github.com/ably/ably-ruby/issues/42)
48
+
49
+ - Rename PaginatedResource to PaginatedResult for consistency [\#40](https://github.com/ably/ably-ruby/issues/40)
50
+
51
+ - EventEmitter should use `emit` not `trigger` to be consistent with other libs [\#31](https://github.com/ably/ably-ruby/issues/31)
52
+
53
+ - Add exceptions when data attribute for messages/presence is not String, Binary or JSON data [\#4](https://github.com/ably/ably-ruby/issues/4)
54
+
55
+ - Auth Callback and Auth URL should support tokens as well as token requests [\#2](https://github.com/ably/ably-ruby/issues/2)
56
+
57
+ **Closed issues:**
58
+
59
+ - Realtime Presence\#get does not wait by default [\#47](https://github.com/ably/ably-ruby/issues/47)
60
+
61
+ - No implicit attach when accessing channel.presence [\#45](https://github.com/ably/ably-ruby/issues/45)
62
+
63
+ **Merged pull requests:**
64
+
65
+ - Reject invalid payload type [\#48](https://github.com/ably/ably-ruby/pull/48) ([mattheworiordan](https://github.com/mattheworiordan))
66
+
67
+ ## [v0.8.1](https://github.com/ably/ably-ruby/tree/v0.8.1) (2015-04-23)
68
+
69
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.0...v0.8.1)
70
+
71
+ ## [v0.8.0](https://github.com/ably/ably-ruby/tree/v0.8.0) (2015-04-23)
72
+
73
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.6...v0.8.0)
74
+
75
+ **Merged pull requests:**
76
+
77
+ - Token naming refactor [\#29](https://github.com/ably/ably-ruby/pull/29) ([mattheworiordan](https://github.com/mattheworiordan))
78
+
79
+ ## [v0.7.6](https://github.com/ably/ably-ruby/tree/v0.7.6) (2015-04-17)
80
+
81
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.5...v0.7.6)
82
+
83
+ **Implemented enhancements:**
84
+
85
+ - Rename Stat to Stats for consistency [\#32](https://github.com/ably/ably-ruby/issues/32)
86
+
87
+ - Stats objects [\#24](https://github.com/ably/ably-ruby/issues/24)
88
+
89
+ - Need a test to handle errors in callbacks [\#13](https://github.com/ably/ably-ruby/issues/13)
90
+
91
+ - Allow token ID or API key in the client constructor [\#5](https://github.com/ably/ably-ruby/issues/5)
92
+
93
+ **Fixed bugs:**
94
+
95
+ - Need a test to handle errors in callbacks [\#13](https://github.com/ably/ably-ruby/issues/13)
96
+
97
+ **Closed issues:**
98
+
99
+ - New ttl format [\#15](https://github.com/ably/ably-ruby/issues/15)
100
+
101
+ **Merged pull requests:**
102
+
103
+ - Test encoded presence fixture data for \#get & \#history [\#28](https://github.com/ably/ably-ruby/pull/28) ([mattheworiordan](https://github.com/mattheworiordan))
104
+
105
+ - Add coveralls.io coverage reporting [\#27](https://github.com/ably/ably-ruby/pull/27) ([mattheworiordan](https://github.com/mattheworiordan))
106
+
107
+ - New paginated resource [\#26](https://github.com/ably/ably-ruby/pull/26) ([mattheworiordan](https://github.com/mattheworiordan))
108
+
109
+ - Typed stats similar to Java library + zero default for empty stats [\#25](https://github.com/ably/ably-ruby/pull/25) ([mattheworiordan](https://github.com/mattheworiordan))
110
+
111
+ ## [v0.7.5](https://github.com/ably/ably-ruby/tree/v0.7.5) (2015-03-21)
112
+
113
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.4...v0.7.5)
114
+
115
+ ## [v0.7.4](https://github.com/ably/ably-ruby/tree/v0.7.4) (2015-03-21)
116
+
117
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.2...v0.7.4)
118
+
119
+ **Merged pull requests:**
120
+
121
+ - Presence Member Map [\#14](https://github.com/ably/ably-ruby/pull/14) ([mattheworiordan](https://github.com/mattheworiordan))
122
+
123
+ ## [v0.7.2](https://github.com/ably/ably-ruby/tree/v0.7.2) (2015-02-10)
124
+
125
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.1...v0.7.2)
126
+
127
+ **Implemented enhancements:**
128
+
129
+ - Use PresenceMap for presence instead of queues [\#10](https://github.com/ably/ably-ruby/issues/10)
130
+
131
+ **Merged pull requests:**
132
+
133
+ - Update README to include various missing snippets for core features [\#9](https://github.com/ably/ably-ruby/pull/9) ([kouno](https://github.com/kouno))
134
+
135
+ - Fix connection retry frequency [\#7](https://github.com/ably/ably-ruby/pull/7) ([kouno](https://github.com/kouno))
136
+
137
+ ## [v0.7.1](https://github.com/ably/ably-ruby/tree/v0.7.1) (2015-01-18)
138
+
139
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.0...v0.7.1)
140
+
141
+ ## [v0.7.0](https://github.com/ably/ably-ruby/tree/v0.7.0) (2015-01-12)
142
+
143
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.6.2...v0.7.0)
144
+
145
+ **Closed issues:**
146
+
147
+ - JSON encoder should only append utf-8 before a cipher encoder is applied [\#1](https://github.com/ably/ably-ruby/issues/1)
148
+
149
+ ## [v0.6.2](https://github.com/ably/ably-ruby/tree/v0.6.2) (2014-12-10)
150
+
151
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.2.0...v0.6.2)
152
+
153
+ ## [v0.2.0](https://github.com/ably/ably-ruby/tree/v0.2.0) (2014-12-09)
154
+
155
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.6...v0.2.0)
156
+
157
+ ## [v0.1.6](https://github.com/ably/ably-ruby/tree/v0.1.6) (2014-10-31)
158
+
159
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.5...v0.1.6)
160
+
161
+ ## [v0.1.5](https://github.com/ably/ably-ruby/tree/v0.1.5) (2014-10-23)
162
+
163
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.4...v0.1.5)
164
+
165
+ ## [v0.1.4](https://github.com/ably/ably-ruby/tree/v0.1.4) (2014-09-27)
166
+
167
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.3...v0.1.4)
168
+
169
+ ## [v0.1.3](https://github.com/ably/ably-ruby/tree/v0.1.3) (2014-09-26)
170
+
171
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.2...v0.1.3)
172
+
173
+ ## [v0.1.2](https://github.com/ably/ably-ruby/tree/v0.1.2) (2014-09-25)
174
+
175
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.1...v0.1.2)
176
+
177
+ ## [v0.1.1](https://github.com/ably/ably-ruby/tree/v0.1.1) (2014-09-23)
178
+
179
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.0...v0.1.1)
180
+
181
+ ## [v0.1.0](https://github.com/ably/ably-ruby/tree/v0.1.0) (2014-09-23)
182
+
183
+
184
+
185
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (c) 2015 Ably
2
+
3
+ Copyright 2015 Ably Real-time Ltd
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md CHANGED
@@ -187,7 +187,7 @@ token_details = client.auth.request_token
187
187
  token_details.token # => "xVLyHw.CLchevH3hF....MDh9ZC_Q"
188
188
  client = Ably::Rest.new(token: token_details.token)
189
189
 
190
- token = client.auth.create_token_request
190
+ token = client.auth.create_token_request(token_params: { ttl: 3600 })
191
191
  # => {"id"=>...,
192
192
  # "clientId"=>nil,
193
193
  # "ttl"=>3600,
@@ -215,9 +215,13 @@ client.time #=> 2013-12-12 14:23:34 +0000
215
215
 
216
216
  If you only need to use the REST features of this library and do not want EventMachine as a dependency, then you should use the [Ably Ruby REST gem](https://rubygems.org/gems/ably-rest).
217
217
 
218
- ## Support and feedback
218
+ ## Support, feedback and troubleshooting
219
219
 
220
- Please visit https://support.ably.io/ for access to our knowledgebase and to ask for any assistance.
220
+ Please visit http://support.ably.io/ for access to our knowledgebase and to ask for any assistance.
221
+
222
+ You can also view the [community reported Github issues](https://github.com/ably/ably-ruby/issues).
223
+
224
+ To see what has changed in recent versions of Bundler, see the [CHANGELOG](CHANGELOG.md).
221
225
 
222
226
  ## Contributing
223
227
 
@@ -230,4 +234,4 @@ Please visit https://support.ably.io/ for access to our knowledgebase and to ask
230
234
 
231
235
  ## License
232
236
 
233
- Copyright (c) 2015 Ably, Licensed under an MIT license. Refer to [LICENSE.txt](LICENSE.txt) for the license terms.
237
+ Copyright (c) 2015 Ably Real-time Ltd, Licensed under the Apache License, Version 2.0. Refer to [LICENSE](LICENSE) for the license terms.
data/SPEC.md CHANGED
@@ -1,4 +1,59 @@
1
- # Ably Realtime & REST Client Library 0.8.1 Specification
1
+ # Ably Realtime & REST Client Library 0.8.2 Specification
2
+
3
+ ### Ably::Realtime::Auth
4
+ _(see [spec/acceptance/realtime/auth_spec.rb](./spec/acceptance/realtime/auth_spec.rb))_
5
+ * using JSON and MsgPack protocol
6
+ * with basic auth
7
+ * #authentication_security_requirements_met?
8
+ * [returns true](./spec/acceptance/realtime/auth_spec.rb#L20)
9
+ * #key
10
+ * [contains the API key](./spec/acceptance/realtime/auth_spec.rb#L27)
11
+ * #key_name
12
+ * [contains the API key name](./spec/acceptance/realtime/auth_spec.rb#L34)
13
+ * #key_secret
14
+ * [contains the API key secret](./spec/acceptance/realtime/auth_spec.rb#L41)
15
+ * #using_basic_auth?
16
+ * [is true when using Basic Auth](./spec/acceptance/realtime/auth_spec.rb#L48)
17
+ * #using_token_auth?
18
+ * [is false when using Basic Auth](./spec/acceptance/realtime/auth_spec.rb#L55)
19
+ * with token auth
20
+ * #client_id
21
+ * [contains the ClientOptions client ID](./spec/acceptance/realtime/auth_spec.rb#L67)
22
+ * #token
23
+ * [contains the current token after auth](./spec/acceptance/realtime/auth_spec.rb#L76)
24
+ * #current_token_details
25
+ * [contains the current token after auth](./spec/acceptance/realtime/auth_spec.rb#L83)
26
+ * #token_renewable?
27
+ * [is true when an API key exists](./spec/acceptance/realtime/auth_spec.rb#L93)
28
+ * #options (auth_options)
29
+ * [contains the configured auth options](./spec/acceptance/realtime/auth_spec.rb#L103)
30
+ * #token_params
31
+ * [contains the configured auth options](./spec/acceptance/realtime/auth_spec.rb#L114)
32
+ * #using_basic_auth?
33
+ * [is false when using Token Auth](./spec/acceptance/realtime/auth_spec.rb#L123)
34
+ * #using_token_auth?
35
+ * [is true when using Token Auth](./spec/acceptance/realtime/auth_spec.rb#L132)
36
+ *
37
+ * #create_token_request
38
+ * [returns a token request asynchronously](./spec/acceptance/realtime/auth_spec.rb#L146)
39
+ * #create_token_request_async
40
+ * [returns a token request synchronously](./spec/acceptance/realtime/auth_spec.rb#L156)
41
+ * #request_token
42
+ * [returns a token asynchronously](./spec/acceptance/realtime/auth_spec.rb#L166)
43
+ * #request_token_async
44
+ * [returns a token synchronously](./spec/acceptance/realtime/auth_spec.rb#L177)
45
+ * #authorise
46
+ * [returns a token asynchronously](./spec/acceptance/realtime/auth_spec.rb#L188)
47
+ * #authorise_async
48
+ * [returns a token synchronously](./spec/acceptance/realtime/auth_spec.rb#L199)
49
+ * #auth_params
50
+ * [returns the auth params asynchronously](./spec/acceptance/realtime/auth_spec.rb#L211)
51
+ * #auth_params
52
+ * [returns the auth params synchronously](./spec/acceptance/realtime/auth_spec.rb#L220)
53
+ * #auth_header
54
+ * [returns an auth header asynchronously](./spec/acceptance/realtime/auth_spec.rb#L227)
55
+ * #auth_header
56
+ * [returns an auth header synchronously](./spec/acceptance/realtime/auth_spec.rb#L236)
2
57
 
3
58
  ### Ably::Realtime::Channel#history
4
59
  _(see [spec/acceptance/realtime/channel_history_spec.rb](./spec/acceptance/realtime/channel_history_spec.rb))_
@@ -27,82 +82,135 @@ _(see [spec/acceptance/realtime/channel_history_spec.rb](./spec/acceptance/realt
27
82
  _(see [spec/acceptance/realtime/channel_spec.rb](./spec/acceptance/realtime/channel_spec.rb))_
28
83
  * using JSON and MsgPack protocol
29
84
  * initialization
30
- * with :connect_automatically option set to false on connection
85
+ * with :auto_connect option set to false on connection
31
86
  * [remains initialized when accessing a channel](./spec/acceptance/realtime/channel_spec.rb#L21)
32
87
  * [opens a connection implicitly on #attach](./spec/acceptance/realtime/channel_spec.rb#L29)
33
- * [opens a connection implicitly when accessing #presence](./spec/acceptance/realtime/channel_spec.rb#L36)
34
88
  * #attach
35
- * [emits attaching then attached events](./spec/acceptance/realtime/channel_spec.rb#L49)
36
- * [ignores subsequent #attach calls but calls the success callback if provided](./spec/acceptance/realtime/channel_spec.rb#L59)
37
- * [attaches to a channel](./spec/acceptance/realtime/channel_spec.rb#L72)
38
- * [attaches to a channel and calls the provided block](./spec/acceptance/realtime/channel_spec.rb#L80)
39
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_spec.rb#L87)
40
- * [calls the SafeDeferrable callback on success](./spec/acceptance/realtime/channel_spec.rb#L92)
89
+ * [emits attaching then attached events](./spec/acceptance/realtime/channel_spec.rb#L39)
90
+ * [ignores subsequent #attach calls but calls the success callback if provided](./spec/acceptance/realtime/channel_spec.rb#L49)
91
+ * [attaches to a channel](./spec/acceptance/realtime/channel_spec.rb#L62)
92
+ * [attaches to a channel and calls the provided block](./spec/acceptance/realtime/channel_spec.rb#L70)
93
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_spec.rb#L77)
94
+ * [calls the SafeDeferrable callback on success](./spec/acceptance/realtime/channel_spec.rb#L82)
41
95
  * when state is :failed
42
- * [reattaches](./spec/acceptance/realtime/channel_spec.rb#L103)
96
+ * [reattaches](./spec/acceptance/realtime/channel_spec.rb#L93)
43
97
  * when state is :detaching
44
- * [moves straight to attaching and skips detached](./spec/acceptance/realtime/channel_spec.rb#L116)
98
+ * [moves straight to attaching and skips detached](./spec/acceptance/realtime/channel_spec.rb#L106)
45
99
  * with many connections and many channels on each simultaneously
46
- * [attaches all channels](./spec/acceptance/realtime/channel_spec.rb#L142)
100
+ * [attaches all channels](./spec/acceptance/realtime/channel_spec.rb#L132)
47
101
  * failure as a result of insufficient key permissions
48
- * [triggers failed event](./spec/acceptance/realtime/channel_spec.rb#L165)
49
- * [calls the errback of the returned Deferrable](./spec/acceptance/realtime/channel_spec.rb#L174)
50
- * [triggers an error event](./spec/acceptance/realtime/channel_spec.rb#L182)
51
- * [updates the error_reason](./spec/acceptance/realtime/channel_spec.rb#L191)
102
+ * [emits failed event](./spec/acceptance/realtime/channel_spec.rb#L155)
103
+ * [calls the errback of the returned Deferrable](./spec/acceptance/realtime/channel_spec.rb#L164)
104
+ * [emits an error event](./spec/acceptance/realtime/channel_spec.rb#L172)
105
+ * [updates the error_reason](./spec/acceptance/realtime/channel_spec.rb#L181)
52
106
  * and subsequent authorisation with suitable permissions
53
- * [attaches to the channel successfully and resets the channel error_reason](./spec/acceptance/realtime/channel_spec.rb#L200)
107
+ * [attaches to the channel successfully and resets the channel error_reason](./spec/acceptance/realtime/channel_spec.rb#L190)
54
108
  * #detach
55
- * [detaches from a channel](./spec/acceptance/realtime/channel_spec.rb#L222)
56
- * [detaches from a channel and calls the provided block](./spec/acceptance/realtime/channel_spec.rb#L232)
57
- * [emits :detaching then :detached events](./spec/acceptance/realtime/channel_spec.rb#L241)
58
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_spec.rb#L253)
59
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/channel_spec.rb#L260)
109
+ * [detaches from a channel](./spec/acceptance/realtime/channel_spec.rb#L212)
110
+ * [detaches from a channel and calls the provided block](./spec/acceptance/realtime/channel_spec.rb#L222)
111
+ * [emits :detaching then :detached events](./spec/acceptance/realtime/channel_spec.rb#L231)
112
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_spec.rb#L243)
113
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/channel_spec.rb#L250)
60
114
  * when state is :failed
61
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L273)
115
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L263)
62
116
  * when state is :attaching
63
- * [moves straight to :detaching state and skips :attached](./spec/acceptance/realtime/channel_spec.rb#L284)
117
+ * [moves straight to :detaching state and skips :attached](./spec/acceptance/realtime/channel_spec.rb#L274)
64
118
  * when state is :detaching
65
- * [ignores subsequent #detach calls but calls the callback if provided](./spec/acceptance/realtime/channel_spec.rb#L302)
119
+ * [ignores subsequent #detach calls but calls the callback if provided](./spec/acceptance/realtime/channel_spec.rb#L292)
120
+ * when state is :initialized
121
+ * [does nothing as there is no channel to detach](./spec/acceptance/realtime/channel_spec.rb#L309)
122
+ * [returns a valid deferrable](./spec/acceptance/realtime/channel_spec.rb#L317)
66
123
  * channel recovery in :attaching state
67
124
  * the transport is disconnected before the ATTACHED protocol message is received
68
- * PENDING: *[attach times out and fails if not ATTACHED protocol message received](./spec/acceptance/realtime/channel_spec.rb#L321)*
69
- * PENDING: *[channel is ATTACHED if ATTACHED protocol message is later received](./spec/acceptance/realtime/channel_spec.rb#L322)*
70
- * PENDING: *[sends an ATTACH protocol message in response to a channel message being received on the attaching channel](./spec/acceptance/realtime/channel_spec.rb#L323)*
125
+ * PENDING: *[attach times out and fails if not ATTACHED protocol message received](./spec/acceptance/realtime/channel_spec.rb#L329)*
126
+ * PENDING: *[channel is ATTACHED if ATTACHED protocol message is later received](./spec/acceptance/realtime/channel_spec.rb#L330)*
127
+ * PENDING: *[sends an ATTACH protocol message in response to a channel message being received on the attaching channel](./spec/acceptance/realtime/channel_spec.rb#L331)*
71
128
  * #publish
72
129
  * when attached
73
- * [publishes messages](./spec/acceptance/realtime/channel_spec.rb#L329)
130
+ * [publishes messages](./spec/acceptance/realtime/channel_spec.rb#L340)
74
131
  * when not yet attached
75
- * [publishes queued messages once attached](./spec/acceptance/realtime/channel_spec.rb#L341)
76
- * [publishes queued messages within a single protocol message](./spec/acceptance/realtime/channel_spec.rb#L349)
132
+ * [publishes queued messages once attached](./spec/acceptance/realtime/channel_spec.rb#L352)
133
+ * [publishes queued messages within a single protocol message](./spec/acceptance/realtime/channel_spec.rb#L360)
134
+ * with :queue_messages client option set to false
135
+ * and connection state initialized
136
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L383)
137
+ * and connection state connecting
138
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L391)
139
+ * and connection state disconnected
140
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L403)
141
+ * and connection state connected
142
+ * [publishes the message](./spec/acceptance/realtime/channel_spec.rb#L416)
143
+ * with name and data arguments
144
+ * [publishes the message and return true indicating success](./spec/acceptance/realtime/channel_spec.rb#L427)
145
+ * with an array of Hash objects with :name and :data attributes
146
+ * [publishes an array of messages in one ProtocolMessage](./spec/acceptance/realtime/channel_spec.rb#L445)
147
+ * with an array of Message objects
148
+ * [publishes an array of messages in one ProtocolMessage](./spec/acceptance/realtime/channel_spec.rb#L473)
149
+ * with two invalid message out of 12
150
+ * PENDING: *[calls the errback once](./spec/acceptance/realtime/channel_spec.rb#L501)*
151
+ * only invalid messages
152
+ * PENDING: *[calls the errback once](./spec/acceptance/realtime/channel_spec.rb#L527)*
153
+ * with many many messages and many connections simultaneously
154
+ * [publishes all messages, all success callbacks are called, and a history request confirms all messages were published](./spec/acceptance/realtime/channel_spec.rb#L551)
77
155
  * #subscribe
78
156
  * with an event argument
79
- * [subscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L372)
157
+ * [subscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L574)
158
+ * before attach
159
+ * [receives messages as soon as attached](./spec/acceptance/realtime/channel_spec.rb#L584)
80
160
  * with no event argument
81
- * [subscribes for all events](./spec/acceptance/realtime/channel_spec.rb#L382)
161
+ * [subscribes for all events](./spec/acceptance/realtime/channel_spec.rb#L598)
82
162
  * many times with different event names
83
- * [filters events accordingly to each callback](./spec/acceptance/realtime/channel_spec.rb#L392)
163
+ * [filters events accordingly to each callback](./spec/acceptance/realtime/channel_spec.rb#L608)
84
164
  * #unsubscribe
85
165
  * with an event argument
86
- * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L415)
166
+ * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L631)
87
167
  * with no event argument
88
- * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L428)
168
+ * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L644)
89
169
  * when connection state changes to
90
170
  * :failed
91
171
  * an :attached channel
92
- * [transitions state to :failed](./spec/acceptance/realtime/channel_spec.rb#L451)
93
- * [triggers an error event on the channel](./spec/acceptance/realtime/channel_spec.rb#L461)
94
- * [updates the channel error_reason](./spec/acceptance/realtime/channel_spec.rb#L471)
172
+ * [transitions state to :failed](./spec/acceptance/realtime/channel_spec.rb#L667)
173
+ * [emits an error event on the channel](./spec/acceptance/realtime/channel_spec.rb#L678)
174
+ * [updates the channel error_reason](./spec/acceptance/realtime/channel_spec.rb#L689)
95
175
  * a :detached channel
96
- * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L483)
176
+ * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L702)
97
177
  * a :failed channel
98
- * [remains in the :failed state and ignores the failure error](./spec/acceptance/realtime/channel_spec.rb#L503)
178
+ * [remains in the :failed state and ignores the failure error](./spec/acceptance/realtime/channel_spec.rb#L722)
179
+ * a channel ATTACH request
180
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L743)
99
181
  * :closed
100
182
  * an :attached channel
101
- * [transitions state to :detached](./spec/acceptance/realtime/channel_spec.rb#L526)
183
+ * [transitions state to :detached](./spec/acceptance/realtime/channel_spec.rb#L757)
102
184
  * a :detached channel
103
- * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L537)
185
+ * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L768)
104
186
  * a :failed channel
105
- * [remains in the :failed state and retains the error_reason](./spec/acceptance/realtime/channel_spec.rb#L558)
187
+ * [remains in the :failed state and retains the error_reason](./spec/acceptance/realtime/channel_spec.rb#L789)
188
+ * a channel ATTACH request when connection CLOSED
189
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L810)
190
+ * a channel ATTACH request when connection CLOSING
191
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L822)
192
+ * #presence
193
+ * [returns a Ably::Realtime::Presence object](./spec/acceptance/realtime/channel_spec.rb#L836)
194
+
195
+ ### Ably::Realtime::Channels
196
+ _(see [spec/acceptance/realtime/channels_spec.rb](./spec/acceptance/realtime/channels_spec.rb))_
197
+ * using JSON and MsgPack protocol
198
+ * using shortcut method #channel on the client object
199
+ * behaves like a channel
200
+ * [returns a channel object](./spec/acceptance/realtime/channels_spec.rb#L6)
201
+ * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L11)
202
+ * using #get method on client#channels
203
+ * behaves like a channel
204
+ * [returns a channel object](./spec/acceptance/realtime/channels_spec.rb#L6)
205
+ * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L11)
206
+ * accessing an existing channel object with different options
207
+ * [overrides the existing channel options and returns the channel object](./spec/acceptance/realtime/channels_spec.rb#L39)
208
+ * accessing an existing channel object without specifying any channel options
209
+ * [returns the existing channel without modifying the channel options](./spec/acceptance/realtime/channels_spec.rb#L50)
210
+ * using undocumented array accessor [] method on client#channels
211
+ * behaves like a channel
212
+ * [returns a channel object](./spec/acceptance/realtime/channels_spec.rb#L6)
213
+ * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L11)
106
214
 
107
215
  ### Ably::Realtime::Client
108
216
  _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/client_spec.rb))_
@@ -111,7 +219,7 @@ _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/clien
111
219
  * basic auth
112
220
  * [is enabled by default with a provided :key option](./spec/acceptance/realtime/client_spec.rb#L18)
113
221
  * :tls option
114
- * set to false to forec a plain-text connection
222
+ * set to false to force a plain-text connection
115
223
  * [fails to connect because a private key cannot be sent over a non-secure connection](./spec/acceptance/realtime/client_spec.rb#L31)
116
224
  * token auth
117
225
  * with TLS enabled
@@ -131,6 +239,12 @@ _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/clien
131
239
  * with a Proc for the :auth_callback option
132
240
  * [calls the Proc](./spec/acceptance/realtime/client_spec.rb#L102)
133
241
  * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/realtime/client_spec.rb#L109)
242
+ * #connection
243
+ * [provides access to the Connection object](./spec/acceptance/realtime/client_spec.rb#L120)
244
+ * #channels
245
+ * [provides access to the Channels collection object](./spec/acceptance/realtime/client_spec.rb#L127)
246
+ * #auth
247
+ * [provides access to the Realtime::Auth object](./spec/acceptance/realtime/client_spec.rb#L134)
134
248
 
135
249
  ### Ably::Realtime::Connection failures
136
250
  _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/realtime/connection_failures_spec.rb))_
@@ -153,7 +267,7 @@ _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/r
153
267
  * [transitions connection state to :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L151)
154
268
  * when connection state is :failed
155
269
  * #close
156
- * [will not transition state to :close and raises a StateChangeError exception](./spec/acceptance/realtime/connection_failures_spec.rb#L170)
270
+ * [will not transition state to :close and raises a InvalidStateChange exception](./spec/acceptance/realtime/connection_failures_spec.rb#L170)
157
271
  * #error_reason
158
272
  * [contains the error when state is disconnected](./spec/acceptance/realtime/connection_failures_spec.rb#L184)
159
273
  * [contains the error when state is suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L184)
@@ -162,8 +276,8 @@ _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/r
162
276
  * [is reset to nil when :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L204)
163
277
  * #connect
164
278
  * connection opening times out
165
- * [attempts to reconnect](./spec/acceptance/realtime/connection_failures_spec.rb#L231)
166
- * [calls the errback of the returned Deferrable object when first connection attempt fails](./spec/acceptance/realtime/connection_failures_spec.rb#L244)
279
+ * [attempts to reconnect](./spec/acceptance/realtime/connection_failures_spec.rb#L233)
280
+ * [calls the errback of the returned Deferrable object when first connection attempt fails](./spec/acceptance/realtime/connection_failures_spec.rb#L246)
167
281
  * when retry intervals are stubbed to attempt reconnection quickly
168
282
  * [never calls the provided success block](./spec/acceptance/realtime/connection_failures_spec.rb#L263)
169
283
  * connection resume
@@ -182,414 +296,625 @@ _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/r
182
296
  * because the connection_key is not or no longer valid
183
297
  * [updates the connection_id and connection_key](./spec/acceptance/realtime/connection_failures_spec.rb#L470)
184
298
  * [detaches all channels](./spec/acceptance/realtime/connection_failures_spec.rb#L485)
185
- * [emits an error on the channel and sets the error reason](./spec/acceptance/realtime/connection_failures_spec.rb#L503)
299
+ * [emits an error on the channel and sets the error reason](./spec/acceptance/realtime/connection_failures_spec.rb#L504)
186
300
  * fallback host feature
187
301
  * with custom realtime websocket host option
188
- * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L542)
189
- * with non-production environment
302
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L543)
303
+ * with custom realtime websocket port option
190
304
  * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L559)
305
+ * with non-production environment
306
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L576)
191
307
  * with production environment
192
308
  * when the Internet is down
193
- * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L587)
309
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L604)
194
310
  * when the Internet is up
195
- * [uses a fallback host on every subsequent disconnected attempt until suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L604)
196
- * [uses the primary host when suspended, and a fallback host on every subsequent suspended attempt](./spec/acceptance/realtime/connection_failures_spec.rb#L623)
311
+ * [uses a fallback host on every subsequent disconnected attempt until suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L621)
312
+ * [uses the primary host when suspended, and a fallback host on every subsequent suspended attempt](./spec/acceptance/realtime/connection_failures_spec.rb#L640)
197
313
 
198
314
  ### Ably::Realtime::Connection
199
315
  _(see [spec/acceptance/realtime/connection_spec.rb](./spec/acceptance/realtime/connection_spec.rb))_
200
316
  * using JSON and MsgPack protocol
201
317
  * intialization
202
318
  * [connects automatically](./spec/acceptance/realtime/connection_spec.rb#L23)
203
- * with :connect_automatically option set to false
319
+ * with :auto_connect option set to false
204
320
  * [does not connect automatically](./spec/acceptance/realtime/connection_spec.rb#L35)
205
321
  * [connects when method #connect is called](./spec/acceptance/realtime/connection_spec.rb#L43)
206
322
  * with token auth
207
323
  * for renewable tokens
208
324
  * that are valid for the duration of the test
209
325
  * with valid pre authorised token expiring in the future
210
- * [uses the existing token created by Auth](./spec/acceptance/realtime/connection_spec.rb#L61)
326
+ * [uses the existing token created by Auth](./spec/acceptance/realtime/connection_spec.rb#L64)
211
327
  * with implicit authorisation
212
- * [uses the token created by the implicit authorisation](./spec/acceptance/realtime/connection_spec.rb#L73)
328
+ * [uses the token created by the implicit authorisation](./spec/acceptance/realtime/connection_spec.rb#L76)
213
329
  * that expire
214
330
  * opening a new connection
215
331
  * with recently expired token
216
- * [renews the token on connect](./spec/acceptance/realtime/connection_spec.rb#L94)
332
+ * [renews the token on connect without changing connection state](./spec/acceptance/realtime/connection_spec.rb#L108)
217
333
  * with immediately expiring token
218
- * [renews the token on connect, and only makes one subsequent attempt to obtain a new token](./spec/acceptance/realtime/connection_spec.rb#L108)
219
- * [uses the primary host for subsequent connection and auth requests](./spec/acceptance/realtime/connection_spec.rb#L118)
334
+ * [renews the token on connect, and only makes one subsequent attempt to obtain a new token](./spec/acceptance/realtime/connection_spec.rb#L127)
335
+ * [uses the primary host for subsequent connection and auth requests](./spec/acceptance/realtime/connection_spec.rb#L137)
220
336
  * when connected with a valid non-expired token
221
337
  * that then expires following the connection being opened
222
- * PENDING: *[retains connection state](./spec/acceptance/realtime/connection_spec.rb#L166)*
223
- * PENDING: *[changes state to failed if a new token cannot be issued](./spec/acceptance/realtime/connection_spec.rb#L167)*
338
+ * PENDING: *[retains connection state](./spec/acceptance/realtime/connection_spec.rb#L193)*
339
+ * PENDING: *[changes state to failed if a new token cannot be issued](./spec/acceptance/realtime/connection_spec.rb#L194)*
224
340
  * the server
225
- * [disconnects the client, and the client automatically renews the token and then reconnects](./spec/acceptance/realtime/connection_spec.rb#L145)
341
+ * [disconnects the client, and the client automatically renews the token and then reconnects](./spec/acceptance/realtime/connection_spec.rb#L164)
226
342
  * for non-renewable tokens
227
343
  * that are expired
228
344
  * opening a new connection
229
- * [transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L182)
345
+ * [transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L214)
230
346
  * when connected
231
- * PENDING: *[transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L195)*
347
+ * PENDING: *[transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L227)*
232
348
  * initialization state changes
233
349
  * with implicit #connect
234
- * [are triggered in order](./spec/acceptance/realtime/connection_spec.rb#L222)
350
+ * [are emitted in order](./spec/acceptance/realtime/connection_spec.rb#L254)
235
351
  * with explicit #connect
236
- * [are triggered in order](./spec/acceptance/realtime/connection_spec.rb#L228)
352
+ * [are emitted in order](./spec/acceptance/realtime/connection_spec.rb#L260)
237
353
  * #connect
238
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L236)
239
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L241)
354
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L268)
355
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L273)
240
356
  * when already connected
241
- * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L250)
357
+ * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L282)
358
+ * connection#id
359
+ * [is null before connecting](./spec/acceptance/realtime/connection_spec.rb#L296)
360
+ * connection#key
361
+ * [is null before connecting](./spec/acceptance/realtime/connection_spec.rb#L303)
242
362
  * once connected
243
363
  * connection#id
244
- * [is a string](./spec/acceptance/realtime/connection_spec.rb#L267)
245
- * [is unique from the connection#key](./spec/acceptance/realtime/connection_spec.rb#L274)
246
- * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L281)
364
+ * [is a string](./spec/acceptance/realtime/connection_spec.rb#L313)
365
+ * [is unique from the connection#key](./spec/acceptance/realtime/connection_spec.rb#L320)
366
+ * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L327)
247
367
  * connection#key
248
- * [is a string](./spec/acceptance/realtime/connection_spec.rb#L290)
249
- * [is unique from the connection#id](./spec/acceptance/realtime/connection_spec.rb#L297)
250
- * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L304)
368
+ * [is a string](./spec/acceptance/realtime/connection_spec.rb#L336)
369
+ * [is unique from the connection#id](./spec/acceptance/realtime/connection_spec.rb#L343)
370
+ * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L350)
251
371
  * following a previous connection being opened and closed
252
- * [reconnects and is provided with a new connection ID and connection key from the server](./spec/acceptance/realtime/connection_spec.rb#L314)
372
+ * [reconnects and is provided with a new connection ID and connection key from the server](./spec/acceptance/realtime/connection_spec.rb#L360)
373
+ * when closing
374
+ * [raises an exception before the connection is closed](./spec/acceptance/realtime/connection_spec.rb#L377)
253
375
  * #serial connection serial
254
- * [is set to -1 when a new connection is opened](./spec/acceptance/realtime/connection_spec.rb#L334)
255
- * [is set to 0 when a message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L356)
256
- * [is set to 1 when the second message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L363)
376
+ * [is set to -1 when a new connection is opened](./spec/acceptance/realtime/connection_spec.rb#L392)
377
+ * [is set to 0 when a message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L413)
378
+ * [is set to 1 when the second message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L420)
257
379
  * when a message is sent but the ACK has not yet been received
258
- * [the sent message msgSerial is 0 but the connection serial remains at -1](./spec/acceptance/realtime/connection_spec.rb#L343)
380
+ * [the sent message msgSerial is 0 but the connection serial remains at -1](./spec/acceptance/realtime/connection_spec.rb#L400)
259
381
  * #close
260
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L374)
261
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L381)
382
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L431)
383
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L438)
262
384
  * when already closed
263
- * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L392)
385
+ * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L449)
264
386
  * when connection state is
265
387
  * :initialized
266
- * [changes the connection state to :closing and then immediately :closed without sending a ProtocolMessage CLOSE](./spec/acceptance/realtime/connection_spec.rb#L420)
388
+ * [changes the connection state to :closing and then immediately :closed without sending a ProtocolMessage CLOSE](./spec/acceptance/realtime/connection_spec.rb#L477)
267
389
  * :connected
268
- * [changes the connection state to :closing and waits for the server to confirm connection is :closed with a ProtocolMessage](./spec/acceptance/realtime/connection_spec.rb#L438)
390
+ * [changes the connection state to :closing and waits for the server to confirm connection is :closed with a ProtocolMessage](./spec/acceptance/realtime/connection_spec.rb#L495)
269
391
  * with an unresponsive connection
270
- * [force closes the connection when a :closed ProtocolMessage response is not received](./spec/acceptance/realtime/connection_spec.rb#L468)
392
+ * [force closes the connection when a :closed ProtocolMessage response is not received](./spec/acceptance/realtime/connection_spec.rb#L525)
271
393
  * #ping
272
- * [echoes a heart beat](./spec/acceptance/realtime/connection_spec.rb#L491)
394
+ * [echoes a heart beat](./spec/acceptance/realtime/connection_spec.rb#L548)
273
395
  * when not connected
274
- * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L501)
396
+ * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L558)
275
397
  * with a success block that raises an exception
276
- * [catches the exception and logs the error](./spec/acceptance/realtime/connection_spec.rb#L508)
398
+ * [catches the exception and logs the error](./spec/acceptance/realtime/connection_spec.rb#L565)
277
399
  * recovery
278
400
  * #recovery_key
279
- * [is composed of connection key and serial that is kept up to date with each message ACK received](./spec/acceptance/realtime/connection_spec.rb#L545)
280
- * [is available when connection is in one of the states: connecting, connected, disconnected, suspended, failed](./spec/acceptance/realtime/connection_spec.rb#L568)
281
- * [is nil when connection is explicitly CLOSED](./spec/acceptance/realtime/connection_spec.rb#L592)
401
+ * [is composed of connection key and serial that is kept up to date with each message ACK received](./spec/acceptance/realtime/connection_spec.rb#L602)
402
+ * [is available when connection is in one of the states: connecting, connected, disconnected, suspended, failed](./spec/acceptance/realtime/connection_spec.rb#L625)
403
+ * [is nil when connection is explicitly CLOSED](./spec/acceptance/realtime/connection_spec.rb#L649)
282
404
  * opening a new connection using a recently disconnected connection's #recovery_key
283
405
  * connection#id and connection#key after recovery
284
- * [remains the same](./spec/acceptance/realtime/connection_spec.rb#L606)
406
+ * [remains the same](./spec/acceptance/realtime/connection_spec.rb#L663)
285
407
  * when messages have been sent whilst the old connection is disconnected
286
408
  * the new connection
287
- * [recovers server-side queued messages](./spec/acceptance/realtime/connection_spec.rb#L647)
409
+ * [recovers server-side queued messages](./spec/acceptance/realtime/connection_spec.rb#L704)
288
410
  * with :recover option
289
411
  * with invalid syntax
290
- * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L672)
412
+ * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L729)
291
413
  * with invalid formatted value sent to server
292
- * [triggers a fatal error on the connection object, sets the #error_reason and disconnects](./spec/acceptance/realtime/connection_spec.rb#L681)
414
+ * [emits a fatal error on the connection object, sets the #error_reason and disconnects](./spec/acceptance/realtime/connection_spec.rb#L738)
293
415
  * with expired (missing) value sent to server
294
- * [triggers an error on the connection object, sets the #error_reason, yet will connect anyway](./spec/acceptance/realtime/connection_spec.rb#L696)
416
+ * [emits an error on the connection object, sets the #error_reason, yet will connect anyway](./spec/acceptance/realtime/connection_spec.rb#L753)
295
417
  * with many connections simultaneously
296
- * [opens each with a unique connection#id and connection#key](./spec/acceptance/realtime/connection_spec.rb#L715)
418
+ * [opens each with a unique connection#id and connection#key](./spec/acceptance/realtime/connection_spec.rb#L772)
297
419
  * when a state transition is unsupported
298
- * [emits a StateChangeError](./spec/acceptance/realtime/connection_spec.rb#L735)
420
+ * [emits a InvalidStateChange](./spec/acceptance/realtime/connection_spec.rb#L792)
299
421
  * protocol failure
300
422
  * receiving an invalid ProtocolMessage
301
- * [emits an error on the connection and logs a fatal error message](./spec/acceptance/realtime/connection_spec.rb#L751)
423
+ * [emits an error on the connection and logs a fatal error message](./spec/acceptance/realtime/connection_spec.rb#L808)
302
424
  * undocumented method
303
425
  * #internet_up?
304
- * [returns a Deferrable](./spec/acceptance/realtime/connection_spec.rb#L767)
426
+ * [returns a Deferrable](./spec/acceptance/realtime/connection_spec.rb#L824)
305
427
  * internet up URL protocol
306
428
  * when using TLS for the connection
307
- * [uses TLS for the Internet check to https://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L778)
429
+ * [uses TLS for the Internet check to https://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L835)
308
430
  * when using a non-secured connection
309
- * [uses TLS for the Internet check to http://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L788)
431
+ * [uses TLS for the Internet check to http://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L845)
310
432
  * when the Internet is up
311
- * [calls the block with true](./spec/acceptance/realtime/connection_spec.rb#L797)
312
- * [calls the success callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L804)
433
+ * [calls the block with true](./spec/acceptance/realtime/connection_spec.rb#L876)
434
+ * [calls the success callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L883)
435
+ * with a TLS connection
436
+ * [checks the Internet up URL over TLS](./spec/acceptance/realtime/connection_spec.rb#L859)
437
+ * with a non-TLS connection
438
+ * [checks the Internet up URL over TLS](./spec/acceptance/realtime/connection_spec.rb#L869)
313
439
  * when the Internet is down
314
- * [calls the block with false](./spec/acceptance/realtime/connection_spec.rb#L816)
315
- * [calls the failure callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L823)
440
+ * [calls the block with false](./spec/acceptance/realtime/connection_spec.rb#L898)
441
+ * [calls the failure callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L905)
442
+ * state change side effects
443
+ * when connection enters the :disconnected state
444
+ * [queues messages to be sent and all channels remain attached](./spec/acceptance/realtime/connection_spec.rb#L919)
445
+ * when connection enters the :suspended state
446
+ * [detaches the channels and prevents publishing of messages on those channels](./spec/acceptance/realtime/connection_spec.rb#L952)
447
+ * when connection enters the :failed state
448
+ * [sets all channels to failed and prevents publishing of messages on those channels](./spec/acceptance/realtime/connection_spec.rb#L973)
316
449
 
317
450
  ### Ably::Realtime::Channel Message
318
451
  _(see [spec/acceptance/realtime/message_spec.rb](./spec/acceptance/realtime/message_spec.rb))_
319
452
  * using JSON and MsgPack protocol
320
453
  * [sends a String data payload](./spec/acceptance/realtime/message_spec.rb#L25)
454
+ * with supported data payload content type
455
+ * JSON Object (Hash)
456
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/message_spec.rb#L48)
457
+ * JSON Array
458
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/message_spec.rb#L56)
459
+ * String
460
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/message_spec.rb#L64)
461
+ * Binary
462
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/message_spec.rb#L72)
463
+ * with unsupported data payload content type
464
+ * Integer
465
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/message_spec.rb#L82)
466
+ * Float
467
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/message_spec.rb#L91)
468
+ * Boolean
469
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/message_spec.rb#L100)
470
+ * False
471
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/message_spec.rb#L109)
321
472
  * with ASCII_8BIT message name
322
- * [is converted into UTF_8](./spec/acceptance/realtime/message_spec.rb#L37)
473
+ * [is converted into UTF_8](./spec/acceptance/realtime/message_spec.rb#L118)
323
474
  * when the message publisher has a client_id
324
- * [contains a #client_id attribute](./spec/acceptance/realtime/message_spec.rb#L53)
475
+ * PENDING: *[contains a #client_id attribute](./spec/acceptance/realtime/message_spec.rb#L134)*
325
476
  * #connection_id attribute
326
477
  * over realtime
327
- * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L66)
478
+ * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L148)
328
479
  * when retrieved over REST
329
- * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L78)
480
+ * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L160)
330
481
  * local echo when published
331
- * [is enabled by default](./spec/acceptance/realtime/message_spec.rb#L90)
482
+ * [is enabled by default](./spec/acceptance/realtime/message_spec.rb#L172)
332
483
  * with :echo_messages option set to false
333
- * [will not echo messages to the client but will still broadcast messages to other connected clients](./spec/acceptance/realtime/message_spec.rb#L106)
484
+ * [will not echo messages to the client but will still broadcast messages to other connected clients](./spec/acceptance/realtime/message_spec.rb#L188)
334
485
  * publishing lots of messages across two connections
335
- * [sends and receives the messages on both opened connections and calls the success callbacks for each message published](./spec/acceptance/realtime/message_spec.rb#L138)
486
+ * [sends and receives the messages on both opened connections and calls the success callbacks for each message published](./spec/acceptance/realtime/message_spec.rb#L220)
336
487
  * without suitable publishing permissions
337
- * [calls the error callback](./spec/acceptance/realtime/message_spec.rb#L183)
488
+ * [calls the error callback](./spec/acceptance/realtime/message_spec.rb#L265)
338
489
  * server incorrectly resends a message that was already received by the client library
339
- * [discards the message and logs it as an error to the channel](./spec/acceptance/realtime/message_spec.rb#L203)
490
+ * [discards the message and logs it as an error to the channel](./spec/acceptance/realtime/message_spec.rb#L285)
340
491
  * encoding and decoding encrypted messages
341
492
  * with AES-128-CBC using crypto-data-128.json fixtures
342
493
  * item 0 with encrypted encoding utf-8/cipher+aes-128-cbc/base64
343
494
  * behaves like an Ably encrypter and decrypter
344
495
  * with #publish and #subscribe
345
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
346
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
496
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
497
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
347
498
  * item 1 with encrypted encoding cipher+aes-128-cbc/base64
348
499
  * behaves like an Ably encrypter and decrypter
349
500
  * with #publish and #subscribe
350
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
351
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
501
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
502
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
352
503
  * item 2 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
353
504
  * behaves like an Ably encrypter and decrypter
354
505
  * with #publish and #subscribe
355
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
356
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
506
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
507
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
357
508
  * item 3 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
358
509
  * behaves like an Ably encrypter and decrypter
359
510
  * with #publish and #subscribe
360
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
361
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
511
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
512
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
362
513
  * with AES-256-CBC using crypto-data-256.json fixtures
363
514
  * item 0 with encrypted encoding utf-8/cipher+aes-256-cbc/base64
364
515
  * behaves like an Ably encrypter and decrypter
365
516
  * with #publish and #subscribe
366
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
367
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
517
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
518
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
368
519
  * item 1 with encrypted encoding cipher+aes-256-cbc/base64
369
520
  * behaves like an Ably encrypter and decrypter
370
521
  * with #publish and #subscribe
371
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
372
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
522
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
523
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
373
524
  * item 2 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
374
525
  * behaves like an Ably encrypter and decrypter
375
526
  * with #publish and #subscribe
376
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
377
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
527
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
528
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
378
529
  * item 3 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
379
530
  * behaves like an Ably encrypter and decrypter
380
531
  * with #publish and #subscribe
381
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L267)
382
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L285)
532
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
533
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
383
534
  * with multiple sends from one client to another
384
- * [encrypts and decrypts all messages](./spec/acceptance/realtime/message_spec.rb#L324)
535
+ * [encrypts and decrypts all messages](./spec/acceptance/realtime/message_spec.rb#L406)
385
536
  * subscribing with a different transport protocol
386
- * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L367)
387
- * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L367)
388
- * [delivers a Hash payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L367)
537
+ * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L449)
538
+ * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L449)
539
+ * [delivers a Hash payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L449)
389
540
  * publishing on an unencrypted channel and subscribing on an encrypted channel with another client
390
- * [does not attempt to decrypt the message](./spec/acceptance/realtime/message_spec.rb#L386)
541
+ * [does not attempt to decrypt the message](./spec/acceptance/realtime/message_spec.rb#L468)
391
542
  * publishing on an encrypted channel and subscribing on an unencrypted channel with another client
392
- * [delivers the message but still encrypted with a value in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L404)
393
- * [triggers a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L413)
543
+ * [delivers the message but still encrypted with a value in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L486)
544
+ * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L495)
394
545
  * publishing on an encrypted channel and subscribing with a different algorithm on another client
395
- * [delivers the message but still encrypted with the cipher detials in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L435)
396
- * [triggers a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L444)
546
+ * [delivers the message but still encrypted with the cipher detials in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L517)
547
+ * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L526)
397
548
  * publishing on an encrypted channel and subscribing with a different key on another client
398
- * [delivers the message but still encrypted with the cipher details in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L466)
399
- * [triggers a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L475)
549
+ * [delivers the message but still encrypted with the cipher details in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L548)
550
+ * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L559)
400
551
 
401
552
  ### Ably::Realtime::Presence history
402
553
  _(see [spec/acceptance/realtime/presence_history_spec.rb](./spec/acceptance/realtime/presence_history_spec.rb))_
403
554
  * using JSON and MsgPack protocol
404
555
  * [provides up to the moment presence history](./spec/acceptance/realtime/presence_history_spec.rb#L21)
405
- * [ensures REST presence history message IDs match ProtocolMessage wrapped message and connection IDs via Realtime](./spec/acceptance/realtime/presence_history_spec.rb#L41)
556
+ * [ensures REST presence history message IDs match ProtocolMessage wrapped message and connection IDs via Realtime](./spec/acceptance/realtime/presence_history_spec.rb#L42)
406
557
  * with option until_attach: true
407
- * [retrieves all presence messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L60)
408
- * [raises an exception unless state is attached](./spec/acceptance/realtime/presence_history_spec.rb#L92)
558
+ * [retrieves all presence messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L61)
559
+ * [raises an exception unless state is attached](./spec/acceptance/realtime/presence_history_spec.rb#L93)
409
560
  * and two pages of messages
410
- * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L73)
561
+ * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L74)
411
562
 
412
563
  ### Ably::Realtime::Presence
413
564
  _(see [spec/acceptance/realtime/presence_spec.rb](./spec/acceptance/realtime/presence_spec.rb))_
414
565
  * using JSON and MsgPack protocol
415
566
  * when attached (but not present) on a presence channel with an anonymous client (no client ID)
416
- * [maintains state as other clients enter and leave the channel](./spec/acceptance/realtime/presence_spec.rb#L118)
567
+ * [maintains state as other clients enter and leave the channel](./spec/acceptance/realtime/presence_spec.rb#L282)
417
568
  * #sync_complete?
418
569
  * when attaching to a channel without any members present
419
- * [is true and the presence channel is considered synced immediately](./spec/acceptance/realtime/presence_spec.rb#L190)
570
+ * [is true and the presence channel is considered synced immediately](./spec/acceptance/realtime/presence_spec.rb#L358)
420
571
  * when attaching to a channel with members present
421
- * [is false and the presence channel will subsequently be synced](./spec/acceptance/realtime/presence_spec.rb#L199)
572
+ * [is false and the presence channel will subsequently be synced](./spec/acceptance/realtime/presence_spec.rb#L367)
422
573
  * 250 existing (present) members on a channel (3 SYNC pages)
423
574
  * requires at least 3 SYNC ProtocolMessages
424
575
  * when a client attaches to the presence channel
425
- * [emits :present for each member](./spec/acceptance/realtime/presence_spec.rb#L231)
576
+ * [emits :present for each member](./spec/acceptance/realtime/presence_spec.rb#L399)
426
577
  * and a member leaves before the SYNC operation is complete
427
- * [emits :leave immediately as the member leaves](./spec/acceptance/realtime/presence_spec.rb#L245)
428
- * [ignores presence events with timestamps prior to the current :present event in the MembersMap](./spec/acceptance/realtime/presence_spec.rb#L283)
429
- * [does not emit :present after the :leave event has been emitted, and that member is not included in the list of members via #get](./spec/acceptance/realtime/presence_spec.rb#L322)
578
+ * [emits :leave immediately as the member leaves](./spec/acceptance/realtime/presence_spec.rb#L413)
579
+ * [ignores presence events with timestamps prior to the current :present event in the MembersMap](./spec/acceptance/realtime/presence_spec.rb#L451)
580
+ * [does not emit :present after the :leave event has been emitted, and that member is not included in the list of members via #get with :wait_for_sync](./spec/acceptance/realtime/presence_spec.rb#L490)
430
581
  * #get
431
- * [waits until sync is complete](./spec/acceptance/realtime/presence_spec.rb#L368)
432
- * automatic attachment of channel on access to presence object
433
- * [is implicit if presence state is initialized](./spec/acceptance/realtime/presence_spec.rb#L388)
434
- * [is disabled if presence state is not initialized](./spec/acceptance/realtime/presence_spec.rb#L396)
582
+ * with :wait_for_sync option set to true
583
+ * [waits until sync is complete](./spec/acceptance/realtime/presence_spec.rb#L537)
584
+ * by default
585
+ * [it does not wait for sync](./spec/acceptance/realtime/presence_spec.rb#L554)
435
586
  * state
436
587
  * once opened
437
- * [once opened, enters the :left state if the channel detaches](./spec/acceptance/realtime/presence_spec.rb#L413)
588
+ * [once opened, enters the :left state if the channel detaches](./spec/acceptance/realtime/presence_spec.rb#L578)
438
589
  * #enter
439
- * [allows client_id to be set on enter for anonymous clients](./spec/acceptance/realtime/presence_spec.rb#L436)
440
- * [raises an exception if client_id is not set](./spec/acceptance/realtime/presence_spec.rb#L483)
590
+ * [allows client_id to be set on enter for anonymous clients](./spec/acceptance/realtime/presence_spec.rb#L601)
591
+ * [raises an exception if client_id is not set](./spec/acceptance/realtime/presence_spec.rb#L648)
441
592
  * data attribute
442
593
  * when provided as argument option to #enter
443
- * [remains intact following #leave](./spec/acceptance/realtime/presence_spec.rb#L447)
594
+ * [remains intact following #leave](./spec/acceptance/realtime/presence_spec.rb#L612)
444
595
  * message #connection_id
445
- * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L471)
596
+ * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L636)
446
597
  * without necessary capabilities to join presence
447
- * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L495)
598
+ * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L660)
448
599
  * it should behave like a public presence method
449
600
  * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
450
601
  * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
451
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L56)
452
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L63)
453
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L73)
602
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
603
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
604
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
605
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
606
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
607
+ * when :queue_messages client option is false
608
+ * and connection state initialized
609
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
610
+ * and connection state connecting
611
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
612
+ * and connection state disconnected
613
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
614
+ * and connection state connected
615
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
616
+ * with supported data payload content type
617
+ * JSON Object (Hash)
618
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
619
+ * JSON Array
620
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
621
+ * String
622
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
623
+ * Binary
624
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
625
+ * with unsupported data payload content type
626
+ * Integer
627
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
628
+ * Float
629
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
630
+ * Boolean
631
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
632
+ * False
633
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
454
634
  * if connection fails before success
455
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L94)
635
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
456
636
  * #update
457
- * [without previous #enter automatically enters](./spec/acceptance/realtime/presence_spec.rb#L507)
458
- * [updates the data if :data argument provided](./spec/acceptance/realtime/presence_spec.rb#L532)
459
- * [updates the data to nil if :data argument is not provided (assumes nil value)](./spec/acceptance/realtime/presence_spec.rb#L542)
637
+ * [without previous #enter automatically enters](./spec/acceptance/realtime/presence_spec.rb#L672)
638
+ * [updates the data if :data argument provided](./spec/acceptance/realtime/presence_spec.rb#L697)
639
+ * [updates the data to nil if :data argument is not provided (assumes nil value)](./spec/acceptance/realtime/presence_spec.rb#L707)
460
640
  * when ENTERED
461
- * [has no effect on the state](./spec/acceptance/realtime/presence_spec.rb#L517)
641
+ * [has no effect on the state](./spec/acceptance/realtime/presence_spec.rb#L682)
462
642
  * it should behave like a public presence method
463
643
  * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
464
644
  * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
465
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L56)
466
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L63)
467
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L73)
645
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
646
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
647
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
648
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
649
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
650
+ * when :queue_messages client option is false
651
+ * and connection state initialized
652
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
653
+ * and connection state connecting
654
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
655
+ * and connection state disconnected
656
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
657
+ * and connection state connected
658
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
659
+ * with supported data payload content type
660
+ * JSON Object (Hash)
661
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
662
+ * JSON Array
663
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
664
+ * String
665
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
666
+ * Binary
667
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
668
+ * with unsupported data payload content type
669
+ * Integer
670
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
671
+ * Float
672
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
673
+ * Boolean
674
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
675
+ * False
676
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
468
677
  * if connection fails before success
469
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L94)
678
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
470
679
  * #leave
471
- * [raises an exception if not entered](./spec/acceptance/realtime/presence_spec.rb#L600)
680
+ * [raises an exception if not entered](./spec/acceptance/realtime/presence_spec.rb#L781)
472
681
  * :data option
473
682
  * when set to a string
474
- * [emits the new data for the leave event](./spec/acceptance/realtime/presence_spec.rb#L561)
683
+ * [emits the new data for the leave event](./spec/acceptance/realtime/presence_spec.rb#L726)
475
684
  * when set to nil
476
- * [emits a nil value for the data attribute when leaving](./spec/acceptance/realtime/presence_spec.rb#L574)
685
+ * [emits a nil value for the data attribute when leaving](./spec/acceptance/realtime/presence_spec.rb#L739)
477
686
  * when not passed as an argument
478
- * [emits the previously defined value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L587)
687
+ * [emits the previously defined value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L752)
688
+ * and sync is complete
689
+ * [does not cache members that have left](./spec/acceptance/realtime/presence_spec.rb#L765)
479
690
  * it should behave like a public presence method
480
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L56)
481
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L63)
482
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L73)
691
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
692
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
693
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
694
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
695
+ * with supported data payload content type
696
+ * JSON Object (Hash)
697
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
698
+ * JSON Array
699
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
700
+ * String
701
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
702
+ * Binary
703
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
704
+ * with unsupported data payload content type
705
+ * Integer
706
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
707
+ * Float
708
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
709
+ * Boolean
710
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
711
+ * False
712
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
483
713
  * if connection fails before success
484
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L94)
714
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
485
715
  * :left event
486
- * [emits the data defined in enter](./spec/acceptance/realtime/presence_spec.rb#L609)
487
- * [emits the data defined in update](./spec/acceptance/realtime/presence_spec.rb#L620)
716
+ * [emits the data defined in enter](./spec/acceptance/realtime/presence_spec.rb#L790)
717
+ * [emits the data defined in update](./spec/acceptance/realtime/presence_spec.rb#L801)
488
718
  * entering/updating/leaving presence state on behalf of another client_id
489
719
  * #enter_client
490
720
  * multiple times on the same channel with different client_ids
491
- * [has no affect on the client's presence state and only enters on behalf of the provided client_id](./spec/acceptance/realtime/presence_spec.rb#L641)
492
- * [enters a channel and sets the data based on the provided :data option](./spec/acceptance/realtime/presence_spec.rb#L655)
721
+ * [has no affect on the client's presence state and only enters on behalf of the provided client_id](./spec/acceptance/realtime/presence_spec.rb#L822)
722
+ * [enters a channel and sets the data based on the provided :data option](./spec/acceptance/realtime/presence_spec.rb#L836)
493
723
  * message #connection_id
494
- * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L674)
724
+ * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L855)
495
725
  * it should behave like a public presence method
496
726
  * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
497
727
  * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
498
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L56)
499
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L63)
500
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L73)
728
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
729
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
730
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
731
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
732
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
733
+ * when :queue_messages client option is false
734
+ * and connection state initialized
735
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
736
+ * and connection state connecting
737
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
738
+ * and connection state disconnected
739
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
740
+ * and connection state connected
741
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
742
+ * with supported data payload content type
743
+ * JSON Object (Hash)
744
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
745
+ * JSON Array
746
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
747
+ * String
748
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
749
+ * Binary
750
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
751
+ * with unsupported data payload content type
752
+ * Integer
753
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
754
+ * Float
755
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
756
+ * Boolean
757
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
758
+ * False
759
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
501
760
  * if connection fails before success
502
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L94)
761
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
503
762
  * without necessary capabilities to enter on behalf of another client
504
- * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L696)
763
+ * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L877)
505
764
  * #update_client
506
765
  * multiple times on the same channel with different client_ids
507
- * [updates the data attribute for the member when :data option provided](./spec/acceptance/realtime/presence_spec.rb#L707)
508
- * [updates the data attribute to null for the member when :data option is not provided (assumed null)](./spec/acceptance/realtime/presence_spec.rb#L731)
509
- * [enters if not already entered](./spec/acceptance/realtime/presence_spec.rb#L743)
766
+ * [updates the data attribute for the member when :data option provided](./spec/acceptance/realtime/presence_spec.rb#L888)
767
+ * [updates the data attribute to null for the member when :data option is not provided (assumed null)](./spec/acceptance/realtime/presence_spec.rb#L912)
768
+ * [enters if not already entered](./spec/acceptance/realtime/presence_spec.rb#L924)
510
769
  * it should behave like a public presence method
511
770
  * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
512
771
  * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
513
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L56)
514
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L63)
515
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L73)
772
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
773
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
774
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
775
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
776
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
777
+ * when :queue_messages client option is false
778
+ * and connection state initialized
779
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
780
+ * and connection state connecting
781
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
782
+ * and connection state disconnected
783
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
784
+ * and connection state connected
785
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
786
+ * with supported data payload content type
787
+ * JSON Object (Hash)
788
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
789
+ * JSON Array
790
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
791
+ * String
792
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
793
+ * Binary
794
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
795
+ * with unsupported data payload content type
796
+ * Integer
797
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
798
+ * Float
799
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
800
+ * Boolean
801
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
802
+ * False
803
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
516
804
  * if connection fails before success
517
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L94)
805
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
518
806
  * #leave_client
519
807
  * leaves a channel
520
808
  * multiple times on the same channel with different client_ids
521
- * [emits the :leave event for each client_id](./spec/acceptance/realtime/presence_spec.rb#L772)
522
- * [succeeds if that client_id has not previously entered the channel](./spec/acceptance/realtime/presence_spec.rb#L796)
809
+ * [emits the :leave event for each client_id](./spec/acceptance/realtime/presence_spec.rb#L953)
810
+ * [succeeds if that client_id has not previously entered the channel](./spec/acceptance/realtime/presence_spec.rb#L977)
523
811
  * with a new value in :data option
524
- * [emits the leave event with the new data value](./spec/acceptance/realtime/presence_spec.rb#L820)
812
+ * [emits the leave event with the new data value](./spec/acceptance/realtime/presence_spec.rb#L1001)
525
813
  * with a nil value in :data option
526
- * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L833)
814
+ * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L1014)
527
815
  * with no :data option
528
- * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L846)
816
+ * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L1027)
529
817
  * it should behave like a public presence method
530
818
  * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
531
819
  * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
532
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L56)
533
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L63)
534
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L73)
820
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
821
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
822
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
823
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
824
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
825
+ * when :queue_messages client option is false
826
+ * and connection state initialized
827
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
828
+ * and connection state connecting
829
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
830
+ * and connection state disconnected
831
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
832
+ * and connection state connected
833
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
834
+ * with supported data payload content type
835
+ * JSON Object (Hash)
836
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
837
+ * JSON Array
838
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
839
+ * String
840
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
841
+ * Binary
842
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
843
+ * with unsupported data payload content type
844
+ * Integer
845
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
846
+ * Float
847
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
848
+ * Boolean
849
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
850
+ * False
851
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
535
852
  * if connection fails before success
536
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L94)
853
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
537
854
  * #get
538
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L864)
539
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L869)
540
- * [catches exceptions in the provided method block](./spec/acceptance/realtime/presence_spec.rb#L876)
541
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L884)
542
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L884)
543
- * [returns the current members on the channel](./spec/acceptance/realtime/presence_spec.rb#L959)
544
- * [filters by connection_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L974)
545
- * [filters by client_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L996)
546
- * [does not wait for SYNC to complete if :wait_for_sync option is false](./spec/acceptance/realtime/presence_spec.rb#L1020)
855
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L1045)
856
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L1050)
857
+ * [catches exceptions in the provided method block](./spec/acceptance/realtime/presence_spec.rb#L1057)
858
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L1065)
859
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L1065)
860
+ * [returns the current members on the channel](./spec/acceptance/realtime/presence_spec.rb#L1142)
861
+ * [filters by connection_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L1157)
862
+ * [filters by client_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L1179)
863
+ * [does not wait for SYNC to complete if :wait_for_sync option is false](./spec/acceptance/realtime/presence_spec.rb#L1203)
547
864
  * during a sync
548
- * [fails if the connection fails](./spec/acceptance/realtime/presence_spec.rb#L914)
549
- * [fails if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L934)
865
+ * when :wait_for_sync is true
866
+ * [fails if the connection fails](./spec/acceptance/realtime/presence_spec.rb#L1096)
867
+ * [fails if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L1116)
550
868
  * when a member enters and then leaves
551
- * [has no members](./spec/acceptance/realtime/presence_spec.rb#L1030)
869
+ * [has no members](./spec/acceptance/realtime/presence_spec.rb#L1213)
552
870
  * with lots of members on different clients
553
- * [returns a complete list of members on all clients](./spec/acceptance/realtime/presence_spec.rb#L1047)
871
+ * [returns a complete list of members on all clients](./spec/acceptance/realtime/presence_spec.rb#L1230)
554
872
  * #subscribe
873
+ * [implicitly attaches](./spec/acceptance/realtime/presence_spec.rb#L1305)
555
874
  * with no arguments
556
- * [calls the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1083)
875
+ * [calls the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1266)
876
+ * with event name
877
+ * [calls the callback for specified presence event](./spec/acceptance/realtime/presence_spec.rb#L1286)
557
878
  * #unsubscribe
558
879
  * with no arguments
559
- * [removes the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1105)
880
+ * [removes the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1318)
881
+ * with event name
882
+ * [removes the callback for specified presence event](./spec/acceptance/realtime/presence_spec.rb#L1336)
560
883
  * REST #get
561
- * [returns current members](./spec/acceptance/realtime/presence_spec.rb#L1124)
562
- * [returns no members once left](./spec/acceptance/realtime/presence_spec.rb#L1137)
884
+ * [returns current members](./spec/acceptance/realtime/presence_spec.rb#L1355)
885
+ * [returns no members once left](./spec/acceptance/realtime/presence_spec.rb#L1368)
563
886
  * client_id with ASCII_8BIT
564
887
  * in connection set up
565
- * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1154)
888
+ * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1385)
566
889
  * in channel options
567
- * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1167)
890
+ * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1398)
568
891
  * encoding and decoding of presence message data
569
- * [encrypts presence message data](./spec/acceptance/realtime/presence_spec.rb#L1191)
892
+ * [encrypts presence message data](./spec/acceptance/realtime/presence_spec.rb#L1422)
570
893
  * #subscribe
571
- * [emits decrypted enter events](./spec/acceptance/realtime/presence_spec.rb#L1210)
572
- * [emits decrypted update events](./spec/acceptance/realtime/presence_spec.rb#L1222)
573
- * [emits previously set data for leave events](./spec/acceptance/realtime/presence_spec.rb#L1236)
894
+ * [emits decrypted enter events](./spec/acceptance/realtime/presence_spec.rb#L1441)
895
+ * [emits decrypted update events](./spec/acceptance/realtime/presence_spec.rb#L1453)
896
+ * [emits previously set data for leave events](./spec/acceptance/realtime/presence_spec.rb#L1467)
574
897
  * #get
575
- * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1252)
898
+ * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1483)
576
899
  * REST #get
577
- * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1265)
900
+ * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1496)
578
901
  * when cipher settings do not match publisher
579
- * [delivers an unencoded presence message left with encoding value](./spec/acceptance/realtime/presence_spec.rb#L1280)
580
- * [emits an error when cipher does not match and presence data cannot be decoded](./spec/acceptance/realtime/presence_spec.rb#L1293)
902
+ * [delivers an unencoded presence message left with encoding value](./spec/acceptance/realtime/presence_spec.rb#L1511)
903
+ * [emits an error when cipher does not match and presence data cannot be decoded](./spec/acceptance/realtime/presence_spec.rb#L1524)
581
904
  * leaving
582
- * [expect :left event once underlying connection is closed](./spec/acceptance/realtime/presence_spec.rb#L1310)
583
- * [expect :left event with client data from enter event](./spec/acceptance/realtime/presence_spec.rb#L1320)
905
+ * [expect :left event once underlying connection is closed](./spec/acceptance/realtime/presence_spec.rb#L1541)
906
+ * [expect :left event with client data from enter event](./spec/acceptance/realtime/presence_spec.rb#L1551)
584
907
  * connection failure mid-way through a large member sync
585
- * [resumes the SYNC operation](./spec/acceptance/realtime/presence_spec.rb#L1338)
908
+ * [resumes the SYNC operation](./spec/acceptance/realtime/presence_spec.rb#L1569)
586
909
 
587
910
  ### Ably::Realtime::Client#stats
588
911
  _(see [spec/acceptance/realtime/stats_spec.rb](./spec/acceptance/realtime/stats_spec.rb))_
589
912
  * using JSON and MsgPack protocol
590
913
  * fetching stats
591
- * [should return a PaginatedResource](./spec/acceptance/realtime/stats_spec.rb#L10)
592
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/stats_spec.rb#L17)
914
+ * [returns a PaginatedResult](./spec/acceptance/realtime/stats_spec.rb#L10)
915
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/stats_spec.rb#L29)
916
+ * with options
917
+ * [passes the option arguments to the REST stat method](./spec/acceptance/realtime/stats_spec.rb#L20)
593
918
 
594
919
  ### Ably::Realtime::Client#time
595
920
  _(see [spec/acceptance/realtime/time_spec.rb](./spec/acceptance/realtime/time_spec.rb))_
@@ -601,120 +926,132 @@ _(see [spec/acceptance/realtime/time_spec.rb](./spec/acceptance/realtime/time_sp
601
926
  ### Ably::Auth
602
927
  _(see [spec/acceptance/rest/auth_spec.rb](./spec/acceptance/rest/auth_spec.rb))_
603
928
  * using JSON and MsgPack protocol
604
- * [has immutable options](./spec/acceptance/rest/auth_spec.rb#L54)
929
+ * [has immutable options](./spec/acceptance/rest/auth_spec.rb#L60)
605
930
  * #request_token
606
- * [returns a valid requested token in the expected format with valid issued and expires attributes](./spec/acceptance/rest/auth_spec.rb#L69)
607
- * with option :client_id
608
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
609
- * with option :capability
610
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
611
- * with option :nonce
612
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
613
- * with option :timestamp
614
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
615
- * with option :ttl
616
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
931
+ * [creates a TokenRequest automatically and sends it to Ably to obtain a token](./spec/acceptance/rest/auth_spec.rb#L75)
932
+ * [returns a valid TokenDetails object in the expected format with valid issued and expires attributes](./spec/acceptance/rest/auth_spec.rb#L84)
933
+ * with token_param :client_id
934
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L117)
935
+ * with token_param :capability
936
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L117)
937
+ * with token_param :nonce
938
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L117)
939
+ * with token_param :timestamp
940
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L117)
941
+ * with token_param :ttl
942
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L117)
617
943
  * with :key option
618
- * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L130)
944
+ * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L147)
619
945
  * with :key_name & :key_secret options
620
- * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L159)
946
+ * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L177)
621
947
  * with :query_time option
622
- * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L167)
948
+ * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L185)
623
949
  * without :query_time option
624
- * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L176)
950
+ * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L194)
625
951
  * with :auth_url option
626
952
  * when response from :auth_url is a valid token request
627
- * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L224)
628
- * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L229)
953
+ * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L242)
954
+ * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L247)
629
955
  * with :query_params
630
- * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L236)
956
+ * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L254)
631
957
  * with :headers
632
- * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L244)
958
+ * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L262)
633
959
  * with POST
634
- * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L252)
960
+ * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L270)
635
961
  * when response from :auth_url is a token details object
636
- * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L277)
962
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L295)
637
963
  * when response from :auth_url is text/plain content type and a token string
638
- * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L294)
964
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L313)
639
965
  * when response is invalid
640
966
  * 500
641
- * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L307)
967
+ * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L327)
642
968
  * XML
643
- * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L318)
969
+ * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L338)
644
970
  * with a Proc for the :auth_callback option
645
971
  * that returns a TokenRequest
646
- * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L337)
647
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L342)
972
+ * [calls the Proc with token_params when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L361)
973
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L365)
648
974
  * that returns a TokenDetails JSON object
649
- * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L371)
650
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L376)
975
+ * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L394)
976
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L399)
651
977
  * that returns a TokenDetails object
652
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L397)
978
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L420)
653
979
  * that returns a Token string
654
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L413)
655
- * with client_id
656
- * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L445)
980
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L436)
981
+ * with auth_option :client_id
982
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L467)
983
+ * with token_param :client_id
984
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L476)
657
985
  * before #authorise has been called
658
- * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L452)
986
+ * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L483)
659
987
  * #authorise
660
- * [updates the persisted auth options that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L499)
988
+ * [updates the persisted auth options that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L533)
661
989
  * when called for the first time since the client has been instantiated
662
- * [passes all options to #request_token](./spec/acceptance/rest/auth_spec.rb#L463)
663
- * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L468)
664
- * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L472)
990
+ * [passes all auth_options and token_params to #request_token](./spec/acceptance/rest/auth_spec.rb#L497)
991
+ * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L502)
992
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L506)
665
993
  * with previous authorisation
666
- * [does not request a token if current_token_details has not expired](./spec/acceptance/rest/auth_spec.rb#L483)
667
- * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L488)
668
- * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L494)
994
+ * [does not request a token if current_token_details has not expired](./spec/acceptance/rest/auth_spec.rb#L517)
995
+ * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L522)
996
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L528)
669
997
  * with a Proc for the :auth_callback option
670
- * [calls the Proc](./spec/acceptance/rest/auth_spec.rb#L515)
671
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L519)
998
+ * [calls the Proc](./spec/acceptance/rest/auth_spec.rb#L549)
999
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L553)
672
1000
  * for every subsequent #request_token
673
1001
  * without a :auth_callback Proc
674
- * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L525)
1002
+ * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L559)
675
1003
  * with a provided block
676
- * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L532)
1004
+ * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L566)
677
1005
  * #create_token_request
678
- * [uses the key name from the client](./spec/acceptance/rest/auth_spec.rb#L548)
679
- * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L552)
680
- * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L556)
1006
+ * [returns a TokenRequest object](./spec/acceptance/rest/auth_spec.rb#L583)
1007
+ * [returns a TokenRequest that can be passed to a client that can use it for authentication without an API key](./spec/acceptance/rest/auth_spec.rb#L587)
1008
+ * [uses the key name from the client](./spec/acceptance/rest/auth_spec.rb#L594)
1009
+ * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L598)
1010
+ * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L611)
1011
+ * with a :ttl option below the Token expiry buffer that ensures tokens are renewed 15s before they expire as they are considered expired
1012
+ * [uses the Token expiry buffer default + 10s to allow for a token request in flight](./spec/acceptance/rest/auth_spec.rb#L605)
681
1013
  * the nonce
682
- * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L561)
683
- * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L566)
684
- * with option :ttl
685
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L577)
686
- * with option :nonce
687
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L577)
688
- * with option :client_id
689
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L577)
1014
+ * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L616)
1015
+ * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L621)
1016
+ * with token param :ttl
1017
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L632)
1018
+ * with token param :nonce
1019
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L632)
1020
+ * with token param :client_id
1021
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L632)
1022
+ * when specifying capability
1023
+ * [overrides the default](./spec/acceptance/rest/auth_spec.rb#L643)
1024
+ * [uses these capabilities when Ably issues an actual token](./spec/acceptance/rest/auth_spec.rb#L647)
690
1025
  * with additional invalid attributes
691
- * [are ignored](./spec/acceptance/rest/auth_spec.rb#L585)
1026
+ * [are ignored](./spec/acceptance/rest/auth_spec.rb#L657)
692
1027
  * when required fields are missing
693
- * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L596)
694
- * [should raise an exception if key name is missing](./spec/acceptance/rest/auth_spec.rb#L600)
695
- * with :query_time option
696
- * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L609)
697
- * with :timestamp option
698
- * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L619)
1028
+ * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L668)
1029
+ * [should raise an exception if key name is missing](./spec/acceptance/rest/auth_spec.rb#L672)
1030
+ * timestamp attribute
1031
+ * [is a Time object in Ruby and is set to the local time](./spec/acceptance/rest/auth_spec.rb#L699)
1032
+ * with :query_time auth_option
1033
+ * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L684)
1034
+ * with :timestamp option
1035
+ * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L694)
699
1036
  * signing
700
- * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L641)
1037
+ * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L723)
701
1038
  * using token authentication
702
1039
  * with :token option
703
- * [authenticates successfully using the provided :token](./spec/acceptance/rest/auth_spec.rb#L664)
704
- * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L668)
705
- * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L676)
706
- * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L684)
1040
+ * [authenticates successfully using the provided :token](./spec/acceptance/rest/auth_spec.rb#L746)
1041
+ * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L750)
1042
+ * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L758)
1043
+ * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L766)
707
1044
  * when implicit as a result of using :client id
708
1045
  * and requests to the Ably server are mocked
709
- * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L712)
1046
+ * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L794)
710
1047
  * a token is created
711
- * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L721)
712
- * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L725)
713
- * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L729)
1048
+ * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L803)
1049
+ * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L807)
1050
+ * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L811)
714
1051
  * when using an :key and basic auth
715
- * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L744)
716
- * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L748)
717
- * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L752)
1052
+ * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L826)
1053
+ * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L830)
1054
+ * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L834)
718
1055
 
719
1056
  ### Ably::Rest
720
1057
  _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
@@ -741,31 +1078,55 @@ _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
741
1078
  * when auth#token_renewable?
742
1079
  * [should automatically reissue a token](./spec/acceptance/rest/base_spec.rb#L143)
743
1080
  * when NOT auth#token_renewable?
744
- * [should raise an InvalidToken exception](./spec/acceptance/rest/base_spec.rb#L158)
1081
+ * [should raise an TokenExpired exception](./spec/acceptance/rest/base_spec.rb#L158)
745
1082
 
746
1083
  ### Ably::Rest::Channel
747
1084
  _(see [spec/acceptance/rest/channel_spec.rb](./spec/acceptance/rest/channel_spec.rb))_
748
1085
  * using JSON and MsgPack protocol
749
1086
  * #publish
750
- * [should publish the message and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L17)
1087
+ * with name and data arguments
1088
+ * [publishes the message and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L20)
1089
+ * with an array of Hash objects with :name and :data attributes
1090
+ * [publishes an array of messages in one HTTP request](./spec/acceptance/rest/channel_spec.rb#L34)
1091
+ * with an array of Message objects
1092
+ * [publishes an array of messages in one HTTP request](./spec/acceptance/rest/channel_spec.rb#L49)
1093
+ * without adequate permissions on the channel
1094
+ * [raises a permission error when publishing](./spec/acceptance/rest/channel_spec.rb#L61)
1095
+ * null attributes
1096
+ * when name is null
1097
+ * [publishes the message without a name attribute in the payload](./spec/acceptance/rest/channel_spec.rb#L70)
1098
+ * when data is null
1099
+ * [publishes the message without a data attribute in the payload](./spec/acceptance/rest/channel_spec.rb#L81)
1100
+ * with neither name or data attributes
1101
+ * [publishes the message without any attributes in the payload](./spec/acceptance/rest/channel_spec.rb#L92)
751
1102
  * #history
752
- * [should return the current message history for the channel](./spec/acceptance/rest/channel_spec.rb#L39)
753
- * [should return paged history using the PaginatedResource model](./spec/acceptance/rest/channel_spec.rb#L67)
1103
+ * [returns a PaginatedResult model](./spec/acceptance/rest/channel_spec.rb#L119)
1104
+ * [returns the current message history for the channel](./spec/acceptance/rest/channel_spec.rb#L123)
1105
+ * [returns paged history using the PaginatedResult model](./spec/acceptance/rest/channel_spec.rb#L151)
754
1106
  * message timestamps
755
- * [should all be after the messages were published](./spec/acceptance/rest/channel_spec.rb#L52)
1107
+ * [are after the messages were published](./spec/acceptance/rest/channel_spec.rb#L136)
756
1108
  * message IDs
757
- * [should be unique](./spec/acceptance/rest/channel_spec.rb#L60)
1109
+ * [is unique](./spec/acceptance/rest/channel_spec.rb#L144)
1110
+ * direction
1111
+ * [returns paged history backwards by default](./spec/acceptance/rest/channel_spec.rb#L172)
1112
+ * [returns history forward if specified in the options](./spec/acceptance/rest/channel_spec.rb#L178)
1113
+ * limit
1114
+ * [defaults to 100](./spec/acceptance/rest/channel_spec.rb#L190)
758
1115
  * #history option
759
1116
  * :start
760
1117
  * with milliseconds since epoch value
761
- * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L123)
1118
+ * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L233)
762
1119
  * with a Time object value
763
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L133)
1120
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L243)
764
1121
  * :end
765
1122
  * with milliseconds since epoch value
766
- * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L123)
1123
+ * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L233)
767
1124
  * with a Time object value
768
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L133)
1125
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L243)
1126
+ * when argument start is after end
1127
+ * [should raise an exception](./spec/acceptance/rest/channel_spec.rb#L253)
1128
+ * #presence
1129
+ * [returns a REST Presence object](./spec/acceptance/rest/channel_spec.rb#L263)
769
1130
 
770
1131
  ### Ably::Rest::Channels
771
1132
  _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_spec.rb))_
@@ -778,6 +1139,10 @@ _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_sp
778
1139
  * behaves like a channel
779
1140
  * [returns a channel object](./spec/acceptance/rest/channels_spec.rb#L6)
780
1141
  * [returns channel object and passes the provided options](./spec/acceptance/rest/channels_spec.rb#L11)
1142
+ * accessing an existing channel object with different options
1143
+ * [overrides the existing channel options and returns the channel object](./spec/acceptance/rest/channels_spec.rb#L39)
1144
+ * accessing an existing channel object without specifying any channel options
1145
+ * [returns the existing channel without modifying the channel options](./spec/acceptance/rest/channels_spec.rb#L50)
781
1146
  * using undocumented array accessor [] method on client#channels
782
1147
  * behaves like a channel
783
1148
  * [returns a channel object](./spec/acceptance/rest/channels_spec.rb#L6)
@@ -787,43 +1152,69 @@ _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_sp
787
1152
  _(see [spec/acceptance/rest/client_spec.rb](./spec/acceptance/rest/client_spec.rb))_
788
1153
  * using JSON and MsgPack protocol
789
1154
  * #initialize
790
- * with a :auth_callback Proc
791
- * [calls the auth Proc to get a new token](./spec/acceptance/rest/client_spec.rb#L20)
1155
+ * with only an API key
1156
+ * [uses basic authentication](./spec/acceptance/rest/client_spec.rb#L24)
1157
+ * with an explicit string :token
1158
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L32)
1159
+ * with :use_token_auth set to true
1160
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L40)
1161
+ * with a :client_id configured
1162
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L48)
1163
+ * with an :auth_callback Proc
1164
+ * [calls the auth Proc to get a new token](./spec/acceptance/rest/client_spec.rb#L56)
1165
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L61)
792
1166
  * with an auth URL
793
- * [sends an HTTP request to the provided URL to get a new token](./spec/acceptance/rest/client_spec.rb#L34)
1167
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L70)
1168
+ * before any REST request
1169
+ * [sends an HTTP request to the provided auth URL to get a new token](./spec/acceptance/rest/client_spec.rb#L81)
1170
+ * auth headers
1171
+ * with basic auth
1172
+ * [sends the API key in authentication part of the secure URL (the Authorization: Basic header is not used with the Faraday HTTP library by default)](./spec/acceptance/rest/client_spec.rb#L101)
1173
+ * with token auth
1174
+ * without specifying protocol
1175
+ * [sends the token string over HTTPS in the Authorization Bearer header with Base64 encoding](./spec/acceptance/rest/client_spec.rb#L120)
1176
+ * when setting constructor ClientOption :tls to false
1177
+ * [sends the token string over HTTP in the Authorization Bearer header with Base64 encoding](./spec/acceptance/rest/client_spec.rb#L130)
794
1178
  * using tokens
795
1179
  * when expired
796
- * [creates a new token automatically when the old token expires](./spec/acceptance/rest/client_spec.rb#L58)
1180
+ * [creates a new token automatically when the old token expires](./spec/acceptance/rest/client_spec.rb#L161)
797
1181
  * when token has not expired
798
- * [reuses the existing token for every request](./spec/acceptance/rest/client_spec.rb#L72)
1182
+ * [reuses the existing token for every request](./spec/acceptance/rest/client_spec.rb#L175)
799
1183
  * connection transport
800
1184
  * for default host
801
- * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L88)
802
- * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L92)
1185
+ * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L191)
1186
+ * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L195)
803
1187
  * for the fallback hosts
804
- * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L98)
805
- * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L102)
1188
+ * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L201)
1189
+ * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L205)
806
1190
  * fallback hosts
807
1191
  * configured
808
- * [should make connection attempts to A.ably-realtime.com, B.ably-realtime.com, C.ably-realtime.com, D.ably-realtime.com, E.ably-realtime.com](./spec/acceptance/rest/client_spec.rb#L115)
1192
+ * [should make connection attempts to A.ably-realtime.com, B.ably-realtime.com, C.ably-realtime.com, D.ably-realtime.com, E.ably-realtime.com](./spec/acceptance/rest/client_spec.rb#L218)
809
1193
  * when environment is NOT production
810
- * [does not retry failed requests with fallback hosts when there is a connection error](./spec/acceptance/rest/client_spec.rb#L132)
1194
+ * [does not retry failed requests with fallback hosts when there is a connection error](./spec/acceptance/rest/client_spec.rb#L235)
811
1195
  * when environment is production
812
1196
  * and connection times out
813
- * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L172)
1197
+ * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L272)
814
1198
  * and the total request time exeeds 10 seconds
815
- * [makes no further attempts to any fallback hosts](./spec/acceptance/rest/client_spec.rb#L187)
1199
+ * [makes no further attempts to any fallback hosts](./spec/acceptance/rest/client_spec.rb#L287)
816
1200
  * and connection fails
817
- * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L203)
1201
+ * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L303)
1202
+ * and basic authentication fails
1203
+ * [does not attempt the fallback hosts as this is an authentication failure](./spec/acceptance/rest/client_spec.rb#L327)
1204
+ * and server returns a 50x error
1205
+ * [attempts the fallback hosts as this is an authentication failure](./spec/acceptance/rest/client_spec.rb#L349)
818
1206
  * with a custom host
819
1207
  * that does not exist
820
- * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L219)
1208
+ * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L365)
821
1209
  * fallback hosts
822
- * [are never used](./spec/acceptance/rest/client_spec.rb#L240)
1210
+ * [are never used](./spec/acceptance/rest/client_spec.rb#L386)
823
1211
  * that times out
824
- * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L255)
1212
+ * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L401)
825
1213
  * fallback hosts
826
- * [are never used](./spec/acceptance/rest/client_spec.rb#L268)
1214
+ * [are never used](./spec/acceptance/rest/client_spec.rb#L414)
1215
+ * #auth
1216
+ * [is provides access to the Auth object](./spec/acceptance/rest/client_spec.rb#L428)
1217
+ * [configures the Auth object with all ClientOptions passed to client in the initializer](./spec/acceptance/rest/client_spec.rb#L432)
827
1218
 
828
1219
  ### Ably::Models::MessageEncoders
829
1220
  _(see [spec/acceptance/rest/encoders_spec.rb](./spec/acceptance/rest/encoders_spec.rb))_
@@ -863,59 +1254,77 @@ _(see [spec/acceptance/rest/message_spec.rb](./spec/acceptance/rest/message_spec
863
1254
  * using JSON and MsgPack protocol
864
1255
  * publishing with an ASCII_8BIT message name
865
1256
  * [is converted into UTF_8](./spec/acceptance/rest/message_spec.rb#L18)
1257
+ * with supported data payload content type
1258
+ * JSON Object (Hash)
1259
+ * [is encoded and decoded to the same hash](./spec/acceptance/rest/message_spec.rb#L30)
1260
+ * JSON Array
1261
+ * [is encoded and decoded to the same Array](./spec/acceptance/rest/message_spec.rb#L39)
1262
+ * String
1263
+ * [is encoded and decoded to the same Array](./spec/acceptance/rest/message_spec.rb#L48)
1264
+ * Binary
1265
+ * [is encoded and decoded to the same Array](./spec/acceptance/rest/message_spec.rb#L57)
1266
+ * with unsupported data payload content type
1267
+ * Integer
1268
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/rest/message_spec.rb#L68)
1269
+ * Float
1270
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/rest/message_spec.rb#L76)
1271
+ * Boolean
1272
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/rest/message_spec.rb#L84)
1273
+ * False
1274
+ * [is raises an UnsupportedDataType 40011 exception](./spec/acceptance/rest/message_spec.rb#L92)
866
1275
  * encryption and encoding
867
1276
  * with #publish and #history
868
1277
  * with AES-128-CBC using crypto-data-128.json fixtures
869
1278
  * item 0 with encrypted encoding utf-8/cipher+aes-128-cbc/base64
870
1279
  * behaves like an Ably encrypter and decrypter
871
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
872
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1280
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1281
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
873
1282
  * item 1 with encrypted encoding cipher+aes-128-cbc/base64
874
1283
  * behaves like an Ably encrypter and decrypter
875
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
876
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1284
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1285
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
877
1286
  * item 2 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
878
1287
  * behaves like an Ably encrypter and decrypter
879
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
880
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1288
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1289
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
881
1290
  * item 3 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
882
1291
  * behaves like an Ably encrypter and decrypter
883
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
884
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1292
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1293
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
885
1294
  * with AES-256-CBC using crypto-data-256.json fixtures
886
1295
  * item 0 with encrypted encoding utf-8/cipher+aes-256-cbc/base64
887
1296
  * behaves like an Ably encrypter and decrypter
888
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
889
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1297
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1298
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
890
1299
  * item 1 with encrypted encoding cipher+aes-256-cbc/base64
891
1300
  * behaves like an Ably encrypter and decrypter
892
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
893
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1301
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1302
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
894
1303
  * item 2 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
895
1304
  * behaves like an Ably encrypter and decrypter
896
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
897
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1305
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1306
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
898
1307
  * item 3 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
899
1308
  * behaves like an Ably encrypter and decrypter
900
- * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L65)
901
- * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L80)
1309
+ * [encrypts message automatically when published](./spec/acceptance/rest/message_spec.rb#L137)
1310
+ * [sends and retrieves messages that are encrypted & decrypted by the Ably library](./spec/acceptance/rest/message_spec.rb#L152)
902
1311
  * when publishing lots of messages
903
- * [encrypts on #publish and decrypts on #history](./spec/acceptance/rest/message_spec.rb#L113)
1312
+ * [encrypts on #publish and decrypts on #history](./spec/acceptance/rest/message_spec.rb#L185)
904
1313
  * when retrieving #history with a different protocol
905
- * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/rest/message_spec.rb#L140)
906
- * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/rest/message_spec.rb#L140)
907
- * [delivers a Hash payload to the receiver](./spec/acceptance/rest/message_spec.rb#L140)
1314
+ * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/rest/message_spec.rb#L212)
1315
+ * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/rest/message_spec.rb#L212)
1316
+ * [delivers a Hash payload to the receiver](./spec/acceptance/rest/message_spec.rb#L212)
908
1317
  * when publishing on an unencrypted channel and retrieving with #history on an encrypted channel
909
- * [does not attempt to decrypt the message](./spec/acceptance/rest/message_spec.rb#L156)
1318
+ * [does not attempt to decrypt the message](./spec/acceptance/rest/message_spec.rb#L228)
910
1319
  * when publishing on an encrypted channel and retrieving with #history on an unencrypted channel
911
- * [retrieves the message that remains encrypted with an encrypted encoding attribute](./spec/acceptance/rest/message_spec.rb#L177)
912
- * [logs a Cipher exception](./spec/acceptance/rest/message_spec.rb#L183)
1320
+ * [retrieves the message that remains encrypted with an encrypted encoding attribute](./spec/acceptance/rest/message_spec.rb#L249)
1321
+ * [logs a Cipher exception](./spec/acceptance/rest/message_spec.rb#L255)
913
1322
  * publishing on an encrypted channel and retrieving #history with a different algorithm on another client
914
- * [retrieves the message that remains encrypted with an encrypted encoding attribute](./spec/acceptance/rest/message_spec.rb#L204)
915
- * [logs a Cipher exception](./spec/acceptance/rest/message_spec.rb#L210)
1323
+ * [retrieves the message that remains encrypted with an encrypted encoding attribute](./spec/acceptance/rest/message_spec.rb#L276)
1324
+ * [logs a Cipher exception](./spec/acceptance/rest/message_spec.rb#L282)
916
1325
  * publishing on an encrypted channel and subscribing with a different key on another client
917
- * [retrieves the message that remains encrypted with an encrypted encoding attribute](./spec/acceptance/rest/message_spec.rb#L231)
918
- * [logs a Cipher exception](./spec/acceptance/rest/message_spec.rb#L237)
1326
+ * [retrieves the message that remains encrypted with an encrypted encoding attribute](./spec/acceptance/rest/message_spec.rb#L303)
1327
+ * [logs a Cipher exception](./spec/acceptance/rest/message_spec.rb#L309)
919
1328
 
920
1329
  ### Ably::Rest::Presence
921
1330
  _(see [spec/acceptance/rest/presence_spec.rb](./spec/acceptance/rest/presence_spec.rb))_
@@ -924,78 +1333,105 @@ _(see [spec/acceptance/rest/presence_spec.rb](./spec/acceptance/rest/presence_sp
924
1333
  * #get
925
1334
  * [returns current members on the channel with their action set to :present](./spec/acceptance/rest/presence_spec.rb#L41)
926
1335
  * with :limit option
927
- * [returns a paged response limiting number of members per page](./spec/acceptance/rest/presence_spec.rb#L55)
1336
+ * [returns a paged response limiting number of members per page](./spec/acceptance/rest/presence_spec.rb#L57)
1337
+ * default :limit
1338
+ * [defaults to a limit of 100](./spec/acceptance/rest/presence_spec.rb#L89)
1339
+ * with :client_id option
1340
+ * PENDING: *[returns a list members filtered by the provided client ID](./spec/acceptance/rest/presence_spec.rb#L98)*
1341
+ * with :connection_id option
1342
+ * PENDING: *[returns a list members filtered by the provided connection ID](./spec/acceptance/rest/presence_spec.rb#L109)*
928
1343
  * #history
929
- * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L67)
1344
+ * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L120)
1345
+ * default behaviour
1346
+ * [uses backwards direction](./spec/acceptance/rest/presence_spec.rb#L135)
930
1347
  * with options
931
1348
  * direction: :forwards
932
- * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L83)
1349
+ * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L147)
933
1350
  * direction: :backwards
934
- * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L98)
1351
+ * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L162)
935
1352
  * #history
936
- * with time range options
937
- * :start
938
- * with milliseconds since epoch value
939
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L150)
940
- * with Time object value
941
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L160)
942
- * :end
943
- * with milliseconds since epoch value
944
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L150)
945
- * with Time object value
946
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L160)
1353
+ * with options
1354
+ * limit options
1355
+ * default
1356
+ * [is set to 100](./spec/acceptance/rest/presence_spec.rb#L210)
1357
+ * set to 1000
1358
+ * [is passes the limit query param value 1000](./spec/acceptance/rest/presence_spec.rb#L223)
1359
+ * with time range options
1360
+ * :start
1361
+ * with milliseconds since epoch value
1362
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L253)
1363
+ * with Time object value
1364
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L263)
1365
+ * :end
1366
+ * with milliseconds since epoch value
1367
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L253)
1368
+ * with Time object value
1369
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L263)
1370
+ * when argument start is after end
1371
+ * [should raise an exception](./spec/acceptance/rest/presence_spec.rb#L274)
947
1372
  * decoding
948
1373
  * with encoded fixture data
949
1374
  * #history
950
- * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L180)
1375
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L293)
951
1376
  * #get
952
- * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L187)
1377
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L300)
953
1378
  * decoding permutations using mocked #history
954
1379
  * valid decodeable content
955
1380
  * #get
956
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L243)
1381
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L356)
957
1382
  * #history
958
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L260)
1383
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L373)
959
1384
  * invalid data
960
1385
  * #get
961
- * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L291)
962
- * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L295)
1386
+ * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L404)
1387
+ * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L408)
963
1388
  * #history
964
- * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L315)
965
- * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L319)
1389
+ * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L428)
1390
+ * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L432)
966
1391
 
967
1392
  ### Ably::Rest::Client#stats
968
1393
  _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb))_
969
1394
  * using JSON and MsgPack protocol
970
1395
  * fetching application stats
1396
+ * [returns a PaginatedResult object](./spec/acceptance/rest/stats_spec.rb#L54)
971
1397
  * by minute
1398
+ * with no options
1399
+ * [uses the minute interval by default](./spec/acceptance/rest/stats_spec.rb#L66)
972
1400
  * with :from set to last interval and :limit set to 1
973
- * [retrieves only one stat](./spec/acceptance/rest/stats_spec.rb#L50)
974
- * [returns zero value for any missing metrics](./spec/acceptance/rest/stats_spec.rb#L54)
975
- * [returns all aggregated message data](./spec/acceptance/rest/stats_spec.rb#L59)
976
- * [returns inbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L64)
977
- * [returns inbound realtime message data](./spec/acceptance/rest/stats_spec.rb#L69)
978
- * [returns outbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L74)
979
- * [returns persisted presence all data](./spec/acceptance/rest/stats_spec.rb#L79)
980
- * [returns connections all data](./spec/acceptance/rest/stats_spec.rb#L84)
981
- * [returns channels all data](./spec/acceptance/rest/stats_spec.rb#L89)
982
- * [returns api_requests data](./spec/acceptance/rest/stats_spec.rb#L94)
983
- * [returns token_requests data](./spec/acceptance/rest/stats_spec.rb#L99)
984
- * [returns stat objects with #interval_granularity equal to :minute](./spec/acceptance/rest/stats_spec.rb#L104)
985
- * [returns stat objects with #interval_id matching :start](./spec/acceptance/rest/stats_spec.rb#L108)
986
- * [returns stat objects with #interval_time matching :start Time](./spec/acceptance/rest/stats_spec.rb#L112)
1401
+ * [retrieves only one stat](./spec/acceptance/rest/stats_spec.rb#L75)
1402
+ * [returns zero value for any missing metrics](./spec/acceptance/rest/stats_spec.rb#L79)
1403
+ * [returns all aggregated message data](./spec/acceptance/rest/stats_spec.rb#L84)
1404
+ * [returns inbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L89)
1405
+ * [returns inbound realtime message data](./spec/acceptance/rest/stats_spec.rb#L94)
1406
+ * [returns outbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L99)
1407
+ * [returns persisted presence all data](./spec/acceptance/rest/stats_spec.rb#L104)
1408
+ * [returns connections all data](./spec/acceptance/rest/stats_spec.rb#L109)
1409
+ * [returns channels all data](./spec/acceptance/rest/stats_spec.rb#L114)
1410
+ * [returns api_requests data](./spec/acceptance/rest/stats_spec.rb#L119)
1411
+ * [returns token_requests data](./spec/acceptance/rest/stats_spec.rb#L124)
1412
+ * [returns stat objects with #interval_granularity equal to :minute](./spec/acceptance/rest/stats_spec.rb#L129)
1413
+ * [returns stat objects with #interval_id matching :start](./spec/acceptance/rest/stats_spec.rb#L133)
1414
+ * [returns stat objects with #interval_time matching :start Time](./spec/acceptance/rest/stats_spec.rb#L137)
987
1415
  * with :start set to first interval, :limit set to 1 and direction :forwards
988
- * [returns the first interval stats as stats are provided forwards from :start](./spec/acceptance/rest/stats_spec.rb#L122)
989
- * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L126)
1416
+ * [returns the first interval stats as stats are provided forwards from :start](./spec/acceptance/rest/stats_spec.rb#L147)
1417
+ * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L151)
990
1418
  * with :end set to last interval, :limit set to 1 and direction :backwards
991
- * [returns the 3rd interval stats first as stats are provided backwards from :end](./spec/acceptance/rest/stats_spec.rb#L139)
992
- * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L143)
1419
+ * [returns the 3rd interval stats first as stats are provided backwards from :end](./spec/acceptance/rest/stats_spec.rb#L163)
1420
+ * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L167)
1421
+ * with :end set to last interval and :limit set to 3 to ensure only last years stats are included
1422
+ * the REST API
1423
+ * [defaults to direction :backwards](./spec/acceptance/rest/stats_spec.rb#L179)
1424
+ * with :end set to previous year interval
1425
+ * the REST API
1426
+ * [defaults to 100 items for pagination](./spec/acceptance/rest/stats_spec.rb#L191)
993
1427
  * by hour
994
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
1428
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L215)
995
1429
  * by day
996
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
1430
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L215)
997
1431
  * by month
998
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
1432
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L215)
1433
+ * when argument start is after end
1434
+ * [should raise an exception](./spec/acceptance/rest/stats_spec.rb#L227)
999
1435
 
1000
1436
  ### Ably::Rest::Client#time
1001
1437
  _(see [spec/acceptance/rest/time_spec.rb](./spec/acceptance/rest/time_spec.rb))_
@@ -1007,22 +1443,22 @@ _(see [spec/acceptance/rest/time_spec.rb](./spec/acceptance/rest/time_spec.rb))_
1007
1443
  _(see [spec/unit/auth_spec.rb](./spec/unit/auth_spec.rb))_
1008
1444
  * client_id option
1009
1445
  * with nil value
1010
- * [is permitted](./spec/unit/auth_spec.rb#L19)
1446
+ * [is permitted](./spec/unit/auth_spec.rb#L20)
1011
1447
  * as UTF_8 string
1012
- * [is permitted](./spec/unit/auth_spec.rb#L27)
1013
- * [remains as UTF-8](./spec/unit/auth_spec.rb#L31)
1448
+ * [is permitted](./spec/unit/auth_spec.rb#L28)
1449
+ * [remains as UTF-8](./spec/unit/auth_spec.rb#L32)
1014
1450
  * as SHIFT_JIS string
1015
- * [gets converted to UTF-8](./spec/unit/auth_spec.rb#L39)
1016
- * [is compatible with original encoding](./spec/unit/auth_spec.rb#L43)
1451
+ * [gets converted to UTF-8](./spec/unit/auth_spec.rb#L40)
1452
+ * [is compatible with original encoding](./spec/unit/auth_spec.rb#L44)
1017
1453
  * as ASCII_8BIT string
1018
- * [gets converted to UTF-8](./spec/unit/auth_spec.rb#L51)
1019
- * [is compatible with original encoding](./spec/unit/auth_spec.rb#L55)
1454
+ * [gets converted to UTF-8](./spec/unit/auth_spec.rb#L52)
1455
+ * [is compatible with original encoding](./spec/unit/auth_spec.rb#L56)
1020
1456
  * as Integer
1021
- * [raises an argument error](./spec/unit/auth_spec.rb#L63)
1457
+ * [raises an argument error](./spec/unit/auth_spec.rb#L64)
1022
1458
  * defaults
1023
- * [should default TTL to 1 hour](./spec/unit/auth_spec.rb#L73)
1024
- * [should default capability to all](./spec/unit/auth_spec.rb#L77)
1025
- * [should only have defaults for :ttl and :capability](./spec/unit/auth_spec.rb#L81)
1459
+ * [should default TTL to 1 hour](./spec/unit/auth_spec.rb#L74)
1460
+ * [should default capability to all](./spec/unit/auth_spec.rb#L78)
1461
+ * [should have defaults for :ttl and :capability](./spec/unit/auth_spec.rb#L82)
1026
1462
 
1027
1463
  ### Ably::Logger
1028
1464
  _(see [spec/unit/logger_spec.rb](./spec/unit/logger_spec.rb))_
@@ -1204,6 +1640,8 @@ _(see [spec/unit/models/message_encoders/utf8_spec.rb](./spec/unit/models/messag
1204
1640
  _(see [spec/unit/models/message_spec.rb](./spec/unit/models/message_spec.rb))_
1205
1641
  * behaves like a model
1206
1642
  * attributes
1643
+ * #id
1644
+ * [retrieves attribute :id](./spec/shared/model_behaviour.rb#L15)
1207
1645
  * #name
1208
1646
  * [retrieves attribute :name](./spec/shared/model_behaviour.rb#L15)
1209
1647
  * #client_id
@@ -1276,46 +1714,44 @@ _(see [spec/unit/models/message_spec.rb](./spec/unit/models/message_spec.rb))_
1276
1714
  * as Nil
1277
1715
  * [is permitted](./spec/unit/models/message_spec.rb#L134)
1278
1716
 
1279
- ### Ably::Models::PaginatedResource
1280
- _(see [spec/unit/models/paginated_resource_spec.rb](./spec/unit/models/paginated_resource_spec.rb))_
1717
+ ### Ably::Models::PaginatedResult
1718
+ _(see [spec/unit/models/paginated_result_spec.rb](./spec/unit/models/paginated_result_spec.rb))_
1281
1719
  * #items
1282
- * [returns correct length from body](./spec/unit/models/paginated_resource_spec.rb#L31)
1283
- * [is Enumerable](./spec/unit/models/paginated_resource_spec.rb#L35)
1284
- * [is iterable](./spec/unit/models/paginated_resource_spec.rb#L39)
1285
- * [provides [] accessor method](./spec/unit/models/paginated_resource_spec.rb#L57)
1286
- * [#first gets the first item in page](./spec/unit/models/paginated_resource_spec.rb#L63)
1287
- * [#last gets the last item in page](./spec/unit/models/paginated_resource_spec.rb#L67)
1720
+ * [returns correct length from body](./spec/unit/models/paginated_result_spec.rb#L31)
1721
+ * [is Enumerable](./spec/unit/models/paginated_result_spec.rb#L35)
1722
+ * [is iterable](./spec/unit/models/paginated_result_spec.rb#L39)
1723
+ * [provides [] accessor method](./spec/unit/models/paginated_result_spec.rb#L57)
1724
+ * [#first gets the first item in page](./spec/unit/models/paginated_result_spec.rb#L63)
1725
+ * [#last gets the last item in page](./spec/unit/models/paginated_result_spec.rb#L67)
1288
1726
  * #each
1289
- * [returns an enumerator](./spec/unit/models/paginated_resource_spec.rb#L44)
1290
- * [yields each item](./spec/unit/models/paginated_resource_spec.rb#L48)
1727
+ * [returns an enumerator](./spec/unit/models/paginated_result_spec.rb#L44)
1728
+ * [yields each item](./spec/unit/models/paginated_result_spec.rb#L48)
1291
1729
  * with non paged http response
1292
- * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L172)
1293
- * [is the last page](./spec/unit/models/paginated_resource_spec.rb#L176)
1294
- * [does not have next page](./spec/unit/models/paginated_resource_spec.rb#L180)
1295
- * [does not support pagination](./spec/unit/models/paginated_resource_spec.rb#L184)
1296
- * [returns nil when accessing next page](./spec/unit/models/paginated_resource_spec.rb#L188)
1297
- * [returns nil when accessing first page](./spec/unit/models/paginated_resource_spec.rb#L192)
1730
+ * [is the last page](./spec/unit/models/paginated_result_spec.rb#L172)
1731
+ * [does not have next page](./spec/unit/models/paginated_result_spec.rb#L176)
1732
+ * [does not support pagination](./spec/unit/models/paginated_result_spec.rb#L180)
1733
+ * [returns nil when accessing next page](./spec/unit/models/paginated_result_spec.rb#L184)
1734
+ * [returns nil when accessing first page](./spec/unit/models/paginated_result_spec.rb#L188)
1298
1735
  * with paged http response
1299
- * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L210)
1300
- * [has next page](./spec/unit/models/paginated_resource_spec.rb#L214)
1301
- * [is not the last page](./spec/unit/models/paginated_resource_spec.rb#L218)
1302
- * [supports pagination](./spec/unit/models/paginated_resource_spec.rb#L222)
1736
+ * [has next page](./spec/unit/models/paginated_result_spec.rb#L206)
1737
+ * [is not the last page](./spec/unit/models/paginated_result_spec.rb#L210)
1738
+ * [supports pagination](./spec/unit/models/paginated_result_spec.rb#L214)
1303
1739
  * accessing next page
1304
- * [returns another PaginatedResource](./spec/unit/models/paginated_resource_spec.rb#L250)
1305
- * [retrieves the next page of results](./spec/unit/models/paginated_resource_spec.rb#L254)
1306
- * [is not the first page](./spec/unit/models/paginated_resource_spec.rb#L259)
1307
- * [does not have a next page](./spec/unit/models/paginated_resource_spec.rb#L263)
1308
- * [is the last page](./spec/unit/models/paginated_resource_spec.rb#L267)
1309
- * [returns nil when trying to access the last page when it is the last page](./spec/unit/models/paginated_resource_spec.rb#L271)
1740
+ * [returns another PaginatedResult](./spec/unit/models/paginated_result_spec.rb#L242)
1741
+ * [retrieves the next page of results](./spec/unit/models/paginated_result_spec.rb#L246)
1742
+ * [does not have a next page](./spec/unit/models/paginated_result_spec.rb#L251)
1743
+ * [is the last page](./spec/unit/models/paginated_result_spec.rb#L255)
1744
+ * [returns nil when trying to access the last page when it is the last page](./spec/unit/models/paginated_result_spec.rb#L259)
1310
1745
  * and then first page
1311
- * [returns a PaginatedResource](./spec/unit/models/paginated_resource_spec.rb#L282)
1312
- * [retrieves the first page of results](./spec/unit/models/paginated_resource_spec.rb#L286)
1313
- * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L290)
1746
+ * [returns a PaginatedResult](./spec/unit/models/paginated_result_spec.rb#L270)
1747
+ * [retrieves the first page of results](./spec/unit/models/paginated_result_spec.rb#L274)
1314
1748
 
1315
1749
  ### Ably::Models::PresenceMessage
1316
1750
  _(see [spec/unit/models/presence_message_spec.rb](./spec/unit/models/presence_message_spec.rb))_
1317
1751
  * behaves like a model
1318
1752
  * attributes
1753
+ * #id
1754
+ * [retrieves attribute :id](./spec/shared/model_behaviour.rb#L15)
1319
1755
  * #client_id
1320
1756
  * [retrieves attribute :client_id](./spec/shared/model_behaviour.rb#L15)
1321
1757
  * #data
@@ -1404,6 +1840,8 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
1404
1840
  * [retrieves attribute :channel_serial](./spec/shared/model_behaviour.rb#L15)
1405
1841
  * #connection_id
1406
1842
  * [retrieves attribute :connection_id](./spec/shared/model_behaviour.rb#L15)
1843
+ * #connection_key
1844
+ * [retrieves attribute :connection_key](./spec/shared/model_behaviour.rb#L15)
1407
1845
  * #==
1408
1846
  * [is true when attributes are the same](./spec/shared/model_behaviour.rb#L41)
1409
1847
  * [is false when attributes are not the same](./spec/shared/model_behaviour.rb#L46)
@@ -1465,6 +1903,10 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
1465
1903
  * [returns nil](./spec/unit/models/protocol_message_spec.rb#L253)
1466
1904
  * with error
1467
1905
  * [returns a valid ErrorInfo object](./spec/unit/models/protocol_message_spec.rb#L261)
1906
+ * #messages
1907
+ * [contains Message objects](./spec/unit/models/protocol_message_spec.rb#L271)
1908
+ * #presence
1909
+ * [contains PresenceMessage objects](./spec/unit/models/protocol_message_spec.rb#L281)
1468
1910
 
1469
1911
  ### Ably::Models::Stats
1470
1912
  _(see [spec/unit/models/stats_spec.rb](./spec/unit/models/stats_spec.rb))_
@@ -1679,7 +2121,7 @@ _(see [spec/unit/models/token_request_spec.rb](./spec/unit/models/token_request_
1679
2121
 
1680
2122
  ### Ably::Modules::EventEmitter
1681
2123
  _(see [spec/unit/modules/event_emitter_spec.rb](./spec/unit/modules/event_emitter_spec.rb))_
1682
- * #trigger event fan out
2124
+ * #emit event fan out
1683
2125
  * [should emit an event for any number of subscribers](./spec/unit/modules/event_emitter_spec.rb#L19)
1684
2126
  * [sends only messages to matching event names](./spec/unit/modules/event_emitter_spec.rb#L28)
1685
2127
  * #on subscribe to multiple events
@@ -1716,7 +2158,7 @@ _(see [spec/unit/modules/state_emitter_spec.rb](./spec/unit/modules/state_emitte
1716
2158
  * [#state= sets current state](./spec/unit/modules/state_emitter_spec.rb#L32)
1717
2159
  * [#change_state sets current state](./spec/unit/modules/state_emitter_spec.rb#L36)
1718
2160
  * #change_state with arguments
1719
- * [passes the arguments through to the triggered callback](./spec/unit/modules/state_emitter_spec.rb#L44)
2161
+ * [passes the arguments through to the executed callback](./spec/unit/modules/state_emitter_spec.rb#L44)
1720
2162
  * #state?
1721
2163
  * [returns true if state matches](./spec/unit/modules/state_emitter_spec.rb#L55)
1722
2164
  * [returns false if state does not match](./spec/unit/modules/state_emitter_spec.rb#L59)
@@ -1742,49 +2184,53 @@ _(see [spec/unit/realtime/channel_spec.rb](./spec/unit/realtime/channel_spec.rb)
1742
2184
  * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L63)
1743
2185
  * #publish name argument
1744
2186
  * as UTF_8 string
1745
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L79)
2187
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L80)
1746
2188
  * as SHIFT_JIS string
1747
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L87)
2189
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L88)
1748
2190
  * as ASCII_8BIT string
1749
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L95)
2191
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L96)
1750
2192
  * as Integer
1751
- * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L103)
2193
+ * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L104)
1752
2194
  * as Nil
1753
- * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L111)
2195
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L112)
1754
2196
  * callbacks
1755
- * [are supported for valid STATE events](./spec/unit/realtime/channel_spec.rb#L118)
1756
- * [fail with unacceptable STATE event names](./spec/unit/realtime/channel_spec.rb#L124)
2197
+ * [are supported for valid STATE events](./spec/unit/realtime/channel_spec.rb#L119)
2198
+ * [fail with unacceptable STATE event names](./spec/unit/realtime/channel_spec.rb#L125)
1757
2199
  * subscriptions
1758
2200
  * #subscribe
1759
- * [without a block raises an invalid ArgumentError](./spec/unit/realtime/channel_spec.rb#L162)
1760
- * [with no event name specified subscribes the provided block to all events](./spec/unit/realtime/channel_spec.rb#L166)
1761
- * [with a single event name subscribes that block to matching events](./spec/unit/realtime/channel_spec.rb#L172)
1762
- * [with a multiple event name arguments subscribes that block to all of those event names](./spec/unit/realtime/channel_spec.rb#L179)
1763
- * [with a multiple duplicate event name arguments subscribes that block to all of those unique event names once](./spec/unit/realtime/channel_spec.rb#L191)
2201
+ * [without a block raises an invalid ArgumentError](./spec/unit/realtime/channel_spec.rb#L167)
2202
+ * [with no event name specified subscribes the provided block to all events](./spec/unit/realtime/channel_spec.rb#L171)
2203
+ * [with a single event name subscribes that block to matching events](./spec/unit/realtime/channel_spec.rb#L177)
2204
+ * [with a multiple event name arguments subscribes that block to all of those event names](./spec/unit/realtime/channel_spec.rb#L184)
2205
+ * [with a multiple duplicate event name arguments subscribes that block to all of those unique event names once](./spec/unit/realtime/channel_spec.rb#L196)
1764
2206
  * #unsubscribe
1765
- * [with no event name specified unsubscribes that block from all events](./spec/unit/realtime/channel_spec.rb#L206)
1766
- * [with a single event name argument unsubscribes the provided block with the matching event name](./spec/unit/realtime/channel_spec.rb#L212)
1767
- * [with multiple event name arguments unsubscribes each of those matching event names with the provided block](./spec/unit/realtime/channel_spec.rb#L218)
1768
- * [with a non-matching event name argument has no effect](./spec/unit/realtime/channel_spec.rb#L224)
1769
- * [with no block argument unsubscribes all blocks for the event name argument](./spec/unit/realtime/channel_spec.rb#L230)
2207
+ * [with no event name specified unsubscribes that block from all events](./spec/unit/realtime/channel_spec.rb#L213)
2208
+ * [with a single event name argument unsubscribes the provided block with the matching event name](./spec/unit/realtime/channel_spec.rb#L219)
2209
+ * [with multiple event name arguments unsubscribes each of those matching event names with the provided block](./spec/unit/realtime/channel_spec.rb#L225)
2210
+ * [with a non-matching event name argument has no effect](./spec/unit/realtime/channel_spec.rb#L231)
2211
+ * [with no block argument unsubscribes all blocks for the event name argument](./spec/unit/realtime/channel_spec.rb#L237)
1770
2212
 
1771
2213
  ### Ably::Realtime::Channels
1772
2214
  _(see [spec/unit/realtime/channels_spec.rb](./spec/unit/realtime/channels_spec.rb))_
1773
2215
  * creating channels
1774
- * [#get creates a channel](./spec/unit/realtime/channels_spec.rb#L13)
1775
- * [#get will reuse the channel object](./spec/unit/realtime/channels_spec.rb#L18)
1776
- * [[] creates a channel](./spec/unit/realtime/channels_spec.rb#L24)
2216
+ * [[] creates a channel](./spec/unit/realtime/channels_spec.rb#L43)
2217
+ * #get
2218
+ * [creates a channel if it does not exist](./spec/unit/realtime/channels_spec.rb#L14)
2219
+ * when an existing channel exists
2220
+ * [will reuse a channel object if it exists](./spec/unit/realtime/channels_spec.rb#L20)
2221
+ * [will update the options on the channel if provided](./spec/unit/realtime/channels_spec.rb#L26)
2222
+ * [will leave the options intact on the channel if not provided](./spec/unit/realtime/channels_spec.rb#L34)
1777
2223
  * #fetch
1778
- * [retrieves a channel if it exists](./spec/unit/realtime/channels_spec.rb#L31)
1779
- * [calls the block if channel is missing](./spec/unit/realtime/channels_spec.rb#L36)
2224
+ * [retrieves a channel if it exists](./spec/unit/realtime/channels_spec.rb#L50)
2225
+ * [calls the block if channel is missing](./spec/unit/realtime/channels_spec.rb#L55)
1780
2226
  * destroying channels
1781
- * [#release detaches and then releases the channel resources](./spec/unit/realtime/channels_spec.rb#L44)
2227
+ * [#release detaches and then releases the channel resources](./spec/unit/realtime/channels_spec.rb#L63)
1782
2228
  * is Enumerable
1783
- * [allows enumeration](./spec/unit/realtime/channels_spec.rb#L61)
1784
- * [provides #length](./spec/unit/realtime/channels_spec.rb#L77)
2229
+ * [allows enumeration](./spec/unit/realtime/channels_spec.rb#L80)
2230
+ * [provides #length](./spec/unit/realtime/channels_spec.rb#L96)
1785
2231
  * #each
1786
- * [returns an enumerator](./spec/unit/realtime/channels_spec.rb#L66)
1787
- * [yields each channel](./spec/unit/realtime/channels_spec.rb#L70)
2232
+ * [returns an enumerator](./spec/unit/realtime/channels_spec.rb#L85)
2233
+ * [yields each channel](./spec/unit/realtime/channels_spec.rb#L89)
1788
2234
 
1789
2235
  ### Ably::Realtime::Client
1790
2236
  _(see [spec/unit/realtime/client_spec.rb](./spec/unit/realtime/client_spec.rb))_
@@ -1807,37 +2253,49 @@ _(see [spec/unit/realtime/client_spec.rb](./spec/unit/realtime/client_spec.rb))_
1807
2253
  * with valid arguments
1808
2254
  * key only
1809
2255
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
2256
+ * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L91)
1810
2257
  * with a string key instead of options hash
1811
- * [sets the key](./spec/shared/client_initializer_behaviour.rb#L103)
1812
- * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L107)
1813
- * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L111)
2258
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L107)
2259
+ * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L111)
2260
+ * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L115)
2261
+ * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L119)
1814
2262
  * with a string token key instead of options hash
1815
- * [sets the token](./spec/shared/client_initializer_behaviour.rb#L119)
1816
- * with token
1817
2263
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L127)
1818
- * with token_details
2264
+ * with token
1819
2265
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L135)
2266
+ * with token_details
2267
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L143)
2268
+ * with token_params
2269
+ * [configures the default token_params](./spec/shared/client_initializer_behaviour.rb#L151)
1820
2270
  * endpoint
1821
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L141)
2271
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L158)
1822
2272
  * with environment option
1823
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L148)
2273
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L165)
2274
+ * with rest_host option
2275
+ * PENDING: *[uses an alternate endpoint for REST clients](./spec/shared/client_initializer_behaviour.rb#L173)*
2276
+ * with realtime_host option
2277
+ * [uses an alternate endpoint for Realtime clients](./spec/shared/client_initializer_behaviour.rb#L182)
2278
+ * with port option and non-TLS connections
2279
+ * [uses the custom port for non-TLS requests](./spec/shared/client_initializer_behaviour.rb#L191)
2280
+ * with tls_port option and a TLS connection
2281
+ * [uses the custom port for TLS requests](./spec/shared/client_initializer_behaviour.rb#L199)
1824
2282
  * tls
1825
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L167)
2283
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L218)
1826
2284
  * set to false
1827
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L158)
1828
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L162)
2285
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L209)
2286
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L213)
1829
2287
  * logger
1830
2288
  * default
1831
- * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L174)
1832
- * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L178)
2289
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L225)
2290
+ * [specifies Logger::WARN log level](./spec/shared/client_initializer_behaviour.rb#L229)
1833
2291
  * with log_level :none
1834
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L186)
2292
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L237)
1835
2293
  * with custom logger and log_level
1836
- * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L204)
1837
- * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L208)
2294
+ * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L255)
2295
+ * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L259)
1838
2296
  * delegators
1839
- * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L218)
1840
- * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L223)
2297
+ * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L269)
2298
+ * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L274)
1841
2299
  * delegation to the REST Client
1842
2300
  * [passes on the options to the initializer](./spec/unit/realtime/client_spec.rb#L15)
1843
2301
  * for attribute
@@ -1942,8 +2400,6 @@ _(see [spec/unit/rest/channel_spec.rb](./spec/unit/rest/channel_spec.rb))_
1942
2400
  * [is permitted](./spec/unit/rest/channel_spec.rb#L88)
1943
2401
  * as Integer
1944
2402
  * [raises an argument error](./spec/unit/rest/channel_spec.rb#L96)
1945
- * as Nil
1946
- * [raises an argument error](./spec/unit/rest/channel_spec.rb#L104)
1947
2403
 
1948
2404
  ### Ably::Rest::Channels
1949
2405
  _(see [spec/unit/rest/channels_spec.rb](./spec/unit/rest/channels_spec.rb))_
@@ -1984,50 +2440,62 @@ _(see [spec/unit/rest/client_spec.rb](./spec/unit/rest/client_spec.rb))_
1984
2440
  * with valid arguments
1985
2441
  * key only
1986
2442
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
2443
+ * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L91)
1987
2444
  * with a string key instead of options hash
1988
- * [sets the key](./spec/shared/client_initializer_behaviour.rb#L103)
1989
- * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L107)
1990
- * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L111)
2445
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L107)
2446
+ * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L111)
2447
+ * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L115)
2448
+ * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L119)
1991
2449
  * with a string token key instead of options hash
1992
- * [sets the token](./spec/shared/client_initializer_behaviour.rb#L119)
1993
- * with token
1994
2450
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L127)
1995
- * with token_details
2451
+ * with token
1996
2452
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L135)
2453
+ * with token_details
2454
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L143)
2455
+ * with token_params
2456
+ * [configures the default token_params](./spec/shared/client_initializer_behaviour.rb#L151)
1997
2457
  * endpoint
1998
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L141)
2458
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L158)
1999
2459
  * with environment option
2000
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L148)
2460
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L165)
2461
+ * with rest_host option
2462
+ * [uses an alternate endpoint for REST clients](./spec/shared/client_initializer_behaviour.rb#L173)
2463
+ * with realtime_host option
2464
+ * PENDING: *[uses an alternate endpoint for Realtime clients](./spec/shared/client_initializer_behaviour.rb#L182)*
2465
+ * with port option and non-TLS connections
2466
+ * [uses the custom port for non-TLS requests](./spec/shared/client_initializer_behaviour.rb#L191)
2467
+ * with tls_port option and a TLS connection
2468
+ * [uses the custom port for TLS requests](./spec/shared/client_initializer_behaviour.rb#L199)
2001
2469
  * tls
2002
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L167)
2470
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L218)
2003
2471
  * set to false
2004
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L158)
2005
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L162)
2472
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L209)
2473
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L213)
2006
2474
  * logger
2007
2475
  * default
2008
- * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L174)
2009
- * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L178)
2476
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L225)
2477
+ * [specifies Logger::WARN log level](./spec/shared/client_initializer_behaviour.rb#L229)
2010
2478
  * with log_level :none
2011
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L186)
2479
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L237)
2012
2480
  * with custom logger and log_level
2013
- * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L204)
2014
- * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L208)
2481
+ * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L255)
2482
+ * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L259)
2015
2483
  * delegators
2016
- * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L218)
2017
- * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L223)
2484
+ * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L269)
2485
+ * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L274)
2018
2486
  * initializer options
2019
2487
  * TLS
2020
2488
  * disabled
2021
2489
  * [fails for any operation with basic auth and attempting to send an API key over a non-secure connection](./spec/unit/rest/client_spec.rb#L17)
2022
2490
  * :use_token_auth
2023
2491
  * set to false
2024
- * with an key with :tls => false
2492
+ * with a key and :tls => false
2025
2493
  * [fails for any operation with basic auth and attempting to send an API key over a non-secure connection](./spec/unit/rest/client_spec.rb#L28)
2026
- * without an key
2027
- * [fails as an key is required if not using token auth](./spec/unit/rest/client_spec.rb#L36)
2494
+ * without a key
2495
+ * [fails as a key is required if not using token auth](./spec/unit/rest/client_spec.rb#L36)
2028
2496
  * set to true
2029
- * without an key or token
2030
- * [fails as an key is required to issue tokens](./spec/unit/rest/client_spec.rb#L46)
2497
+ * without a key or token
2498
+ * [fails as a key is required to issue tokens](./spec/unit/rest/client_spec.rb#L46)
2031
2499
 
2032
2500
  ### Ably::Rest
2033
2501
  _(see [spec/unit/rest/rest_spec.rb](./spec/unit/rest/rest_spec.rb))_
@@ -2068,6 +2536,6 @@ _(see [spec/unit/util/pub_sub_spec.rb](./spec/unit/util/pub_sub_spec.rb))_
2068
2536
 
2069
2537
  ## Test summary
2070
2538
 
2071
- * Passing tests: 1029
2072
- * Pending tests: 6
2539
+ * Passing tests: 1244
2540
+ * Pending tests: 13
2073
2541
  * Failing tests: 0