ably 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +1 -0
  3. data/.gitmodules +3 -0
  4. data/README.md +46 -22
  5. data/SPEC.md +345 -240
  6. data/ably.gemspec +4 -2
  7. data/lib/ably/auth.rb +18 -14
  8. data/lib/ably/models/message.rb +1 -1
  9. data/lib/ably/models/paginated_resource.rb +31 -44
  10. data/lib/ably/models/presence_message.rb +1 -1
  11. data/lib/ably/models/stat.rb +67 -24
  12. data/lib/ably/models/stats_types.rb +131 -0
  13. data/lib/ably/modules/async_wrapper.rb +3 -2
  14. data/lib/ably/modules/message_emitter.rb +2 -2
  15. data/lib/ably/realtime.rb +1 -1
  16. data/lib/ably/realtime/channel.rb +24 -3
  17. data/lib/ably/realtime/channel/channel_manager.rb +1 -0
  18. data/lib/ably/realtime/client.rb +2 -2
  19. data/lib/ably/realtime/connection.rb +1 -1
  20. data/lib/ably/realtime/presence.rb +12 -1
  21. data/lib/ably/rest.rb +1 -1
  22. data/lib/ably/rest/channel.rb +4 -5
  23. data/lib/ably/rest/client.rb +5 -5
  24. data/lib/ably/rest/presence.rb +2 -2
  25. data/lib/ably/version.rb +1 -1
  26. data/spec/acceptance/realtime/channel_history_spec.rb +74 -23
  27. data/spec/acceptance/realtime/channel_spec.rb +3 -3
  28. data/spec/acceptance/realtime/client_spec.rb +3 -3
  29. data/spec/acceptance/realtime/connection_failures_spec.rb +2 -2
  30. data/spec/acceptance/realtime/connection_spec.rb +4 -4
  31. data/spec/acceptance/realtime/message_spec.rb +5 -5
  32. data/spec/acceptance/realtime/presence_history_spec.rb +56 -13
  33. data/spec/acceptance/realtime/presence_spec.rb +8 -8
  34. data/spec/acceptance/realtime/stats_spec.rb +1 -1
  35. data/spec/acceptance/realtime/time_spec.rb +1 -1
  36. data/spec/acceptance/rest/auth_spec.rb +31 -4
  37. data/spec/acceptance/rest/base_spec.rb +3 -3
  38. data/spec/acceptance/rest/channel_spec.rb +19 -19
  39. data/spec/acceptance/rest/channels_spec.rb +1 -1
  40. data/spec/acceptance/rest/client_spec.rb +9 -6
  41. data/spec/acceptance/rest/encoders_spec.rb +1 -1
  42. data/spec/acceptance/rest/message_spec.rb +10 -10
  43. data/spec/acceptance/rest/presence_spec.rb +81 -51
  44. data/spec/acceptance/rest/stats_spec.rb +46 -41
  45. data/spec/acceptance/rest/time_spec.rb +1 -1
  46. data/spec/shared/client_initializer_behaviour.rb +30 -19
  47. data/spec/spec_helper.rb +3 -0
  48. data/spec/support/markdown_spec_formatter.rb +1 -1
  49. data/spec/support/test_app.rb +11 -24
  50. data/spec/unit/auth_spec.rb +1 -1
  51. data/spec/unit/models/paginated_resource_spec.rb +81 -72
  52. data/spec/unit/models/stats_spec.rb +289 -0
  53. data/spec/unit/modules/async_wrapper_spec.rb +1 -1
  54. data/spec/unit/realtime/client_spec.rb +1 -1
  55. data/spec/unit/realtime/realtime_spec.rb +1 -1
  56. data/spec/unit/rest/channel_spec.rb +1 -1
  57. data/spec/unit/rest/client_spec.rb +8 -8
  58. data/spec/unit/rest/rest_spec.rb +1 -1
  59. data/spec/unit/util/crypto_spec.rb +1 -1
  60. metadata +55 -43
  61. data/spec/resources/crypto-data-128.json +0 -56
  62. data/spec/resources/crypto-data-256.json +0 -56
  63. data/spec/unit/models/stat_spec.rb +0 -113
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDVmOWUzZWViZGQyNWJkMGNkMzE4M2M1ZmU2MTQ3YWZlNzE5ODU3Nw==
5
- data.tar.gz: !binary |-
6
- MzBmYzdkYTAxZTBhZTUwYTFmMjI0ZjFiYWJhMjY2ZWM5OTExZDZhZg==
2
+ SHA1:
3
+ metadata.gz: bcbdc60f16510edf0fa8a6dd96f142d1b507341c
4
+ data.tar.gz: a4f451ae9f096f4b91f29c493f5985278f5fa6c6
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MTExYzI3NjMzNjEyMzk2OTA1OTlkMjRkMTUwYWY3YzFhMTY2NTc5NjhlMDgy
10
- YTI1N2FjZTNiOGNjMDk1YjVmMmNlZDY0NWE5N2FmZTNkZDMzZGMwMDY0YTdl
11
- YTRjYzBjYmQ4ZjNiNjFiODdjYTgyY2MyOTU1ZWU4NjhkZGZhNGE=
12
- data.tar.gz: !binary |-
13
- NzkxYTVlNjNlY2EyZTBhMzgwY2QyM2I5MGZmZjRjMjJmY2JlYjUxNGI1ODA0
14
- MjEwOWNhMDk3ZWY0OWM3MDQ3MmNiZDE2ZjhlZjVkYTI4MjcwNjJkYjI2NTRi
15
- NDllYmE3ODkyOTI2NGIwZjlkZTYxYjRmMTJhYzBlMDI3MDFmYmQ=
6
+ metadata.gz: a7f1794e98c16a94d8e1fa3790c82ae3ca5852a4d8e14832366eb45195e620c0728f4b41c21ff20159e30c0b783c0ae39af2caeefc427cf1584be0ad79eb5345
7
+ data.tar.gz: 6401e4ecbd7aa85609d1568998be4689f7ff340966471111c74a8d5f35ad2e3c93a4cf4121b291022a3b8cc857227f683711ee31d36dd1170c94ac7cd706495e
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ doc/*
4
4
  pkg
5
5
  .bundle
6
6
  bin
7
+ coverage
@@ -0,0 +1,3 @@
1
+ [submodule "lib/submodules/ably-common"]
2
+ path = lib/submodules/ably-common
3
+ url = https://github.com/ably/ably-common.git
data/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/ably/ably-ruby.png)](https://travis-ci.org/ably/ably-ruby)
4
4
  [![Gem Version](https://badge.fury.io/rb/ably.svg)](http://badge.fury.io/rb/ably)
5
+ [![Coverage Status](https://coveralls.io/repos/ably/ably-ruby/badge.svg)](https://coveralls.io/r/ably/ably-ruby)
5
6
 
6
- A Ruby client library for [ably.io](https://ably.io), the real-time messaging service.
7
+ A Ruby client library for [ably.io](https://ably.io), the realtime messaging service.
7
8
 
8
9
  ## Documentation
9
10
 
@@ -40,7 +41,7 @@ end
40
41
  All examples assume a client has been created as follows:
41
42
 
42
43
  ```ruby
43
- client = Ably::Realtime.new(api_key: "xxxxx")
44
+ client = Ably::Realtime.new(key: 'xxxxx')
44
45
  ```
45
46
 
46
47
  ### Connection
@@ -67,7 +68,7 @@ end
67
68
  Given:
68
69
 
69
70
  ```ruby
70
- channel = client.channel("test")
71
+ channel = client.channel('test')
71
72
  ```
72
73
 
73
74
  Subscribe to all events:
@@ -82,7 +83,7 @@ end
82
83
  Only certain events:
83
84
 
84
85
  ```ruby
85
- channel.subscribe("myEvent") do |message|
86
+ channel.subscribe('myEvent') do |message|
86
87
  message[:name] #=> "myEvent"
87
88
  message[:data] #=> "myData"
88
89
  end
@@ -91,17 +92,19 @@ end
91
92
  ### Publishing to a channel
92
93
 
93
94
  ```ruby
94
- channel.publish("greeting", "Hello World!")
95
+ channel.publish('greeting', 'Hello World!')
95
96
  ```
96
97
 
97
98
  ### Querying the History
98
99
 
99
100
  ```ruby
100
- channel.history do |messages|
101
- messages # Ably::Models::PaginatedResource
102
- messages.first # Ably::Models::Message
103
- messages.length # number of messages in the retrieved history page
104
- messages.next_page # Ably::Models::PaginatedResource
101
+ channel.history do |messages_page|
102
+ messages_page #=> #<Ably::Models::PaginatedResource ...>
103
+ messages_page.items.first # #<Ably::Models::Message ...>
104
+ messages_page.items.first.data # payload for the message
105
+ messages_page.items.length # number of messages in the current page of history
106
+ messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
107
+ messages_page.has_next? # false, there are more pages
105
108
  end
106
109
  ```
107
110
 
@@ -116,11 +119,11 @@ end
116
119
  ### Querying the Presence History
117
120
 
118
121
  ```ruby
119
- channel.presence.history do |presence_messages|
120
- presence_messages.first.action # Any of :enter, :update or :leave
121
- presence_messages.first.client_id
122
- presence_messages.first.data
123
- presence_messages.next_page # Ably::Models::PaginatedResource
122
+ channel.presence.history do |presence_page|
123
+ presence_page.items.first.action # Any of :enter, :update or :leave
124
+ presence_page.items.first.client_id # client ID of member
125
+ presence_page.items.first.data # optional data payload of member
126
+ presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
124
127
  end
125
128
  ```
126
129
 
@@ -133,32 +136,43 @@ Unlike the Realtime API, all calls are synchronous and are not run within an [Ev
133
136
  All examples assume a client and/or channel has been created as follows:
134
137
 
135
138
  ```ruby
136
- client = Ably::Rest.new(api_key: "xxxxx")
139
+ client = Ably::Rest.new(key: 'xxxxx')
137
140
  channel = client.channel('test')
138
141
  ```
139
142
 
140
143
  ### Publishing a message to a channel
141
144
 
142
145
  ```ruby
143
- channel.publish("myEvent", "Hello!") #=> true
146
+ channel.publish('myEvent', 'Hello!') #=> true
144
147
  ```
145
148
 
146
149
  ### Querying the History
147
150
 
148
151
  ```ruby
149
- channel.history #=> #<Ably::Models::PaginatedResource ...>
152
+ messages_page = channel.history #=> #<Ably::Models::PaginatedResource ...>
153
+ messages_page.items.first #=> #<Ably::Models::Message ...>
154
+ messages_page.items.first.data # payload for the message
155
+ messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
156
+ messages_page.has_next? # false, there are more pages
150
157
  ```
151
158
 
152
159
  ### Presence on a channel
153
160
 
154
161
  ```ruby
155
- channel.presence.get # => #<Ably::Models::PaginatedResource ...>
162
+ members_page = channel.presence.get # => #<Ably::Models::PaginatedResource ...>
163
+ members_page.items.first # first member present in this page => #<Ably::Models::PresenceMessage ...>
164
+ members_page.items.first.client_id # client ID of first member present
165
+ members_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
166
+ members_page.has_next? # false, there are more pages
156
167
  ```
157
168
 
158
169
  ### Querying the Presence History
159
170
 
160
171
  ```ruby
161
- channel.presence.history # => #<Ably::Models::PaginatedResource ...>
172
+ presence_page = channel.presence.history #=> #<Ably::Models::PaginatedResource ...>
173
+ presence_page.items.first #=> #<Ably::Models::PresenceMessage ...>
174
+ presence_page.items.first.client_id # client ID of first member
175
+ presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
162
176
  ```
163
177
 
164
178
  ### Generate Token and Token Request
@@ -167,7 +181,7 @@ channel.presence.history # => #<Ably::Models::PaginatedResource ...>
167
181
  client.auth.request_token
168
182
  # => #<Ably::Models::Token ...>
169
183
 
170
- client.auth.create_token_request
184
+ token = client.auth.create_token_request
171
185
  # => {"id"=>...,
172
186
  # "clientId"=>nil,
173
187
  # "ttl"=>3600,
@@ -175,12 +189,22 @@ client.auth.create_token_request
175
189
  # "capability"=>"{\"*\":[\"*\"]}",
176
190
  # "nonce"=>...,
177
191
  # "mac"=>...}
192
+
193
+ client = Ably::Rest.new(token_id: token.id)
178
194
  ```
179
195
 
180
196
  ### Fetching your application's stats
181
197
 
182
198
  ```ruby
183
- client.stats #=> PaginatedResource [{:channels=>..., :apiRequests=>..., ...}]
199
+ stats_page = client.stats #=> #<Ably::Models::PaginatedResource ...>
200
+ stats_page.items.first = #<Ably::Models::Stats ...>
201
+ stats_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
202
+ ```
203
+
204
+ ### Fetching the Ably service time
205
+
206
+ ```ruby
207
+ client.time #=> 2013-12-12 14:23:34 +0000
184
208
  ```
185
209
 
186
210
  ## Dependencies
data/SPEC.md CHANGED
@@ -1,22 +1,27 @@
1
- # Ably Real-time & REST Client Library 0.7.3 Specification
1
+ # Ably Realtime & REST Client Library 0.7.5 Specification
2
2
 
3
3
  ### Ably::Realtime::Channel#history
4
4
  _(see [spec/acceptance/realtime/channel_history_spec.rb](./spec/acceptance/realtime/channel_history_spec.rb))_
5
5
  * using JSON and MsgPack protocol
6
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_history_spec.rb#L20)
6
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_history_spec.rb#L21)
7
7
  * with a single client publishing and receiving
8
- * [retrieves real-time history](./spec/acceptance/realtime/channel_history_spec.rb#L33)
8
+ * [retrieves realtime history](./spec/acceptance/realtime/channel_history_spec.rb#L34)
9
9
  * with two clients publishing messages on the same channel
10
- * [retrieves real-time history on both channels](./spec/acceptance/realtime/channel_history_spec.rb#L45)
10
+ * [retrieves realtime history on both channels](./spec/acceptance/realtime/channel_history_spec.rb#L46)
11
11
  * with lots of messages published with a single client and channel
12
12
  * as one ProtocolMessage
13
- * [retrieves history forwards with pagination through :limit option](./spec/acceptance/realtime/channel_history_spec.rb#L87)
14
- * [retrieves history backwards with pagination through :limit option](./spec/acceptance/realtime/channel_history_spec.rb#L96)
13
+ * [retrieves history forwards with pagination through :limit option](./spec/acceptance/realtime/channel_history_spec.rb#L88)
14
+ * [retrieves history backwards with pagination through :limit option](./spec/acceptance/realtime/channel_history_spec.rb#L97)
15
15
  * in multiple ProtocolMessages
16
- * [retrieves limited history forwards with pagination](./spec/acceptance/realtime/channel_history_spec.rb#L107)
17
- * [retrieves limited history backwards with pagination](./spec/acceptance/realtime/channel_history_spec.rb#L118)
16
+ * [retrieves limited history forwards with pagination](./spec/acceptance/realtime/channel_history_spec.rb#L108)
17
+ * [retrieves limited history backwards with pagination](./spec/acceptance/realtime/channel_history_spec.rb#L119)
18
18
  * and REST history
19
- * [return the same results with unique matching message IDs](./spec/acceptance/realtime/channel_history_spec.rb#L134)
19
+ * [return the same results with unique matching message IDs](./spec/acceptance/realtime/channel_history_spec.rb#L135)
20
+ * with option until_attach: true
21
+ * [retrieves all messages before channel was attached](./spec/acceptance/realtime/channel_history_spec.rb#L160)
22
+ * [raises an exception unless state is attached](./spec/acceptance/realtime/channel_history_spec.rb#L199)
23
+ * and two pages of messages
24
+ * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/channel_history_spec.rb#L175)
20
25
 
21
26
  ### Ably::Realtime::Channel
22
27
  _(see [spec/acceptance/realtime/channel_spec.rb](./spec/acceptance/realtime/channel_spec.rb))_
@@ -104,7 +109,7 @@ _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/clien
104
109
  * using JSON and MsgPack protocol
105
110
  * initialization
106
111
  * basic auth
107
- * [is enabled by default with a provided :api_key option](./spec/acceptance/realtime/client_spec.rb#L18)
112
+ * [is enabled by default with a provided :key option](./spec/acceptance/realtime/client_spec.rb#L18)
108
113
  * :tls option
109
114
  * set to false to forec a plain-text connection
110
115
  * [fails to connect because a private key cannot be sent over a non-secure connection](./spec/acceptance/realtime/client_spec.rb#L31)
@@ -112,14 +117,14 @@ _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/clien
112
117
  * with TLS enabled
113
118
  * and a pre-generated Token provided with the :token_id option
114
119
  * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L51)
115
- * with valid :api_key and :use_token_auth option set to true
120
+ * with valid :key and :use_token_auth option set to true
116
121
  * [automatically authorises on connect and generates a token](./spec/acceptance/realtime/client_spec.rb#L64)
117
122
  * with client_id
118
123
  * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L77)
119
124
  * with TLS disabled
120
125
  * and a pre-generated Token provided with the :token_id option
121
126
  * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L51)
122
- * with valid :api_key and :use_token_auth option set to true
127
+ * with valid :key and :use_token_auth option set to true
123
128
  * [automatically authorises on connect and generates a token](./spec/acceptance/realtime/client_spec.rb#L64)
124
129
  * with client_id
125
130
  * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L77)
@@ -331,73 +336,78 @@ _(see [spec/acceptance/realtime/message_spec.rb](./spec/acceptance/realtime/mess
331
336
  * without suitable publishing permissions
332
337
  * [calls the error callback](./spec/acceptance/realtime/message_spec.rb#L183)
333
338
  * server incorrectly resends a message that was already received by the client library
334
- * [discards the message and logs it as an error to the channel](./spec/acceptance/realtime/message_spec.rb#L202)
339
+ * [discards the message and logs it as an error to the channel](./spec/acceptance/realtime/message_spec.rb#L203)
335
340
  * encoding and decoding encrypted messages
336
341
  * with AES-128-CBC using crypto-data-128.json fixtures
337
342
  * item 0 with encrypted encoding utf-8/cipher+aes-128-cbc/base64
338
343
  * behaves like an Ably encrypter and decrypter
339
344
  * with #publish and #subscribe
340
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
341
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
342
347
  * item 1 with encrypted encoding cipher+aes-128-cbc/base64
343
348
  * behaves like an Ably encrypter and decrypter
344
349
  * with #publish and #subscribe
345
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
346
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
347
352
  * item 2 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
348
353
  * behaves like an Ably encrypter and decrypter
349
354
  * with #publish and #subscribe
350
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
351
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
352
357
  * item 3 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
353
358
  * behaves like an Ably encrypter and decrypter
354
359
  * with #publish and #subscribe
355
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
356
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
357
362
  * with AES-256-CBC using crypto-data-256.json fixtures
358
363
  * item 0 with encrypted encoding utf-8/cipher+aes-256-cbc/base64
359
364
  * behaves like an Ably encrypter and decrypter
360
365
  * with #publish and #subscribe
361
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
362
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
363
368
  * item 1 with encrypted encoding cipher+aes-256-cbc/base64
364
369
  * behaves like an Ably encrypter and decrypter
365
370
  * with #publish and #subscribe
366
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
367
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
368
373
  * item 2 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
369
374
  * behaves like an Ably encrypter and decrypter
370
375
  * with #publish and #subscribe
371
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
372
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
373
378
  * item 3 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
374
379
  * behaves like an Ably encrypter and decrypter
375
380
  * with #publish and #subscribe
376
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L266)
377
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L284)
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)
378
383
  * with multiple sends from one client to another
379
- * [encrypts and decrypts all messages](./spec/acceptance/realtime/message_spec.rb#L323)
384
+ * [encrypts and decrypts all messages](./spec/acceptance/realtime/message_spec.rb#L324)
380
385
  * subscribing with a different transport protocol
381
- * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L366)
382
- * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L366)
383
- * [delivers a Hash payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L366)
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)
384
389
  * publishing on an unencrypted channel and subscribing on an encrypted channel with another client
385
- * [does not attempt to decrypt the message](./spec/acceptance/realtime/message_spec.rb#L385)
390
+ * [does not attempt to decrypt the message](./spec/acceptance/realtime/message_spec.rb#L386)
386
391
  * publishing on an encrypted channel and subscribing on an unencrypted channel with another client
387
- * [delivers the message but still encrypted with a value in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L403)
388
- * [triggers a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L412)
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)
389
394
  * publishing on an encrypted channel and subscribing with a different algorithm on another client
390
- * [delivers the message but still encrypted with the cipher detials in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L434)
391
- * [triggers a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L443)
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)
392
397
  * publishing on an encrypted channel and subscribing with a different key on another client
393
- * [delivers the message but still encrypted with the cipher details in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L465)
394
- * [triggers a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L474)
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)
395
400
 
396
401
  ### Ably::Realtime::Presence history
397
402
  _(see [spec/acceptance/realtime/presence_history_spec.rb](./spec/acceptance/realtime/presence_history_spec.rb))_
398
403
  * using JSON and MsgPack protocol
399
404
  * [provides up to the moment presence history](./spec/acceptance/realtime/presence_history_spec.rb#L21)
400
405
  * [ensures REST presence history message IDs match ProtocolMessage wrapped message and connection IDs via Realtime](./spec/acceptance/realtime/presence_history_spec.rb#L41)
406
+ * 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)
409
+ * and two pages of messages
410
+ * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L73)
401
411
 
402
412
  ### Ably::Realtime::Presence
403
413
  _(see [spec/acceptance/realtime/presence_spec.rb](./spec/acceptance/realtime/presence_spec.rb))_
@@ -633,70 +643,76 @@ _(see [spec/acceptance/rest/auth_spec.rb](./spec/acceptance/rest/auth_spec.rb))_
633
643
  * with token_request_block that returns a token
634
644
  * [calls the block when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L317)
635
645
  * [uses the token request from the block when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L322)
646
+ * with client_id
647
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L357)
636
648
  * before #authorise has been called
637
- * [has no current_token](./spec/acceptance/rest/auth_spec.rb#L334)
649
+ * [has no current_token](./spec/acceptance/rest/auth_spec.rb#L364)
638
650
  * #authorise
639
- * [updates the persisted auth options thare are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L381)
651
+ * [updates the persisted auth options thare are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L411)
640
652
  * when called for the first time since the client has been instantiated
641
- * [passes all options to #request_token](./spec/acceptance/rest/auth_spec.rb#L345)
642
- * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L350)
643
- * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L354)
653
+ * [passes all options to #request_token](./spec/acceptance/rest/auth_spec.rb#L375)
654
+ * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L380)
655
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L384)
644
656
  * with previous authorisation
645
- * [does not request a token if current_token has not expired](./spec/acceptance/rest/auth_spec.rb#L365)
646
- * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L370)
647
- * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L376)
657
+ * [does not request a token if current_token has not expired](./spec/acceptance/rest/auth_spec.rb#L395)
658
+ * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L400)
659
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L406)
648
660
  * with token_request_block
649
- * [calls the block](./spec/acceptance/rest/auth_spec.rb#L397)
650
- * [uses the token request returned from the block when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L401)
661
+ * [calls the block](./spec/acceptance/rest/auth_spec.rb#L427)
662
+ * [uses the token request returned from the block when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L431)
651
663
  * for every subsequent #request_token
652
664
  * without a provided block
653
- * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L407)
665
+ * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L437)
654
666
  * with a provided block
655
- * [does not call the originally provided block and calls the new #request_token block](./spec/acceptance/rest/auth_spec.rb#L414)
667
+ * [does not call the originally provided block and calls the new #request_token block](./spec/acceptance/rest/auth_spec.rb#L444)
656
668
  * #create_token_request
657
- * [uses the key ID from the client](./spec/acceptance/rest/auth_spec.rb#L430)
658
- * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L434)
659
- * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L438)
669
+ * [uses the key ID from the client](./spec/acceptance/rest/auth_spec.rb#L460)
670
+ * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L464)
671
+ * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L468)
660
672
  * the nonce
661
- * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L443)
662
- * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L448)
673
+ * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L473)
674
+ * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L478)
663
675
  * with option :ttl
664
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
676
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L489)
665
677
  * with option :capability
666
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
678
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L489)
667
679
  * with option :nonce
668
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
680
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L489)
669
681
  * with option :timestamp
670
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
682
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L489)
671
683
  * with option :client_id
672
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
684
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L489)
673
685
  * with additional invalid attributes
674
- * [are ignored](./spec/acceptance/rest/auth_spec.rb#L467)
686
+ * [are ignored](./spec/acceptance/rest/auth_spec.rb#L497)
675
687
  * when required fields are missing
676
- * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L478)
677
- * [should raise an exception if key id is missing](./spec/acceptance/rest/auth_spec.rb#L482)
688
+ * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L508)
689
+ * [should raise an exception if key id is missing](./spec/acceptance/rest/auth_spec.rb#L512)
678
690
  * with :query_time option
679
- * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L491)
691
+ * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L521)
680
692
  * with :timestamp option
681
- * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L501)
693
+ * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L531)
682
694
  * signing
683
- * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L518)
695
+ * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L548)
684
696
  * using token authentication
685
697
  * with :token_id option
686
- * [authenticates successfully using the provided :token_id](./spec/acceptance/rest/auth_spec.rb#L541)
687
- * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L545)
688
- * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L553)
689
- * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L561)
698
+ * [authenticates successfully using the provided :token_id](./spec/acceptance/rest/auth_spec.rb#L571)
699
+ * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L575)
700
+ * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L583)
701
+ * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L591)
690
702
  * when implicit as a result of using :client id
691
703
  * and requests to the Ably server are mocked
692
- * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L591)
704
+ * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L621)
693
705
  * a token is created
694
- * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L600)
695
- * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L604)
696
- * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L608)
697
- * when using an :api_key and basic auth
698
- * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L623)
699
- * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L627)
706
+ * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L630)
707
+ * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L634)
708
+ * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L638)
709
+ * when using an :key and basic auth
710
+ * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L653)
711
+ * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L657)
712
+ * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L661)
713
+ * when using legacy :api_key option and basic auth
714
+ * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L671)
715
+ * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L675)
700
716
 
701
717
  ### Ably::Rest
702
718
  _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
@@ -729,7 +745,7 @@ _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
729
745
  _(see [spec/acceptance/rest/channel_spec.rb](./spec/acceptance/rest/channel_spec.rb))_
730
746
  * using JSON and MsgPack protocol
731
747
  * #publish
732
- * [should publish the message adn return true indicating success](./spec/acceptance/rest/channel_spec.rb#L17)
748
+ * [should publish the message and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L17)
733
749
  * #history
734
750
  * [should return the current message history for the channel](./spec/acceptance/rest/channel_spec.rb#L39)
735
751
  * [should return paged history using the PaginatedResource model](./spec/acceptance/rest/channel_spec.rb#L67)
@@ -904,41 +920,47 @@ _(see [spec/acceptance/rest/presence_spec.rb](./spec/acceptance/rest/presence_sp
904
920
  * using JSON and MsgPack protocol
905
921
  * tested against presence fixture data set up in test app
906
922
  * #get
907
- * [returns current members on the channel with their action set to :present](./spec/acceptance/rest/presence_spec.rb#L30)
923
+ * [returns current members on the channel with their action set to :present](./spec/acceptance/rest/presence_spec.rb#L41)
908
924
  * with :limit option
909
- * [returns a paged response limiting number of members per page](./spec/acceptance/rest/presence_spec.rb#L44)
925
+ * [returns a paged response limiting number of members per page](./spec/acceptance/rest/presence_spec.rb#L55)
910
926
  * #history
911
- * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L62)
927
+ * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L67)
912
928
  * with options
913
929
  * direction: :forwards
914
- * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L78)
930
+ * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L83)
915
931
  * direction: :backwards
916
- * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L93)
932
+ * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L98)
917
933
  * #history
918
934
  * with time range options
919
935
  * :start
920
936
  * with milliseconds since epoch value
921
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L138)
937
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L143)
922
938
  * with Time object value
923
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L148)
939
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L153)
924
940
  * :end
925
941
  * with milliseconds since epoch value
926
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L138)
942
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L143)
927
943
  * with Time object value
928
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L148)
944
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L153)
929
945
  * decoding
946
+ * with encoded fixture data
947
+ * #history
948
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L173)
949
+ * #get
950
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L180)
951
+ * decoding permutations using mocked #history
930
952
  * valid decodeable content
931
953
  * #get
932
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L206)
954
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L236)
933
955
  * #history
934
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L223)
956
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L253)
935
957
  * invalid data
936
958
  * #get
937
- * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L254)
938
- * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L258)
959
+ * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L284)
960
+ * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L288)
939
961
  * #history
940
- * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L278)
941
- * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L282)
962
+ * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L308)
963
+ * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L312)
942
964
 
943
965
  ### Ably::Rest::Client#stats
944
966
  _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb))_
@@ -947,30 +969,31 @@ _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb)
947
969
  * by minute
948
970
  * with :from set to last interval and :limit set to 1
949
971
  * [retrieves only one stat](./spec/acceptance/rest/stats_spec.rb#L50)
950
- * [returns all aggregated message data](./spec/acceptance/rest/stats_spec.rb#L54)
951
- * [returns inbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L59)
952
- * [returns inbound realtime message data](./spec/acceptance/rest/stats_spec.rb#L64)
953
- * [returns outbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L69)
954
- * [returns persisted presence all data](./spec/acceptance/rest/stats_spec.rb#L74)
955
- * [returns connections all data](./spec/acceptance/rest/stats_spec.rb#L79)
956
- * [returns channels all data](./spec/acceptance/rest/stats_spec.rb#L84)
957
- * [returns api_requests data](./spec/acceptance/rest/stats_spec.rb#L89)
958
- * [returns token_requests data](./spec/acceptance/rest/stats_spec.rb#L94)
959
- * [returns stat objects with #interval_granularity equal to :minute](./spec/acceptance/rest/stats_spec.rb#L99)
960
- * [returns stat objects with #interval_id matching :start](./spec/acceptance/rest/stats_spec.rb#L103)
961
- * [returns stat objects with #interval_time matching :start Time](./spec/acceptance/rest/stats_spec.rb#L107)
972
+ * [returns zero value for any missing metrics](./spec/acceptance/rest/stats_spec.rb#L54)
973
+ * [returns all aggregated message data](./spec/acceptance/rest/stats_spec.rb#L59)
974
+ * [returns inbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L64)
975
+ * [returns inbound realtime message data](./spec/acceptance/rest/stats_spec.rb#L69)
976
+ * [returns outbound realtime all data](./spec/acceptance/rest/stats_spec.rb#L74)
977
+ * [returns persisted presence all data](./spec/acceptance/rest/stats_spec.rb#L79)
978
+ * [returns connections all data](./spec/acceptance/rest/stats_spec.rb#L84)
979
+ * [returns channels all data](./spec/acceptance/rest/stats_spec.rb#L89)
980
+ * [returns api_requests data](./spec/acceptance/rest/stats_spec.rb#L94)
981
+ * [returns token_requests data](./spec/acceptance/rest/stats_spec.rb#L99)
982
+ * [returns stat objects with #interval_granularity equal to :minute](./spec/acceptance/rest/stats_spec.rb#L104)
983
+ * [returns stat objects with #interval_id matching :start](./spec/acceptance/rest/stats_spec.rb#L108)
984
+ * [returns stat objects with #interval_time matching :start Time](./spec/acceptance/rest/stats_spec.rb#L112)
962
985
  * with :start set to first interval, :limit set to 1 and direction :forwards
963
- * [returns the first interval stats as stats are provided forwards from :start](./spec/acceptance/rest/stats_spec.rb#L117)
964
- * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L121)
986
+ * [returns the first interval stats as stats are provided forwards from :start](./spec/acceptance/rest/stats_spec.rb#L122)
987
+ * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L126)
965
988
  * with :end set to last interval, :limit set to 1 and direction :backwards
966
- * [returns the 3rd interval stats first as stats are provided backwards from :end](./spec/acceptance/rest/stats_spec.rb#L134)
967
- * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L138)
989
+ * [returns the 3rd interval stats first as stats are provided backwards from :end](./spec/acceptance/rest/stats_spec.rb#L139)
990
+ * [returns 3 pages of stats](./spec/acceptance/rest/stats_spec.rb#L143)
968
991
  * by hour
969
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L162)
992
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
970
993
  * by day
971
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L162)
994
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
972
995
  * by month
973
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L162)
996
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
974
997
 
975
998
  ### Ably::Rest::Client#time
976
999
  _(see [spec/acceptance/rest/time_spec.rb](./spec/acceptance/rest/time_spec.rb))_
@@ -1249,36 +1272,39 @@ _(see [spec/unit/models/message_spec.rb](./spec/unit/models/message_spec.rb))_
1249
1272
 
1250
1273
  ### Ably::Models::PaginatedResource
1251
1274
  _(see [spec/unit/models/paginated_resource_spec.rb](./spec/unit/models/paginated_resource_spec.rb))_
1252
- * [returns correct length from body](./spec/unit/models/paginated_resource_spec.rb#L30)
1253
- * [supports alias methods for length](./spec/unit/models/paginated_resource_spec.rb#L34)
1254
- * [is Enumerable](./spec/unit/models/paginated_resource_spec.rb#L39)
1255
- * [is iterable](./spec/unit/models/paginated_resource_spec.rb#L43)
1256
- * [provides [] accessor method](./spec/unit/models/paginated_resource_spec.rb#L61)
1257
- * [#first gets the first item in page](./spec/unit/models/paginated_resource_spec.rb#L67)
1258
- * [#last gets the last item in page](./spec/unit/models/paginated_resource_spec.rb#L71)
1259
- * #each
1260
- * [returns an enumerator](./spec/unit/models/paginated_resource_spec.rb#L48)
1261
- * [yields each item](./spec/unit/models/paginated_resource_spec.rb#L52)
1275
+ * #items
1276
+ * [returns correct length from body](./spec/unit/models/paginated_resource_spec.rb#L31)
1277
+ * [is Enumerable](./spec/unit/models/paginated_resource_spec.rb#L35)
1278
+ * [is iterable](./spec/unit/models/paginated_resource_spec.rb#L39)
1279
+ * [provides [] accessor method](./spec/unit/models/paginated_resource_spec.rb#L57)
1280
+ * [#first gets the first item in page](./spec/unit/models/paginated_resource_spec.rb#L63)
1281
+ * [#last gets the last item in page](./spec/unit/models/paginated_resource_spec.rb#L67)
1282
+ * #each
1283
+ * [returns an enumerator](./spec/unit/models/paginated_resource_spec.rb#L44)
1284
+ * [yields each item](./spec/unit/models/paginated_resource_spec.rb#L48)
1262
1285
  * with non paged http response
1263
- * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L175)
1264
- * [is the last page](./spec/unit/models/paginated_resource_spec.rb#L179)
1265
- * [does not support pagination](./spec/unit/models/paginated_resource_spec.rb#L183)
1266
- * [raises an exception when accessing next page](./spec/unit/models/paginated_resource_spec.rb#L187)
1267
- * [raises an exception when accessing first page](./spec/unit/models/paginated_resource_spec.rb#L191)
1286
+ * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L172)
1287
+ * [is the last page](./spec/unit/models/paginated_resource_spec.rb#L176)
1288
+ * [does not have next page](./spec/unit/models/paginated_resource_spec.rb#L180)
1289
+ * [does not support pagination](./spec/unit/models/paginated_resource_spec.rb#L184)
1290
+ * [returns nil when accessing next page](./spec/unit/models/paginated_resource_spec.rb#L188)
1291
+ * [returns nil when accessing first page](./spec/unit/models/paginated_resource_spec.rb#L192)
1268
1292
  * with paged http response
1269
- * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L209)
1270
- * [is not the last page](./spec/unit/models/paginated_resource_spec.rb#L213)
1271
- * [supports pagination](./spec/unit/models/paginated_resource_spec.rb#L217)
1293
+ * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L210)
1294
+ * [has next page](./spec/unit/models/paginated_resource_spec.rb#L214)
1295
+ * [is not the last page](./spec/unit/models/paginated_resource_spec.rb#L218)
1296
+ * [supports pagination](./spec/unit/models/paginated_resource_spec.rb#L222)
1272
1297
  * accessing next page
1273
- * [returns another PaginatedResource](./spec/unit/models/paginated_resource_spec.rb#L245)
1274
- * [retrieves the next page of results](./spec/unit/models/paginated_resource_spec.rb#L249)
1275
- * [is not the first page](./spec/unit/models/paginated_resource_spec.rb#L254)
1276
- * [is the last page](./spec/unit/models/paginated_resource_spec.rb#L258)
1277
- * [raises an exception if trying to access the last page when it is the last page](./spec/unit/models/paginated_resource_spec.rb#L262)
1298
+ * [returns another PaginatedResource](./spec/unit/models/paginated_resource_spec.rb#L250)
1299
+ * [retrieves the next page of results](./spec/unit/models/paginated_resource_spec.rb#L254)
1300
+ * [is not the first page](./spec/unit/models/paginated_resource_spec.rb#L259)
1301
+ * [does not have a next page](./spec/unit/models/paginated_resource_spec.rb#L263)
1302
+ * [is the last page](./spec/unit/models/paginated_resource_spec.rb#L267)
1303
+ * [returns nil when trying to access the last page when it is the last page](./spec/unit/models/paginated_resource_spec.rb#L271)
1278
1304
  * and then first page
1279
- * [returns a PaginatedResource](./spec/unit/models/paginated_resource_spec.rb#L273)
1280
- * [retrieves the first page of results](./spec/unit/models/paginated_resource_spec.rb#L277)
1281
- * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L281)
1305
+ * [returns a PaginatedResource](./spec/unit/models/paginated_resource_spec.rb#L282)
1306
+ * [retrieves the first page of results](./spec/unit/models/paginated_resource_spec.rb#L286)
1307
+ * [is the first page](./spec/unit/models/paginated_resource_spec.rb#L290)
1282
1308
 
1283
1309
  ### Ably::Models::PresenceMessage
1284
1310
  _(see [spec/unit/models/presence_message_spec.rb](./spec/unit/models/presence_message_spec.rb))_
@@ -1434,62 +1460,135 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
1434
1460
  * with error
1435
1461
  * [returns a valid ErrorInfo object](./spec/unit/models/protocol_message_spec.rb#L261)
1436
1462
 
1437
- ### Ably::Models::Stat
1463
+ ### Ably::Models::Stats
1438
1464
  _(see [spec/unit/models/stat_spec.rb](./spec/unit/models/stat_spec.rb))_
1439
- * behaves like a model
1440
- * attributes
1441
- * #interval_id
1442
- * [retrieves attribute :interval_id](./spec/shared/model_behaviour.rb#L15)
1443
- * #all
1444
- * [retrieves attribute :all](./spec/shared/model_behaviour.rb#L15)
1445
- * #inbound
1446
- * [retrieves attribute :inbound](./spec/shared/model_behaviour.rb#L15)
1447
- * #outbound
1448
- * [retrieves attribute :outbound](./spec/shared/model_behaviour.rb#L15)
1449
- * #persisted
1450
- * [retrieves attribute :persisted](./spec/shared/model_behaviour.rb#L15)
1451
- * #connections
1452
- * [retrieves attribute :connections](./spec/shared/model_behaviour.rb#L15)
1453
- * #channels
1454
- * [retrieves attribute :channels](./spec/shared/model_behaviour.rb#L15)
1455
- * #api_requests
1456
- * [retrieves attribute :api_requests](./spec/shared/model_behaviour.rb#L15)
1457
- * #token_requests
1458
- * [retrieves attribute :token_requests](./spec/shared/model_behaviour.rb#L15)
1459
- * #==
1460
- * [is true when attributes are the same](./spec/shared/model_behaviour.rb#L41)
1461
- * [is false when attributes are not the same](./spec/shared/model_behaviour.rb#L46)
1462
- * [is false when class type differs](./spec/shared/model_behaviour.rb#L50)
1463
- * is immutable
1464
- * [prevents changes](./spec/shared/model_behaviour.rb#L76)
1465
- * [dups options](./spec/shared/model_behaviour.rb#L80)
1465
+ * #all stats
1466
+ * [returns a MessageTypes object](./spec/unit/models/stat_spec.rb#L17)
1467
+ * [returns value for message counts](./spec/unit/models/stat_spec.rb#L21)
1468
+ * [returns value for all data transferred](./spec/unit/models/stat_spec.rb#L25)
1469
+ * [returns zero for empty values](./spec/unit/models/stat_spec.rb#L29)
1470
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L33)
1471
+ * #all
1472
+ * [is a MessageCount object](./spec/unit/models/stat_spec.rb#L39)
1473
+ * #presence
1474
+ * [is a MessageCount object](./spec/unit/models/stat_spec.rb#L39)
1475
+ * #messages
1476
+ * [is a MessageCount object](./spec/unit/models/stat_spec.rb#L39)
1477
+ * #persisted stats
1478
+ * [returns a MessageTypes object](./spec/unit/models/stat_spec.rb#L17)
1479
+ * [returns value for message counts](./spec/unit/models/stat_spec.rb#L21)
1480
+ * [returns value for all data transferred](./spec/unit/models/stat_spec.rb#L25)
1481
+ * [returns zero for empty values](./spec/unit/models/stat_spec.rb#L29)
1482
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L33)
1483
+ * #all
1484
+ * [is a MessageCount object](./spec/unit/models/stat_spec.rb#L39)
1485
+ * #presence
1486
+ * [is a MessageCount object](./spec/unit/models/stat_spec.rb#L39)
1487
+ * #messages
1488
+ * [is a MessageCount object](./spec/unit/models/stat_spec.rb#L39)
1489
+ * #inbound stats
1490
+ * [returns a MessageTraffic object](./spec/unit/models/stat_spec.rb#L59)
1491
+ * [returns value for realtime message counts](./spec/unit/models/stat_spec.rb#L63)
1492
+ * [returns value for all presence data](./spec/unit/models/stat_spec.rb#L67)
1493
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L71)
1494
+ * #realtime
1495
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1496
+ * #rest
1497
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1498
+ * #webhook
1499
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1500
+ * #all
1501
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1502
+ * #outbound stats
1503
+ * [returns a MessageTraffic object](./spec/unit/models/stat_spec.rb#L59)
1504
+ * [returns value for realtime message counts](./spec/unit/models/stat_spec.rb#L63)
1505
+ * [returns value for all presence data](./spec/unit/models/stat_spec.rb#L67)
1506
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L71)
1507
+ * #realtime
1508
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1509
+ * #rest
1510
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1511
+ * #webhook
1512
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1513
+ * #all
1514
+ * [is a MessageTypes object](./spec/unit/models/stat_spec.rb#L77)
1515
+ * #connections stats
1516
+ * [returns a ConnectionTypes object](./spec/unit/models/stat_spec.rb#L91)
1517
+ * [returns value for tls opened counts](./spec/unit/models/stat_spec.rb#L95)
1518
+ * [returns value for all peak connections](./spec/unit/models/stat_spec.rb#L99)
1519
+ * [returns zero for empty values](./spec/unit/models/stat_spec.rb#L103)
1520
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L107)
1521
+ * #tls
1522
+ * [is a ResourceCount object](./spec/unit/models/stat_spec.rb#L113)
1523
+ * #plain
1524
+ * [is a ResourceCount object](./spec/unit/models/stat_spec.rb#L113)
1525
+ * #all
1526
+ * [is a ResourceCount object](./spec/unit/models/stat_spec.rb#L113)
1527
+ * #channels stats
1528
+ * [returns a ResourceCount object](./spec/unit/models/stat_spec.rb#L126)
1529
+ * [returns value for opened counts](./spec/unit/models/stat_spec.rb#L130)
1530
+ * [returns value for peak channels](./spec/unit/models/stat_spec.rb#L134)
1531
+ * [returns zero for empty values](./spec/unit/models/stat_spec.rb#L138)
1532
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L142)
1533
+ * #opened
1534
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L148)
1535
+ * #peak
1536
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L148)
1537
+ * #mean
1538
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L148)
1539
+ * #min
1540
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L148)
1541
+ * #refused
1542
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L148)
1543
+ * #api_requests stats
1544
+ * [returns a RequestCount object](./spec/unit/models/stat_spec.rb#L164)
1545
+ * [returns value for succeeded](./spec/unit/models/stat_spec.rb#L168)
1546
+ * [returns value for failed](./spec/unit/models/stat_spec.rb#L172)
1547
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L176)
1548
+ * #succeeded
1549
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L182)
1550
+ * #failed
1551
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L182)
1552
+ * #refused
1553
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L182)
1554
+ * #token_requests stats
1555
+ * [returns a RequestCount object](./spec/unit/models/stat_spec.rb#L164)
1556
+ * [returns value for succeeded](./spec/unit/models/stat_spec.rb#L168)
1557
+ * [returns value for failed](./spec/unit/models/stat_spec.rb#L172)
1558
+ * [raises an exception for unknown attributes](./spec/unit/models/stat_spec.rb#L176)
1559
+ * #succeeded
1560
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L182)
1561
+ * #failed
1562
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L182)
1563
+ * #refused
1564
+ * [is a Integer object](./spec/unit/models/stat_spec.rb#L182)
1466
1565
  * #interval_granularity
1467
- * [returns the granularity of the interval_id](./spec/unit/models/stat_spec.rb#L17)
1566
+ * [returns the granularity of the interval_id](./spec/unit/models/stat_spec.rb#L193)
1468
1567
  * #interval_time
1469
- * [returns a Time object representing the start of the interval](./spec/unit/models/stat_spec.rb#L25)
1568
+ * [returns a Time object representing the start of the interval](./spec/unit/models/stat_spec.rb#L201)
1470
1569
  * class methods
1471
1570
  * #to_interval_id
1472
1571
  * when time zone of time argument is UTC
1473
- * [converts time 2014-02-03:05:06 with granularity :month into 2014-02](./spec/unit/models/stat_spec.rb#L33)
1474
- * [converts time 2014-02-03:05:06 with granularity :day into 2014-02-03](./spec/unit/models/stat_spec.rb#L37)
1475
- * [converts time 2014-02-03:05:06 with granularity :hour into 2014-02-03:05](./spec/unit/models/stat_spec.rb#L41)
1476
- * [converts time 2014-02-03:05:06 with granularity :minute into 2014-02-03:05:06](./spec/unit/models/stat_spec.rb#L45)
1477
- * [fails with invalid granularity](./spec/unit/models/stat_spec.rb#L49)
1478
- * [fails with invalid time](./spec/unit/models/stat_spec.rb#L53)
1572
+ * [converts time 2014-02-03:05:06 with granularity :month into 2014-02](./spec/unit/models/stat_spec.rb#L209)
1573
+ * [converts time 2014-02-03:05:06 with granularity :day into 2014-02-03](./spec/unit/models/stat_spec.rb#L213)
1574
+ * [converts time 2014-02-03:05:06 with granularity :hour into 2014-02-03:05](./spec/unit/models/stat_spec.rb#L217)
1575
+ * [converts time 2014-02-03:05:06 with granularity :minute into 2014-02-03:05:06](./spec/unit/models/stat_spec.rb#L221)
1576
+ * [fails with invalid granularity](./spec/unit/models/stat_spec.rb#L225)
1577
+ * [fails with invalid time](./spec/unit/models/stat_spec.rb#L229)
1479
1578
  * when time zone of time argument is +02:00
1480
- * [converts time 2014-02-03:06 with granularity :hour into 2014-02-03:04 at UTC +00:00](./spec/unit/models/stat_spec.rb#L59)
1579
+ * [converts time 2014-02-03:06 with granularity :hour into 2014-02-03:04 at UTC +00:00](./spec/unit/models/stat_spec.rb#L235)
1481
1580
  * #from_interval_id
1482
- * [converts a month interval_id 2014-02 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L66)
1483
- * [converts a day interval_id 2014-02-03 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L71)
1484
- * [converts an hour interval_id 2014-02-03:05 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L76)
1485
- * [converts a minute interval_id 2014-02-03:05:06 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L81)
1486
- * [fails with an invalid interval_id 14-20](./spec/unit/models/stat_spec.rb#L86)
1581
+ * [converts a month interval_id 2014-02 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L242)
1582
+ * [converts a day interval_id 2014-02-03 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L247)
1583
+ * [converts an hour interval_id 2014-02-03:05 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L252)
1584
+ * [converts a minute interval_id 2014-02-03:05:06 into a Time object in UTC 0](./spec/unit/models/stat_spec.rb#L257)
1585
+ * [fails with an invalid interval_id 14-20](./spec/unit/models/stat_spec.rb#L262)
1487
1586
  * #granularity_from_interval_id
1488
- * [returns a :month interval_id for 2014-02](./spec/unit/models/stat_spec.rb#L92)
1489
- * [returns a :day interval_id for 2014-02-03](./spec/unit/models/stat_spec.rb#L96)
1490
- * [returns a :hour interval_id for 2014-02-03:05](./spec/unit/models/stat_spec.rb#L100)
1491
- * [returns a :minute interval_id for 2014-02-03:05:06](./spec/unit/models/stat_spec.rb#L104)
1492
- * [fails with an invalid interval_id 14-20](./spec/unit/models/stat_spec.rb#L108)
1587
+ * [returns a :month interval_id for 2014-02](./spec/unit/models/stat_spec.rb#L268)
1588
+ * [returns a :day interval_id for 2014-02-03](./spec/unit/models/stat_spec.rb#L272)
1589
+ * [returns a :hour interval_id for 2014-02-03:05](./spec/unit/models/stat_spec.rb#L276)
1590
+ * [returns a :minute interval_id for 2014-02-03:05:06](./spec/unit/models/stat_spec.rb#L280)
1591
+ * [fails with an invalid interval_id 14-20](./spec/unit/models/stat_spec.rb#L284)
1493
1592
 
1494
1593
  ### Ably::Models::Token
1495
1594
  _(see [spec/unit/models/token_spec.rb](./spec/unit/models/token_spec.rb))_
@@ -1648,50 +1747,53 @@ _(see [spec/unit/realtime/client_spec.rb](./spec/unit/realtime/client_spec.rb))_
1648
1747
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L28)
1649
1748
  * nil
1650
1749
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L36)
1651
- * api_key: "invalid"
1750
+ * key: "invalid"
1652
1751
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L44)
1653
- * api_key: "invalid:asdad"
1752
+ * key: "invalid:asdad"
1654
1753
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L52)
1655
- * api_key and key_id
1754
+ * key and key_id
1656
1755
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L60)
1657
- * api_key and key_secret
1756
+ * key and key_secret
1658
1757
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L68)
1659
1758
  * client_id as only option
1660
1759
  * [requires a valid key](./spec/shared/client_initializer_behaviour.rb#L76)
1661
1760
  * with valid arguments
1662
- * api_key only
1761
+ * key only
1663
1762
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
1763
+ * with legacy :api_key only
1764
+ * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L94)
1765
+ * [sets the Auth#key](./spec/shared/client_initializer_behaviour.rb#L98)
1664
1766
  * key_id and key_secret
1665
- * [constructs an api_key](./spec/shared/client_initializer_behaviour.rb#L95)
1767
+ * [constructs an key](./spec/shared/client_initializer_behaviour.rb#L106)
1666
1768
  * with a string key instead of options hash
1667
- * [sets the api_key](./spec/shared/client_initializer_behaviour.rb#L103)
1668
- * [sets the key_id](./spec/shared/client_initializer_behaviour.rb#L107)
1669
- * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L111)
1769
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L114)
1770
+ * [sets the key_id](./spec/shared/client_initializer_behaviour.rb#L118)
1771
+ * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L122)
1670
1772
  * with a string token key instead of options hash
1671
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L119)
1773
+ * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L130)
1672
1774
  * with token
1673
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L127)
1775
+ * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L138)
1674
1776
  * endpoint
1675
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L133)
1777
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L144)
1676
1778
  * with environment option
1677
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L140)
1779
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L151)
1678
1780
  * tls
1679
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L159)
1781
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L170)
1680
1782
  * set to false
1681
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L150)
1682
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L154)
1783
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L161)
1784
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L165)
1683
1785
  * logger
1684
1786
  * default
1685
- * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L166)
1686
- * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L170)
1787
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L177)
1788
+ * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L181)
1687
1789
  * with log_level :none
1688
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L178)
1790
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L189)
1689
1791
  * with custom logger and log_level
1690
- * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L196)
1691
- * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L200)
1792
+ * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L207)
1793
+ * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L211)
1692
1794
  * delegators
1693
- * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L210)
1694
- * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L215)
1795
+ * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L221)
1796
+ * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L226)
1695
1797
  * delegation to the REST Client
1696
1798
  * [passes on the options to the initializer](./spec/unit/realtime/client_spec.rb#L15)
1697
1799
  * for attribute
@@ -1771,7 +1873,7 @@ _(see [spec/unit/realtime/safe_deferrable_spec.rb](./spec/unit/realtime/safe_def
1771
1873
  * #succeed
1772
1874
  * [calls the callbacks defined with #callback, but not the ones added for #errback](./spec/shared/safe_deferrable_behaviour.rb#L61)
1773
1875
 
1774
- ### Ably::Rest::Channels
1876
+ ### Ably::Rest::Channel
1775
1877
  _(see [spec/unit/rest/channel_spec.rb](./spec/unit/rest/channel_spec.rb))_
1776
1878
  * #initializer
1777
1879
  * as UTF_8 string
@@ -1825,63 +1927,66 @@ _(see [spec/unit/rest/client_spec.rb](./spec/unit/rest/client_spec.rb))_
1825
1927
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L28)
1826
1928
  * nil
1827
1929
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L36)
1828
- * api_key: "invalid"
1930
+ * key: "invalid"
1829
1931
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L44)
1830
- * api_key: "invalid:asdad"
1932
+ * key: "invalid:asdad"
1831
1933
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L52)
1832
- * api_key and key_id
1934
+ * key and key_id
1833
1935
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L60)
1834
- * api_key and key_secret
1936
+ * key and key_secret
1835
1937
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L68)
1836
1938
  * client_id as only option
1837
1939
  * [requires a valid key](./spec/shared/client_initializer_behaviour.rb#L76)
1838
1940
  * with valid arguments
1839
- * api_key only
1941
+ * key only
1840
1942
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
1943
+ * with legacy :api_key only
1944
+ * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L94)
1945
+ * [sets the Auth#key](./spec/shared/client_initializer_behaviour.rb#L98)
1841
1946
  * key_id and key_secret
1842
- * [constructs an api_key](./spec/shared/client_initializer_behaviour.rb#L95)
1947
+ * [constructs an key](./spec/shared/client_initializer_behaviour.rb#L106)
1843
1948
  * with a string key instead of options hash
1844
- * [sets the api_key](./spec/shared/client_initializer_behaviour.rb#L103)
1845
- * [sets the key_id](./spec/shared/client_initializer_behaviour.rb#L107)
1846
- * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L111)
1949
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L114)
1950
+ * [sets the key_id](./spec/shared/client_initializer_behaviour.rb#L118)
1951
+ * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L122)
1847
1952
  * with a string token key instead of options hash
1848
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L119)
1953
+ * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L130)
1849
1954
  * with token
1850
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L127)
1955
+ * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L138)
1851
1956
  * endpoint
1852
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L133)
1957
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L144)
1853
1958
  * with environment option
1854
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L140)
1959
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L151)
1855
1960
  * tls
1856
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L159)
1961
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L170)
1857
1962
  * set to false
1858
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L150)
1859
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L154)
1963
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L161)
1964
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L165)
1860
1965
  * logger
1861
1966
  * default
1862
- * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L166)
1863
- * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L170)
1967
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L177)
1968
+ * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L181)
1864
1969
  * with log_level :none
1865
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L178)
1970
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L189)
1866
1971
  * with custom logger and log_level
1867
- * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L196)
1868
- * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L200)
1972
+ * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L207)
1973
+ * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L211)
1869
1974
  * delegators
1870
- * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L210)
1871
- * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L215)
1975
+ * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L221)
1976
+ * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L226)
1872
1977
  * initializer options
1873
1978
  * TLS
1874
1979
  * disabled
1875
1980
  * [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)
1876
1981
  * :use_token_auth
1877
1982
  * set to false
1878
- * with an api_key with :tls => false
1983
+ * with an key with :tls => false
1879
1984
  * [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)
1880
- * without an api_key
1881
- * [fails as an api_key is required if not using token auth](./spec/unit/rest/client_spec.rb#L36)
1985
+ * without an key
1986
+ * [fails as an key is required if not using token auth](./spec/unit/rest/client_spec.rb#L36)
1882
1987
  * set to true
1883
- * without an api_key or token_id
1884
- * [fails as an api_key is required to issue tokens](./spec/unit/rest/client_spec.rb#L46)
1988
+ * without an key or token_id
1989
+ * [fails as an key is required to issue tokens](./spec/unit/rest/client_spec.rb#L46)
1885
1990
 
1886
1991
  ### Ably::Rest
1887
1992
  _(see [spec/unit/rest/rest_spec.rb](./spec/unit/rest/rest_spec.rb))_
@@ -1922,6 +2027,6 @@ _(see [spec/unit/util/pub_sub_spec.rb](./spec/unit/util/pub_sub_spec.rb))_
1922
2027
 
1923
2028
  ## Test summary
1924
2029
 
1925
- * Passing tests: 942
2030
+ * Passing tests: 1011
1926
2031
  * Pending tests: 7
1927
2032
  * Failing tests: 0