ably-rest 0.7.5 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +2 -0
  3. data/README.md +41 -15
  4. data/SPEC.md +654 -518
  5. data/lib/submodules/ably-ruby/.gitignore +1 -0
  6. data/lib/submodules/ably-ruby/.gitmodules +3 -0
  7. data/lib/submodules/ably-ruby/README.md +54 -26
  8. data/lib/submodules/ably-ruby/SPEC.md +468 -322
  9. data/lib/submodules/ably-ruby/ably.gemspec +4 -2
  10. data/lib/submodules/ably-ruby/lib/ably/auth.rb +185 -131
  11. data/lib/submodules/ably-ruby/lib/ably/models/message.rb +1 -1
  12. data/lib/submodules/ably-ruby/lib/ably/models/paginated_resource.rb +31 -44
  13. data/lib/submodules/ably-ruby/lib/ably/models/presence_message.rb +2 -2
  14. data/lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb +1 -2
  15. data/lib/submodules/ably-ruby/lib/ably/models/stat.rb +67 -24
  16. data/lib/submodules/ably-ruby/lib/ably/models/stats_types.rb +131 -0
  17. data/lib/submodules/ably-ruby/lib/ably/models/token_details.rb +101 -0
  18. data/lib/submodules/ably-ruby/lib/ably/models/token_request.rb +108 -0
  19. data/lib/submodules/ably-ruby/lib/ably/modules/async_wrapper.rb +3 -2
  20. data/lib/submodules/ably-ruby/lib/ably/modules/http_helpers.rb +1 -1
  21. data/lib/submodules/ably-ruby/lib/ably/modules/message_emitter.rb +2 -2
  22. data/lib/submodules/ably-ruby/lib/ably/realtime.rb +3 -7
  23. data/lib/submodules/ably-ruby/lib/ably/realtime/channel.rb +32 -5
  24. data/lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb +1 -0
  25. data/lib/submodules/ably-ruby/lib/ably/realtime/client.rb +4 -8
  26. data/lib/submodules/ably-ruby/lib/ably/realtime/connection.rb +5 -3
  27. data/lib/submodules/ably-ruby/lib/ably/realtime/presence.rb +12 -1
  28. data/lib/submodules/ably-ruby/lib/ably/rest.rb +3 -7
  29. data/lib/submodules/ably-ruby/lib/ably/rest/channel.rb +13 -10
  30. data/lib/submodules/ably-ruby/lib/ably/rest/client.rb +19 -20
  31. data/lib/submodules/ably-ruby/lib/ably/rest/presence.rb +14 -12
  32. data/lib/submodules/ably-ruby/lib/ably/version.rb +1 -1
  33. data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_history_spec.rb +74 -23
  34. data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb +3 -3
  35. data/lib/submodules/ably-ruby/spec/acceptance/realtime/client_spec.rb +18 -18
  36. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_failures_spec.rb +5 -5
  37. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_spec.rb +12 -12
  38. data/lib/submodules/ably-ruby/spec/acceptance/realtime/message_spec.rb +5 -5
  39. data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_history_spec.rb +56 -13
  40. data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_spec.rb +8 -8
  41. data/lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb +1 -1
  42. data/lib/submodules/ably-ruby/spec/acceptance/realtime/time_spec.rb +1 -1
  43. data/lib/submodules/ably-ruby/spec/acceptance/rest/auth_spec.rb +262 -158
  44. data/lib/submodules/ably-ruby/spec/acceptance/rest/base_spec.rb +11 -9
  45. data/lib/submodules/ably-ruby/spec/acceptance/rest/channel_spec.rb +28 -21
  46. data/lib/submodules/ably-ruby/spec/acceptance/rest/channels_spec.rb +1 -1
  47. data/lib/submodules/ably-ruby/spec/acceptance/rest/client_spec.rb +30 -27
  48. data/lib/submodules/ably-ruby/spec/acceptance/rest/encoders_spec.rb +1 -1
  49. data/lib/submodules/ably-ruby/spec/acceptance/rest/message_spec.rb +10 -10
  50. data/lib/submodules/ably-ruby/spec/acceptance/rest/presence_spec.rb +93 -56
  51. data/lib/submodules/ably-ruby/spec/acceptance/rest/stats_spec.rb +50 -45
  52. data/lib/submodules/ably-ruby/spec/acceptance/rest/time_spec.rb +1 -1
  53. data/lib/submodules/ably-ruby/spec/rspec_config.rb +3 -2
  54. data/lib/submodules/ably-ruby/spec/shared/client_initializer_behaviour.rb +36 -28
  55. data/lib/submodules/ably-ruby/spec/spec_helper.rb +3 -0
  56. data/lib/submodules/ably-ruby/spec/support/api_helper.rb +3 -3
  57. data/lib/submodules/ably-ruby/spec/support/markdown_spec_formatter.rb +1 -1
  58. data/lib/submodules/ably-ruby/spec/support/test_app.rb +20 -33
  59. data/lib/submodules/ably-ruby/spec/unit/auth_spec.rb +18 -1
  60. data/lib/submodules/ably-ruby/spec/unit/models/paginated_resource_spec.rb +81 -72
  61. data/lib/submodules/ably-ruby/spec/unit/models/stats_spec.rb +289 -0
  62. data/lib/submodules/ably-ruby/spec/unit/models/token_details_spec.rb +111 -0
  63. data/lib/submodules/ably-ruby/spec/unit/models/token_request_spec.rb +110 -0
  64. data/lib/submodules/ably-ruby/spec/unit/modules/async_wrapper_spec.rb +1 -1
  65. data/lib/submodules/ably-ruby/spec/unit/realtime/client_spec.rb +1 -1
  66. data/lib/submodules/ably-ruby/spec/unit/realtime/realtime_spec.rb +1 -1
  67. data/lib/submodules/ably-ruby/spec/unit/rest/channel_spec.rb +1 -1
  68. data/lib/submodules/ably-ruby/spec/unit/rest/client_spec.rb +8 -8
  69. data/lib/submodules/ably-ruby/spec/unit/rest/rest_spec.rb +1 -1
  70. data/lib/submodules/ably-ruby/spec/unit/util/crypto_spec.rb +1 -1
  71. metadata +9 -7
  72. data/lib/submodules/ably-ruby/lib/ably/models/token.rb +0 -74
  73. data/lib/submodules/ably-ruby/spec/resources/crypto-data-128.json +0 -56
  74. data/lib/submodules/ably-ruby/spec/resources/crypto-data-256.json +0 -56
  75. data/lib/submodules/ably-ruby/spec/unit/models/stat_spec.rb +0 -113
  76. data/lib/submodules/ably-ruby/spec/unit/models/token_spec.rb +0 -86
@@ -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
@@ -1,13 +1,14 @@
1
- # [Ably](https://ably.io)
1
+ # [Ably](https://www.ably.io)
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://www.ably.io), the realtime messaging service.
7
8
 
8
9
  ## Documentation
9
10
 
10
- Visit https://ably.io/documentation for a complete API reference and more examples.
11
+ Visit https://www.ably.io/documentation for a complete API reference and more examples.
11
12
 
12
13
  ## Installation
13
14
 
@@ -40,7 +41,11 @@ 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
+ # basic auth with an API key
45
+ client = Ably::Realtime.new(key: 'xxxxx')
46
+
47
+ # using token auth
48
+ client = Ably::Realtime.new(token: 'xxxxx')
44
49
  ```
45
50
 
46
51
  ### Connection
@@ -67,7 +72,7 @@ end
67
72
  Given:
68
73
 
69
74
  ```ruby
70
- channel = client.channel("test")
75
+ channel = client.channel('test')
71
76
  ```
72
77
 
73
78
  Subscribe to all events:
@@ -82,7 +87,7 @@ end
82
87
  Only certain events:
83
88
 
84
89
  ```ruby
85
- channel.subscribe("myEvent") do |message|
90
+ channel.subscribe('myEvent') do |message|
86
91
  message[:name] #=> "myEvent"
87
92
  message[:data] #=> "myData"
88
93
  end
@@ -91,17 +96,19 @@ end
91
96
  ### Publishing to a channel
92
97
 
93
98
  ```ruby
94
- channel.publish("greeting", "Hello World!")
99
+ channel.publish('greeting', 'Hello World!')
95
100
  ```
96
101
 
97
102
  ### Querying the History
98
103
 
99
104
  ```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
105
+ channel.history do |messages_page|
106
+ messages_page #=> #<Ably::Models::PaginatedResource ...>
107
+ messages_page.items.first # #<Ably::Models::Message ...>
108
+ messages_page.items.first.data # payload for the message
109
+ messages_page.items.length # number of messages in the current page of history
110
+ messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
111
+ messages_page.has_next? # false, there are more pages
105
112
  end
106
113
  ```
107
114
 
@@ -116,11 +123,11 @@ end
116
123
  ### Querying the Presence History
117
124
 
118
125
  ```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
126
+ channel.presence.history do |presence_page|
127
+ presence_page.items.first.action # Any of :enter, :update or :leave
128
+ presence_page.items.first.client_id # client ID of member
129
+ presence_page.items.first.data # optional data payload of member
130
+ presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
124
131
  end
125
132
  ```
126
133
 
@@ -133,41 +140,54 @@ Unlike the Realtime API, all calls are synchronous and are not run within an [Ev
133
140
  All examples assume a client and/or channel has been created as follows:
134
141
 
135
142
  ```ruby
136
- client = Ably::Rest.new(api_key: "xxxxx")
143
+ client = Ably::Rest.new(key: 'xxxxx')
137
144
  channel = client.channel('test')
138
145
  ```
139
146
 
140
147
  ### Publishing a message to a channel
141
148
 
142
149
  ```ruby
143
- channel.publish("myEvent", "Hello!") #=> true
150
+ channel.publish('myEvent', 'Hello!') #=> true
144
151
  ```
145
152
 
146
153
  ### Querying the History
147
154
 
148
155
  ```ruby
149
- channel.history #=> #<Ably::Models::PaginatedResource ...>
156
+ messages_page = channel.history #=> #<Ably::Models::PaginatedResource ...>
157
+ messages_page.items.first #=> #<Ably::Models::Message ...>
158
+ messages_page.items.first.data # payload for the message
159
+ messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
160
+ messages_page.has_next? # false, there are more pages
150
161
  ```
151
162
 
152
163
  ### Presence on a channel
153
164
 
154
165
  ```ruby
155
- channel.presence.get # => #<Ably::Models::PaginatedResource ...>
166
+ members_page = channel.presence.get # => #<Ably::Models::PaginatedResource ...>
167
+ members_page.items.first # first member present in this page => #<Ably::Models::PresenceMessage ...>
168
+ members_page.items.first.client_id # client ID of first member present
169
+ members_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
170
+ members_page.has_next? # false, there are more pages
156
171
  ```
157
172
 
158
173
  ### Querying the Presence History
159
174
 
160
175
  ```ruby
161
- channel.presence.history # => #<Ably::Models::PaginatedResource ...>
176
+ presence_page = channel.presence.history #=> #<Ably::Models::PaginatedResource ...>
177
+ presence_page.items.first #=> #<Ably::Models::PresenceMessage ...>
178
+ presence_page.items.first.client_id # client ID of first member
179
+ presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
162
180
  ```
163
181
 
164
182
  ### Generate Token and Token Request
165
183
 
166
184
  ```ruby
167
- client.auth.request_token
168
- # => #<Ably::Models::Token ...>
185
+ token_details = client.auth.request_token
186
+ # => #<Ably::Models::TokenDetails ...>
187
+ token_details.token # => "xVLyHw.CLchevH3hF....MDh9ZC_Q"
188
+ client = Ably::Rest.new(token: token_details.token)
169
189
 
170
- client.auth.create_token_request
190
+ token = client.auth.create_token_request
171
191
  # => {"id"=>...,
172
192
  # "clientId"=>nil,
173
193
  # "ttl"=>3600,
@@ -180,7 +200,15 @@ client.auth.create_token_request
180
200
  ### Fetching your application's stats
181
201
 
182
202
  ```ruby
183
- client.stats #=> PaginatedResource [{:channels=>..., :apiRequests=>..., ...}]
203
+ stats_page = client.stats #=> #<Ably::Models::PaginatedResource ...>
204
+ stats_page.items.first = #<Ably::Models::Stats ...>
205
+ stats_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
206
+ ```
207
+
208
+ ### Fetching the Ably service time
209
+
210
+ ```ruby
211
+ client.time #=> 2013-12-12 14:23:34 +0000
184
212
  ```
185
213
 
186
214
  ## Dependencies
@@ -1,22 +1,27 @@
1
- # Ably Real-time & REST Client Library 0.7.3 Specification
1
+ # Ably Realtime & REST Client Library 0.8.0 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,28 +109,28 @@ _(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)
111
116
  * token auth
112
117
  * with TLS enabled
113
- * and a pre-generated Token provided with the :token_id option
118
+ * and a pre-generated Token provided with the :token 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
- * and a pre-generated Token provided with the :token_id option
125
+ * and a pre-generated Token provided with the :token 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)
126
- * with token_request_block
127
- * [calls the block](./spec/acceptance/realtime/client_spec.rb#L102)
128
- * [uses the token request when requesting a new token](./spec/acceptance/realtime/client_spec.rb#L109)
131
+ * with a Proc for the :auth_callback option
132
+ * [calls the Proc](./spec/acceptance/realtime/client_spec.rb#L102)
133
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/realtime/client_spec.rb#L109)
129
134
 
130
135
  ### Ably::Realtime::Connection failures
131
136
  _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/realtime/connection_failures_spec.rb))_
@@ -134,7 +139,7 @@ _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/r
134
139
  * when API key is invalid
135
140
  * with invalid app part of the key
136
141
  * [enters the failed state and returns a not found error](./spec/acceptance/realtime/connection_failures_spec.rb#L26)
137
- * with invalid key ID part of the key
142
+ * with invalid key name part of the key
138
143
  * [enters the failed state and returns an authorization error](./spec/acceptance/realtime/connection_failures_spec.rb#L40)
139
144
  * automatic connection retry
140
145
  * with invalid WebSocket host
@@ -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))_
@@ -593,110 +603,118 @@ _(see [spec/acceptance/rest/auth_spec.rb](./spec/acceptance/rest/auth_spec.rb))_
593
603
  * using JSON and MsgPack protocol
594
604
  * [has immutable options](./spec/acceptance/rest/auth_spec.rb#L54)
595
605
  * #request_token
596
- * [returns a valid requested token in the expected format with valid issued_at and expires_at attributes](./spec/acceptance/rest/auth_spec.rb#L69)
606
+ * [returns a valid requested token in the expected format with valid issued and expires attributes](./spec/acceptance/rest/auth_spec.rb#L69)
597
607
  * with option :client_id
598
- * [overrides default and uses camelCase notation for all attributes](./spec/acceptance/rest/auth_spec.rb#L95)
608
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
599
609
  * with option :capability
600
- * [overrides default and uses camelCase notation for all attributes](./spec/acceptance/rest/auth_spec.rb#L95)
610
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
601
611
  * with option :nonce
602
- * [overrides default and uses camelCase notation for all attributes](./spec/acceptance/rest/auth_spec.rb#L95)
612
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
603
613
  * with option :timestamp
604
- * [overrides default and uses camelCase notation for all attributes](./spec/acceptance/rest/auth_spec.rb#L95)
614
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
605
615
  * with option :ttl
606
- * [overrides default and uses camelCase notation for all attributes](./spec/acceptance/rest/auth_spec.rb#L95)
607
- * with :key_id & :key_secret options
608
- * [key_id is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L124)
616
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
617
+ * with :key option
618
+ * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L129)
619
+ * with :key_name & :key_secret options
620
+ * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L158)
609
621
  * with :query_time option
610
- * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L132)
622
+ * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L166)
611
623
  * without :query_time option
612
- * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L141)
624
+ * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L175)
613
625
  * with :auth_url option
614
626
  * when response from :auth_url is a valid token request
615
- * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L188)
616
- * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L193)
627
+ * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L223)
628
+ * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L228)
617
629
  * with :query_params
618
- * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L200)
630
+ * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L235)
619
631
  * with :headers
620
- * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L208)
632
+ * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L243)
621
633
  * with POST
622
- * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L216)
623
- * when response from :auth_url is a token
624
- * [returns a Token created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L240)
634
+ * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L251)
635
+ * when response from :auth_url is a token details object
636
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L276)
637
+ * 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#L293)
625
639
  * when response is invalid
626
640
  * 500
627
- * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L255)
641
+ * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L306)
628
642
  * XML
629
- * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L266)
630
- * with token_request_block that returns a token request
631
- * [calls the block when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L284)
632
- * [uses the token request from the block when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L289)
633
- * with token_request_block that returns a token
634
- * [calls the block when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L317)
635
- * [uses the token request from the block when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L322)
643
+ * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L317)
644
+ * with a Proc for the :auth_callback option
645
+ * that returns a TokenRequest
646
+ * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L336)
647
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L341)
648
+ * that returns a TokenDetails JSON object
649
+ * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L370)
650
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L375)
651
+ * 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#L396)
653
+ * 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#L412)
655
+ * with client_id
656
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L444)
636
657
  * before #authorise has been called
637
- * [has no current_token](./spec/acceptance/rest/auth_spec.rb#L334)
658
+ * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L451)
638
659
  * #authorise
639
- * [updates the persisted auth options thare are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L381)
660
+ * [updates the persisted auth options that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L498)
640
661
  * 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)
662
+ * [passes all options to #request_token](./spec/acceptance/rest/auth_spec.rb#L462)
663
+ * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L467)
664
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L471)
644
665
  * 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)
648
- * 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)
666
+ * [does not request a token if current_token_details has not expired](./spec/acceptance/rest/auth_spec.rb#L482)
667
+ * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L487)
668
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L493)
669
+ * with a Proc for the :auth_callback option
670
+ * [calls the Proc](./spec/acceptance/rest/auth_spec.rb#L514)
671
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L518)
651
672
  * for every subsequent #request_token
652
- * without a provided block
653
- * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L407)
673
+ * without a :auth_callback Proc
674
+ * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L524)
654
675
  * 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)
676
+ * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L531)
656
677
  * #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)
678
+ * [uses the key name from the client](./spec/acceptance/rest/auth_spec.rb#L547)
679
+ * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L551)
680
+ * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L555)
660
681
  * 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)
682
+ * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L560)
683
+ * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L565)
663
684
  * with option :ttl
664
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
665
- * with option :capability
666
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
685
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L576)
667
686
  * with option :nonce
668
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
669
- * with option :timestamp
670
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
687
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L576)
671
688
  * with option :client_id
672
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L459)
689
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L576)
673
690
  * with additional invalid attributes
674
- * [are ignored](./spec/acceptance/rest/auth_spec.rb#L467)
691
+ * [are ignored](./spec/acceptance/rest/auth_spec.rb#L584)
675
692
  * 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)
693
+ * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L595)
694
+ * [should raise an exception if key name is missing](./spec/acceptance/rest/auth_spec.rb#L599)
678
695
  * with :query_time option
679
- * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L491)
696
+ * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L608)
680
697
  * with :timestamp option
681
- * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L501)
698
+ * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L618)
682
699
  * signing
683
- * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L518)
700
+ * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L640)
684
701
  * using token authentication
685
- * 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)
702
+ * with :token option
703
+ * [authenticates successfully using the provided :token](./spec/acceptance/rest/auth_spec.rb#L663)
704
+ * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L667)
705
+ * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L675)
706
+ * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L683)
690
707
  * when implicit as a result of using :client id
691
708
  * and requests to the Ably server are mocked
692
- * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L591)
709
+ * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L711)
693
710
  * 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)
711
+ * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L720)
712
+ * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L724)
713
+ * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L728)
714
+ * when using an :key and basic auth
715
+ * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L743)
716
+ * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L747)
717
+ * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L751)
700
718
 
701
719
  ### Ably::Rest
702
720
  _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
@@ -723,13 +741,13 @@ _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
723
741
  * when auth#token_renewable?
724
742
  * [should automatically reissue a token](./spec/acceptance/rest/base_spec.rb#L143)
725
743
  * when NOT auth#token_renewable?
726
- * [should raise an InvalidToken exception](./spec/acceptance/rest/base_spec.rb#L156)
744
+ * [should raise an InvalidToken exception](./spec/acceptance/rest/base_spec.rb#L158)
727
745
 
728
746
  ### Ably::Rest::Channel
729
747
  _(see [spec/acceptance/rest/channel_spec.rb](./spec/acceptance/rest/channel_spec.rb))_
730
748
  * using JSON and MsgPack protocol
731
749
  * #publish
732
- * [should publish the message adn return true indicating success](./spec/acceptance/rest/channel_spec.rb#L17)
750
+ * [should publish the message and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L17)
733
751
  * #history
734
752
  * [should return the current message history for the channel](./spec/acceptance/rest/channel_spec.rb#L39)
735
753
  * [should return paged history using the PaginatedResource model](./spec/acceptance/rest/channel_spec.rb#L67)
@@ -740,14 +758,14 @@ _(see [spec/acceptance/rest/channel_spec.rb](./spec/acceptance/rest/channel_spec
740
758
  * #history option
741
759
  * :start
742
760
  * with milliseconds since epoch value
743
- * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L116)
761
+ * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L123)
744
762
  * with a Time object value
745
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L126)
763
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L133)
746
764
  * :end
747
765
  * with milliseconds since epoch value
748
- * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L116)
766
+ * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L123)
749
767
  * with a Time object value
750
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L126)
768
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L133)
751
769
 
752
770
  ### Ably::Rest::Channels
753
771
  _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_spec.rb))_
@@ -769,43 +787,43 @@ _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_sp
769
787
  _(see [spec/acceptance/rest/client_spec.rb](./spec/acceptance/rest/client_spec.rb))_
770
788
  * using JSON and MsgPack protocol
771
789
  * #initialize
772
- * with an auth block
773
- * [calls the block to get a new token](./spec/acceptance/rest/client_spec.rb#L20)
790
+ * with a :auth_callback Proc
791
+ * [calls the auth Proc to get a new token](./spec/acceptance/rest/client_spec.rb#L20)
774
792
  * with an auth URL
775
793
  * [sends an HTTP request to the provided URL to get a new token](./spec/acceptance/rest/client_spec.rb#L34)
776
794
  * using tokens
777
795
  * when expired
778
- * [creates a new token automatically when the old token expires](./spec/acceptance/rest/client_spec.rb#L55)
796
+ * [creates a new token automatically when the old token expires](./spec/acceptance/rest/client_spec.rb#L58)
779
797
  * when token has not expired
780
- * [reuses the existing token for every request](./spec/acceptance/rest/client_spec.rb#L69)
798
+ * [reuses the existing token for every request](./spec/acceptance/rest/client_spec.rb#L72)
781
799
  * connection transport
782
800
  * for default host
783
- * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L85)
784
- * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L89)
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)
785
803
  * for the fallback hosts
786
- * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L95)
787
- * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L99)
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)
788
806
  * fallback hosts
789
807
  * configured
790
- * [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#L112)
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)
791
809
  * when environment is NOT production
792
- * [does not retry failed requests with fallback hosts when there is a connection error](./spec/acceptance/rest/client_spec.rb#L129)
810
+ * [does not retry failed requests with fallback hosts when there is a connection error](./spec/acceptance/rest/client_spec.rb#L132)
793
811
  * when environment is production
794
812
  * and connection times out
795
- * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L169)
813
+ * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L172)
796
814
  * and the total request time exeeds 10 seconds
797
- * [makes no further attempts to any fallback hosts](./spec/acceptance/rest/client_spec.rb#L184)
815
+ * [makes no further attempts to any fallback hosts](./spec/acceptance/rest/client_spec.rb#L187)
798
816
  * and connection fails
799
- * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L200)
817
+ * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L203)
800
818
  * with a custom host
801
819
  * that does not exist
802
- * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L216)
820
+ * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L219)
803
821
  * fallback hosts
804
- * [are never used](./spec/acceptance/rest/client_spec.rb#L237)
822
+ * [are never used](./spec/acceptance/rest/client_spec.rb#L240)
805
823
  * that times out
806
- * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L252)
824
+ * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L255)
807
825
  * fallback hosts
808
- * [are never used](./spec/acceptance/rest/client_spec.rb#L265)
826
+ * [are never used](./spec/acceptance/rest/client_spec.rb#L268)
809
827
 
810
828
  ### Ably::Models::MessageEncoders
811
829
  _(see [spec/acceptance/rest/encoders_spec.rb](./spec/acceptance/rest/encoders_spec.rb))_
@@ -904,41 +922,47 @@ _(see [spec/acceptance/rest/presence_spec.rb](./spec/acceptance/rest/presence_sp
904
922
  * using JSON and MsgPack protocol
905
923
  * tested against presence fixture data set up in test app
906
924
  * #get
907
- * [returns current members on the channel with their action set to :present](./spec/acceptance/rest/presence_spec.rb#L30)
925
+ * [returns current members on the channel with their action set to :present](./spec/acceptance/rest/presence_spec.rb#L41)
908
926
  * with :limit option
909
- * [returns a paged response limiting number of members per page](./spec/acceptance/rest/presence_spec.rb#L44)
927
+ * [returns a paged response limiting number of members per page](./spec/acceptance/rest/presence_spec.rb#L55)
910
928
  * #history
911
- * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L62)
929
+ * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L67)
912
930
  * with options
913
931
  * direction: :forwards
914
- * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L78)
932
+ * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L83)
915
933
  * direction: :backwards
916
- * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L93)
934
+ * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L98)
917
935
  * #history
918
936
  * with time range options
919
937
  * :start
920
938
  * with milliseconds since epoch value
921
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L138)
939
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L150)
922
940
  * with Time object value
923
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L148)
941
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L160)
924
942
  * :end
925
943
  * with milliseconds since epoch value
926
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L138)
944
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L150)
927
945
  * with Time object value
928
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L148)
946
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L160)
929
947
  * decoding
948
+ * with encoded fixture data
949
+ * #history
950
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L180)
951
+ * #get
952
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L187)
953
+ * decoding permutations using mocked #history
930
954
  * valid decodeable content
931
955
  * #get
932
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L206)
956
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L243)
933
957
  * #history
934
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L223)
958
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L260)
935
959
  * invalid data
936
960
  * #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)
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)
939
963
  * #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)
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)
942
966
 
943
967
  ### Ably::Rest::Client#stats
944
968
  _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb))_
@@ -947,30 +971,31 @@ _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb)
947
971
  * by minute
948
972
  * with :from set to last interval and :limit set to 1
949
973
  * [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)
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)
962
987
  * 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)
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)
965
990
  * 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)
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)
968
993
  * by hour
969
- * [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)
970
995
  * by day
971
- * [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)
972
997
  * by month
973
- * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L162)
998
+ * [should aggregate the stats for that period](./spec/acceptance/rest/stats_spec.rb#L167)
974
999
 
975
1000
  ### Ably::Rest::Client#time
976
1001
  _(see [spec/acceptance/rest/time_spec.rb](./spec/acceptance/rest/time_spec.rb))_
@@ -994,6 +1019,10 @@ _(see [spec/unit/auth_spec.rb](./spec/unit/auth_spec.rb))_
994
1019
  * [is compatible with original encoding](./spec/unit/auth_spec.rb#L55)
995
1020
  * as Integer
996
1021
  * [raises an argument error](./spec/unit/auth_spec.rb#L63)
1022
+ * 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)
997
1026
 
998
1027
  ### Ably::Logger
999
1028
  _(see [spec/unit/logger_spec.rb](./spec/unit/logger_spec.rb))_
@@ -1249,36 +1278,39 @@ _(see [spec/unit/models/message_spec.rb](./spec/unit/models/message_spec.rb))_
1249
1278
 
1250
1279
  ### Ably::Models::PaginatedResource
1251
1280
  _(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)
1281
+ * #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)
1288
+ * #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)
1262
1291
  * 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)
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)
1268
1298
  * 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)
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)
1272
1303
  * 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)
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)
1278
1310
  * 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)
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)
1282
1314
 
1283
1315
  ### Ably::Models::PresenceMessage
1284
1316
  _(see [spec/unit/models/presence_message_spec.rb](./spec/unit/models/presence_message_spec.rb))_
@@ -1434,75 +1466,146 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
1434
1466
  * with error
1435
1467
  * [returns a valid ErrorInfo object](./spec/unit/models/protocol_message_spec.rb#L261)
1436
1468
 
1437
- ### Ably::Models::Stat
1438
- _(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)
1469
+ ### Ably::Models::Stats
1470
+ _(see [spec/unit/models/stats_spec.rb](./spec/unit/models/stats_spec.rb))_
1471
+ * #all stats
1472
+ * [returns a MessageTypes object](./spec/unit/models/stats_spec.rb#L17)
1473
+ * [returns value for message counts](./spec/unit/models/stats_spec.rb#L21)
1474
+ * [returns value for all data transferred](./spec/unit/models/stats_spec.rb#L25)
1475
+ * [returns zero for empty values](./spec/unit/models/stats_spec.rb#L29)
1476
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L33)
1477
+ * #all
1478
+ * [is a MessageCount object](./spec/unit/models/stats_spec.rb#L39)
1479
+ * #presence
1480
+ * [is a MessageCount object](./spec/unit/models/stats_spec.rb#L39)
1481
+ * #messages
1482
+ * [is a MessageCount object](./spec/unit/models/stats_spec.rb#L39)
1483
+ * #persisted stats
1484
+ * [returns a MessageTypes object](./spec/unit/models/stats_spec.rb#L17)
1485
+ * [returns value for message counts](./spec/unit/models/stats_spec.rb#L21)
1486
+ * [returns value for all data transferred](./spec/unit/models/stats_spec.rb#L25)
1487
+ * [returns zero for empty values](./spec/unit/models/stats_spec.rb#L29)
1488
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L33)
1489
+ * #all
1490
+ * [is a MessageCount object](./spec/unit/models/stats_spec.rb#L39)
1491
+ * #presence
1492
+ * [is a MessageCount object](./spec/unit/models/stats_spec.rb#L39)
1493
+ * #messages
1494
+ * [is a MessageCount object](./spec/unit/models/stats_spec.rb#L39)
1495
+ * #inbound stats
1496
+ * [returns a MessageTraffic object](./spec/unit/models/stats_spec.rb#L59)
1497
+ * [returns value for realtime message counts](./spec/unit/models/stats_spec.rb#L63)
1498
+ * [returns value for all presence data](./spec/unit/models/stats_spec.rb#L67)
1499
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L71)
1500
+ * #realtime
1501
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1502
+ * #rest
1503
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1504
+ * #webhook
1505
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1506
+ * #all
1507
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1508
+ * #outbound stats
1509
+ * [returns a MessageTraffic object](./spec/unit/models/stats_spec.rb#L59)
1510
+ * [returns value for realtime message counts](./spec/unit/models/stats_spec.rb#L63)
1511
+ * [returns value for all presence data](./spec/unit/models/stats_spec.rb#L67)
1512
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L71)
1513
+ * #realtime
1514
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1515
+ * #rest
1516
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1517
+ * #webhook
1518
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1519
+ * #all
1520
+ * [is a MessageTypes object](./spec/unit/models/stats_spec.rb#L77)
1521
+ * #connections stats
1522
+ * [returns a ConnectionTypes object](./spec/unit/models/stats_spec.rb#L91)
1523
+ * [returns value for tls opened counts](./spec/unit/models/stats_spec.rb#L95)
1524
+ * [returns value for all peak connections](./spec/unit/models/stats_spec.rb#L99)
1525
+ * [returns zero for empty values](./spec/unit/models/stats_spec.rb#L103)
1526
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L107)
1527
+ * #tls
1528
+ * [is a ResourceCount object](./spec/unit/models/stats_spec.rb#L113)
1529
+ * #plain
1530
+ * [is a ResourceCount object](./spec/unit/models/stats_spec.rb#L113)
1531
+ * #all
1532
+ * [is a ResourceCount object](./spec/unit/models/stats_spec.rb#L113)
1533
+ * #channels stats
1534
+ * [returns a ResourceCount object](./spec/unit/models/stats_spec.rb#L126)
1535
+ * [returns value for opened counts](./spec/unit/models/stats_spec.rb#L130)
1536
+ * [returns value for peak channels](./spec/unit/models/stats_spec.rb#L134)
1537
+ * [returns zero for empty values](./spec/unit/models/stats_spec.rb#L138)
1538
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L142)
1539
+ * #opened
1540
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L148)
1541
+ * #peak
1542
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L148)
1543
+ * #mean
1544
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L148)
1545
+ * #min
1546
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L148)
1547
+ * #refused
1548
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L148)
1549
+ * #api_requests stats
1550
+ * [returns a RequestCount object](./spec/unit/models/stats_spec.rb#L164)
1551
+ * [returns value for succeeded](./spec/unit/models/stats_spec.rb#L168)
1552
+ * [returns value for failed](./spec/unit/models/stats_spec.rb#L172)
1553
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L176)
1554
+ * #succeeded
1555
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L182)
1556
+ * #failed
1557
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L182)
1558
+ * #refused
1559
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L182)
1560
+ * #token_requests stats
1561
+ * [returns a RequestCount object](./spec/unit/models/stats_spec.rb#L164)
1562
+ * [returns value for succeeded](./spec/unit/models/stats_spec.rb#L168)
1563
+ * [returns value for failed](./spec/unit/models/stats_spec.rb#L172)
1564
+ * [raises an exception for unknown attributes](./spec/unit/models/stats_spec.rb#L176)
1565
+ * #succeeded
1566
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L182)
1567
+ * #failed
1568
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L182)
1569
+ * #refused
1570
+ * [is a Integer object](./spec/unit/models/stats_spec.rb#L182)
1466
1571
  * #interval_granularity
1467
- * [returns the granularity of the interval_id](./spec/unit/models/stat_spec.rb#L17)
1572
+ * [returns the granularity of the interval_id](./spec/unit/models/stats_spec.rb#L193)
1468
1573
  * #interval_time
1469
- * [returns a Time object representing the start of the interval](./spec/unit/models/stat_spec.rb#L25)
1574
+ * [returns a Time object representing the start of the interval](./spec/unit/models/stats_spec.rb#L201)
1470
1575
  * class methods
1471
1576
  * #to_interval_id
1472
1577
  * 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)
1578
+ * [converts time 2014-02-03:05:06 with granularity :month into 2014-02](./spec/unit/models/stats_spec.rb#L209)
1579
+ * [converts time 2014-02-03:05:06 with granularity :day into 2014-02-03](./spec/unit/models/stats_spec.rb#L213)
1580
+ * [converts time 2014-02-03:05:06 with granularity :hour into 2014-02-03:05](./spec/unit/models/stats_spec.rb#L217)
1581
+ * [converts time 2014-02-03:05:06 with granularity :minute into 2014-02-03:05:06](./spec/unit/models/stats_spec.rb#L221)
1582
+ * [fails with invalid granularity](./spec/unit/models/stats_spec.rb#L225)
1583
+ * [fails with invalid time](./spec/unit/models/stats_spec.rb#L229)
1479
1584
  * 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)
1585
+ * [converts time 2014-02-03:06 with granularity :hour into 2014-02-03:04 at UTC +00:00](./spec/unit/models/stats_spec.rb#L235)
1481
1586
  * #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)
1587
+ * [converts a month interval_id 2014-02 into a Time object in UTC 0](./spec/unit/models/stats_spec.rb#L242)
1588
+ * [converts a day interval_id 2014-02-03 into a Time object in UTC 0](./spec/unit/models/stats_spec.rb#L247)
1589
+ * [converts an hour interval_id 2014-02-03:05 into a Time object in UTC 0](./spec/unit/models/stats_spec.rb#L252)
1590
+ * [converts a minute interval_id 2014-02-03:05:06 into a Time object in UTC 0](./spec/unit/models/stats_spec.rb#L257)
1591
+ * [fails with an invalid interval_id 14-20](./spec/unit/models/stats_spec.rb#L262)
1487
1592
  * #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)
1593
+ * [returns a :month interval_id for 2014-02](./spec/unit/models/stats_spec.rb#L268)
1594
+ * [returns a :day interval_id for 2014-02-03](./spec/unit/models/stats_spec.rb#L272)
1595
+ * [returns a :hour interval_id for 2014-02-03:05](./spec/unit/models/stats_spec.rb#L276)
1596
+ * [returns a :minute interval_id for 2014-02-03:05:06](./spec/unit/models/stats_spec.rb#L280)
1597
+ * [fails with an invalid interval_id 14-20](./spec/unit/models/stats_spec.rb#L284)
1493
1598
 
1494
- ### Ably::Models::Token
1495
- _(see [spec/unit/models/token_spec.rb](./spec/unit/models/token_spec.rb))_
1599
+ ### Ably::Models::TokenDetails
1600
+ _(see [spec/unit/models/token_details_spec.rb](./spec/unit/models/token_details_spec.rb))_
1496
1601
  * behaves like a model
1497
1602
  * attributes
1498
- * #id
1499
- * [retrieves attribute :id](./spec/shared/model_behaviour.rb#L15)
1500
- * #capability
1501
- * [retrieves attribute :capability](./spec/shared/model_behaviour.rb#L15)
1603
+ * #token
1604
+ * [retrieves attribute :token](./spec/shared/model_behaviour.rb#L15)
1605
+ * #key_name
1606
+ * [retrieves attribute :key_name](./spec/shared/model_behaviour.rb#L15)
1502
1607
  * #client_id
1503
1608
  * [retrieves attribute :client_id](./spec/shared/model_behaviour.rb#L15)
1504
- * #nonce
1505
- * [retrieves attribute :nonce](./spec/shared/model_behaviour.rb#L15)
1506
1609
  * #==
1507
1610
  * [is true when attributes are the same](./spec/shared/model_behaviour.rb#L41)
1508
1611
  * [is false when attributes are not the same](./spec/shared/model_behaviour.rb#L46)
@@ -1510,26 +1613,69 @@ _(see [spec/unit/models/token_spec.rb](./spec/unit/models/token_spec.rb))_
1510
1613
  * is immutable
1511
1614
  * [prevents changes](./spec/shared/model_behaviour.rb#L76)
1512
1615
  * [dups options](./spec/shared/model_behaviour.rb#L80)
1513
- * defaults
1514
- * [should default TTL to 1 hour](./spec/unit/models/token_spec.rb#L14)
1515
- * [should default capability to all](./spec/unit/models/token_spec.rb#L18)
1516
- * [should only have defaults for :ttl and :capability](./spec/unit/models/token_spec.rb#L22)
1517
1616
  * attributes
1518
- * #key_id
1519
- * [retrieves attribute :key](./spec/unit/models/token_spec.rb#L32)
1520
- * #issued_at
1521
- * [retrieves attribute :issued_at as Time](./spec/unit/models/token_spec.rb#L42)
1522
- * #expires_at
1523
- * [retrieves attribute :expires as Time](./spec/unit/models/token_spec.rb#L42)
1617
+ * #capability
1618
+ * [retrieves attribute :capability as parsed JSON](./spec/unit/models/token_details_spec.rb#L21)
1619
+ * #issued with :issued option as milliseconds in constructor
1620
+ * [retrieves attribute :issued as Time](./spec/unit/models/token_details_spec.rb#L31)
1621
+ * #issued with :issued option as a Time in constructor
1622
+ * [retrieves attribute :issued as Time](./spec/unit/models/token_details_spec.rb#L40)
1623
+ * #issued when converted to JSON
1624
+ * [is in milliseconds](./spec/unit/models/token_details_spec.rb#L49)
1625
+ * #expires with :expires option as milliseconds in constructor
1626
+ * [retrieves attribute :expires as Time](./spec/unit/models/token_details_spec.rb#L31)
1627
+ * #expires with :expires option as a Time in constructor
1628
+ * [retrieves attribute :expires as Time](./spec/unit/models/token_details_spec.rb#L40)
1629
+ * #expires when converted to JSON
1630
+ * [is in milliseconds](./spec/unit/models/token_details_spec.rb#L49)
1524
1631
  * #expired?
1525
1632
  * once grace period buffer has passed
1526
- * [is true](./spec/unit/models/token_spec.rb#L55)
1633
+ * [is true](./spec/unit/models/token_details_spec.rb#L61)
1527
1634
  * within grace period buffer
1528
- * [is false](./spec/unit/models/token_spec.rb#L63)
1635
+ * [is false](./spec/unit/models/token_details_spec.rb#L69)
1529
1636
  * ==
1530
- * [is true when attributes are the same](./spec/unit/models/token_spec.rb#L73)
1531
- * [is false when attributes are not the same](./spec/unit/models/token_spec.rb#L78)
1532
- * [is false when class type differs](./spec/unit/models/token_spec.rb#L82)
1637
+ * [is true when attributes are the same](./spec/unit/models/token_details_spec.rb#L79)
1638
+ * [is false when attributes are not the same](./spec/unit/models/token_details_spec.rb#L84)
1639
+ * [is false when class type differs](./spec/unit/models/token_details_spec.rb#L88)
1640
+
1641
+ ### Ably::Models::TokenRequest
1642
+ _(see [spec/unit/models/token_request_spec.rb](./spec/unit/models/token_request_spec.rb))_
1643
+ * behaves like a model
1644
+ * attributes
1645
+ * #key_name
1646
+ * [retrieves attribute :key_name](./spec/shared/model_behaviour.rb#L15)
1647
+ * #client_id
1648
+ * [retrieves attribute :client_id](./spec/shared/model_behaviour.rb#L15)
1649
+ * #nonce
1650
+ * [retrieves attribute :nonce](./spec/shared/model_behaviour.rb#L15)
1651
+ * #mac
1652
+ * [retrieves attribute :mac](./spec/shared/model_behaviour.rb#L15)
1653
+ * #==
1654
+ * [is true when attributes are the same](./spec/shared/model_behaviour.rb#L41)
1655
+ * [is false when attributes are not the same](./spec/shared/model_behaviour.rb#L46)
1656
+ * [is false when class type differs](./spec/shared/model_behaviour.rb#L50)
1657
+ * is immutable
1658
+ * [prevents changes](./spec/shared/model_behaviour.rb#L76)
1659
+ * [dups options](./spec/shared/model_behaviour.rb#L80)
1660
+ * attributes
1661
+ * #capability
1662
+ * [retrieves attribute :capability as parsed JSON](./spec/unit/models/token_request_spec.rb#L18)
1663
+ * #timestamp
1664
+ * with :timestamp option as milliseconds in constructor
1665
+ * [retrieves attribute :timestamp as Time](./spec/unit/models/token_request_spec.rb#L29)
1666
+ * with :timestamp option as Time in constructor
1667
+ * [retrieves attribute :timestamp as Time](./spec/unit/models/token_request_spec.rb#L38)
1668
+ * when converted to JSON
1669
+ * [is in milliseconds since epoch](./spec/unit/models/token_request_spec.rb#L47)
1670
+ * #ttl
1671
+ * with :ttl option as milliseconds in constructor
1672
+ * [retrieves attribute :ttl as seconds](./spec/unit/models/token_request_spec.rb#L59)
1673
+ * when converted to JSON
1674
+ * [is in milliseconds since epoch](./spec/unit/models/token_request_spec.rb#L68)
1675
+ * ==
1676
+ * [is true when attributes are the same](./spec/unit/models/token_request_spec.rb#L78)
1677
+ * [is false when attributes are not the same](./spec/unit/models/token_request_spec.rb#L83)
1678
+ * [is false when class type differs](./spec/unit/models/token_request_spec.rb#L87)
1533
1679
 
1534
1680
  ### Ably::Modules::EventEmitter
1535
1681
  _(see [spec/unit/modules/event_emitter_spec.rb](./spec/unit/modules/event_emitter_spec.rb))_
@@ -1648,50 +1794,50 @@ _(see [spec/unit/realtime/client_spec.rb](./spec/unit/realtime/client_spec.rb))_
1648
1794
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L28)
1649
1795
  * nil
1650
1796
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L36)
1651
- * api_key: "invalid"
1797
+ * key: "invalid"
1652
1798
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L44)
1653
- * api_key: "invalid:asdad"
1799
+ * key: "invalid:asdad"
1654
1800
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L52)
1655
- * api_key and key_id
1801
+ * key and key_name
1656
1802
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L60)
1657
- * api_key and key_secret
1803
+ * key and key_secret
1658
1804
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L68)
1659
1805
  * client_id as only option
1660
1806
  * [requires a valid key](./spec/shared/client_initializer_behaviour.rb#L76)
1661
1807
  * with valid arguments
1662
- * api_key only
1808
+ * key only
1663
1809
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
1664
- * key_id and key_secret
1665
- * [constructs an api_key](./spec/shared/client_initializer_behaviour.rb#L95)
1666
1810
  * 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)
1811
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L103)
1812
+ * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L107)
1669
1813
  * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L111)
1670
1814
  * with a string token key instead of options hash
1671
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L119)
1815
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L119)
1672
1816
  * with token
1673
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L127)
1817
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L127)
1818
+ * with token_details
1819
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L135)
1674
1820
  * endpoint
1675
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L133)
1821
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L141)
1676
1822
  * with environment option
1677
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L140)
1823
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L148)
1678
1824
  * tls
1679
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L159)
1825
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L167)
1680
1826
  * set to false
1681
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L150)
1682
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L154)
1827
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L158)
1828
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L162)
1683
1829
  * logger
1684
1830
  * 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)
1831
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L174)
1832
+ * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L178)
1687
1833
  * with log_level :none
1688
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L178)
1834
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L186)
1689
1835
  * 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)
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)
1692
1838
  * 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)
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)
1695
1841
  * delegation to the REST Client
1696
1842
  * [passes on the options to the initializer](./spec/unit/realtime/client_spec.rb#L15)
1697
1843
  * for attribute
@@ -1771,7 +1917,7 @@ _(see [spec/unit/realtime/safe_deferrable_spec.rb](./spec/unit/realtime/safe_def
1771
1917
  * #succeed
1772
1918
  * [calls the callbacks defined with #callback, but not the ones added for #errback](./spec/shared/safe_deferrable_behaviour.rb#L61)
1773
1919
 
1774
- ### Ably::Rest::Channels
1920
+ ### Ably::Rest::Channel
1775
1921
  _(see [spec/unit/rest/channel_spec.rb](./spec/unit/rest/channel_spec.rb))_
1776
1922
  * #initializer
1777
1923
  * as UTF_8 string
@@ -1825,63 +1971,63 @@ _(see [spec/unit/rest/client_spec.rb](./spec/unit/rest/client_spec.rb))_
1825
1971
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L28)
1826
1972
  * nil
1827
1973
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L36)
1828
- * api_key: "invalid"
1974
+ * key: "invalid"
1829
1975
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L44)
1830
- * api_key: "invalid:asdad"
1976
+ * key: "invalid:asdad"
1831
1977
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L52)
1832
- * api_key and key_id
1978
+ * key and key_name
1833
1979
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L60)
1834
- * api_key and key_secret
1980
+ * key and key_secret
1835
1981
  * [raises an exception](./spec/shared/client_initializer_behaviour.rb#L68)
1836
1982
  * client_id as only option
1837
1983
  * [requires a valid key](./spec/shared/client_initializer_behaviour.rb#L76)
1838
1984
  * with valid arguments
1839
- * api_key only
1985
+ * key only
1840
1986
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
1841
- * key_id and key_secret
1842
- * [constructs an api_key](./spec/shared/client_initializer_behaviour.rb#L95)
1843
1987
  * 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)
1988
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L103)
1989
+ * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L107)
1846
1990
  * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L111)
1847
1991
  * with a string token key instead of options hash
1848
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L119)
1992
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L119)
1849
1993
  * with token
1850
- * [sets the token_id](./spec/shared/client_initializer_behaviour.rb#L127)
1994
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L127)
1995
+ * with token_details
1996
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L135)
1851
1997
  * endpoint
1852
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L133)
1998
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L141)
1853
1999
  * with environment option
1854
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L140)
2000
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L148)
1855
2001
  * tls
1856
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L159)
2002
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L167)
1857
2003
  * set to false
1858
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L150)
1859
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L154)
2004
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L158)
2005
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L162)
1860
2006
  * logger
1861
2007
  * 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)
2008
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L174)
2009
+ * [specifies Logger::ERROR log level](./spec/shared/client_initializer_behaviour.rb#L178)
1864
2010
  * with log_level :none
1865
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L178)
2011
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L186)
1866
2012
  * 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)
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)
1869
2015
  * 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)
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)
1872
2018
  * initializer options
1873
2019
  * TLS
1874
2020
  * disabled
1875
2021
  * [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
2022
  * :use_token_auth
1877
2023
  * set to false
1878
- * with an api_key with :tls => false
2024
+ * with an key with :tls => false
1879
2025
  * [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)
2026
+ * without an key
2027
+ * [fails as an key is required if not using token auth](./spec/unit/rest/client_spec.rb#L36)
1882
2028
  * 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)
2029
+ * without an key or token
2030
+ * [fails as an key is required to issue tokens](./spec/unit/rest/client_spec.rb#L46)
1885
2031
 
1886
2032
  ### Ably::Rest
1887
2033
  _(see [spec/unit/rest/rest_spec.rb](./spec/unit/rest/rest_spec.rb))_
@@ -1922,6 +2068,6 @@ _(see [spec/unit/util/pub_sub_spec.rb](./spec/unit/util/pub_sub_spec.rb))_
1922
2068
 
1923
2069
  ## Test summary
1924
2070
 
1925
- * Passing tests: 942
2071
+ * Passing tests: 1028
1926
2072
  * Pending tests: 7
1927
2073
  * Failing tests: 0