ably 0.8.1 → 0.8.2

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 (47) hide show
  1. checksums.yaml +5 -13
  2. data/README.md +11 -11
  3. data/SPEC.md +87 -87
  4. data/ably.gemspec +1 -1
  5. data/lib/ably/exceptions.rb +4 -1
  6. data/lib/ably/models/{paginated_resource.rb → paginated_result.rb} +8 -8
  7. data/lib/ably/models/presence_message.rb +1 -1
  8. data/lib/ably/modules/conversions.rb +15 -0
  9. data/lib/ably/modules/encodeable.rb +2 -2
  10. data/lib/ably/modules/event_emitter.rb +8 -8
  11. data/lib/ably/modules/safe_deferrable.rb +15 -3
  12. data/lib/ably/modules/state_emitter.rb +2 -2
  13. data/lib/ably/modules/state_machine.rb +1 -1
  14. data/lib/ably/realtime/channel.rb +2 -4
  15. data/lib/ably/realtime/channel/channel_manager.rb +1 -1
  16. data/lib/ably/realtime/client.rb +4 -4
  17. data/lib/ably/realtime/client/incoming_message_dispatcher.rb +2 -2
  18. data/lib/ably/realtime/connection.rb +1 -1
  19. data/lib/ably/realtime/connection/connection_manager.rb +3 -3
  20. data/lib/ably/realtime/connection/connection_state_machine.rb +1 -1
  21. data/lib/ably/realtime/connection/websocket_transport.rb +2 -2
  22. data/lib/ably/realtime/presence.rb +23 -5
  23. data/lib/ably/realtime/presence/members_map.rb +16 -13
  24. data/lib/ably/rest/channel.rb +3 -2
  25. data/lib/ably/rest/client.rb +2 -2
  26. data/lib/ably/rest/presence.rb +4 -4
  27. data/lib/ably/util/pub_sub.rb +1 -1
  28. data/lib/ably/util/safe_deferrable.rb +1 -1
  29. data/lib/ably/version.rb +1 -1
  30. data/spec/acceptance/realtime/channel_history_spec.rb +1 -1
  31. data/spec/acceptance/realtime/channel_spec.rb +5 -15
  32. data/spec/acceptance/realtime/connection_failures_spec.rb +2 -2
  33. data/spec/acceptance/realtime/connection_spec.rb +16 -14
  34. data/spec/acceptance/realtime/message_spec.rb +91 -8
  35. data/spec/acceptance/realtime/presence_spec.rb +190 -71
  36. data/spec/acceptance/realtime/stats_spec.rb +2 -2
  37. data/spec/acceptance/rest/channel_spec.rb +1 -1
  38. data/spec/acceptance/rest/encoders_spec.rb +1 -1
  39. data/spec/acceptance/rest/message_spec.rb +73 -1
  40. data/spec/acceptance/rest/presence_spec.rb +4 -2
  41. data/spec/unit/models/{paginated_resource_spec.rb → paginated_result_spec.rb} +18 -18
  42. data/spec/unit/modules/event_emitter_spec.rb +27 -27
  43. data/spec/unit/modules/state_emitter_spec.rb +1 -1
  44. data/spec/unit/realtime/channel_spec.rb +2 -2
  45. data/spec/unit/realtime/connection_spec.rb +3 -3
  46. data/spec/unit/realtime/presence_spec.rb +2 -2
  47. metadata +44 -44
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjQ0ZWU1NWIwZTNkNTI0ZDAzNTgzNjFiYzhiMjkzZmNlYTMzYWYwNg==
5
- data.tar.gz: !binary |-
6
- ZmExOTdmNDZiMmI3NGI3ZGFhM2E5MjU1MTVlYTQ0OTVmNGI0MDIyZQ==
2
+ SHA1:
3
+ metadata.gz: f57c29988fe001f1524fdfc79036ded998a106e3
4
+ data.tar.gz: 22a1a07b82930174dc9fd270fe28765b26a14b1d
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZmYxOGYzMjU3ODc0NGUzNzRhNzdkM2EwNjMyYWVjZjVhN2VjNzQ1ZmJiNTE3
10
- NWY0ZmRlMDVmMGIxYjUwYTU2YmI1MzBkNzRiYWY3NGIwYjAyZWNjOTcxYTNk
11
- NDZjYTdkNmY3ZWUyMjc1NjM2MTI0ZWYxY2I2M2ZlODAzZDVhMTc=
12
- data.tar.gz: !binary |-
13
- MTNmYTk3OTJiNjNiOGUwOWM2NDM0OWJjYTkxZjdmNjA4ZTBjMzA0YWFhYzdm
14
- NjA3YmE1OTllMmVhYzVkNzhmMjA3ZDMwYjU4YzgzZTkyNWY4YmY1Y2QwNWJi
15
- NWQzMjk2Mjk2MGNlYjA4NjgxODA5MjFhZmQ3ZGMwMDhjNDMzNGU=
6
+ metadata.gz: c438babd2ef3b0e82ff72e9a5b68e8f9d78b0fcc927e4c7c81ae15af1b9fd35fd10210bf1683a20de77834b3089170bb475a24e507c00f6b0053986c4c63b1ed
7
+ data.tar.gz: 11b46d0850d6642045f1aa157624ad24b5a8e9a28da65db4fd1b8a142f78477ca62dd5bbaee1dcf6a60fc4789326bbb6530965068e2d300810b4141aab017762
data/README.md CHANGED
@@ -103,11 +103,11 @@ channel.publish('greeting', 'Hello World!')
103
103
 
104
104
  ```ruby
105
105
  channel.history do |messages_page|
106
- messages_page #=> #<Ably::Models::PaginatedResource ...>
106
+ messages_page #=> #<Ably::Models::PaginatedResult ...>
107
107
  messages_page.items.first # #<Ably::Models::Message ...>
108
108
  messages_page.items.first.data # payload for the message
109
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 ...>
110
+ messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...>
111
111
  messages_page.has_next? # false, there are more pages
112
112
  end
113
113
  ```
@@ -127,7 +127,7 @@ channel.presence.history do |presence_page|
127
127
  presence_page.items.first.action # Any of :enter, :update or :leave
128
128
  presence_page.items.first.client_id # client ID of member
129
129
  presence_page.items.first.data # optional data payload of member
130
- presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
130
+ presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...>
131
131
  end
132
132
  ```
133
133
 
@@ -153,30 +153,30 @@ channel.publish('myEvent', 'Hello!') #=> true
153
153
  ### Querying the History
154
154
 
155
155
  ```ruby
156
- messages_page = channel.history #=> #<Ably::Models::PaginatedResource ...>
156
+ messages_page = channel.history #=> #<Ably::Models::PaginatedResult ...>
157
157
  messages_page.items.first #=> #<Ably::Models::Message ...>
158
158
  messages_page.items.first.data # payload for the message
159
- messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
159
+ messages_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...>
160
160
  messages_page.has_next? # false, there are more pages
161
161
  ```
162
162
 
163
163
  ### Presence on a channel
164
164
 
165
165
  ```ruby
166
- members_page = channel.presence.get # => #<Ably::Models::PaginatedResource ...>
166
+ members_page = channel.presence.get # => #<Ably::Models::PaginatedResult ...>
167
167
  members_page.items.first # first member present in this page => #<Ably::Models::PresenceMessage ...>
168
168
  members_page.items.first.client_id # client ID of first member present
169
- members_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
169
+ members_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...>
170
170
  members_page.has_next? # false, there are more pages
171
171
  ```
172
172
 
173
173
  ### Querying the Presence History
174
174
 
175
175
  ```ruby
176
- presence_page = channel.presence.history #=> #<Ably::Models::PaginatedResource ...>
176
+ presence_page = channel.presence.history #=> #<Ably::Models::PaginatedResult ...>
177
177
  presence_page.items.first #=> #<Ably::Models::PresenceMessage ...>
178
178
  presence_page.items.first.client_id # client ID of first member
179
- presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
179
+ presence_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...>
180
180
  ```
181
181
 
182
182
  ### Generate Token and Token Request
@@ -200,9 +200,9 @@ token = client.auth.create_token_request
200
200
  ### Fetching your application's stats
201
201
 
202
202
  ```ruby
203
- stats_page = client.stats #=> #<Ably::Models::PaginatedResource ...>
203
+ stats_page = client.stats #=> #<Ably::Models::PaginatedResult ...>
204
204
  stats_page.items.first = #<Ably::Models::Stats ...>
205
- stats_page.next # retrieves the next page => #<Ably::Models::PaginatedResource ...>
205
+ stats_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...>
206
206
  ```
207
207
 
208
208
  ### Fetching the Ably service time
data/SPEC.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ably Realtime & REST Client Library 0.8.0 Specification
1
+ # Ably Realtime & REST Client Library 0.8.1 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))_
@@ -170,7 +170,7 @@ _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/r
170
170
  * when DISCONNECTED ProtocolMessage received from the server
171
171
  * [reconnects automatically and immediately](./spec/acceptance/realtime/connection_failures_spec.rb#L292)
172
172
  * and subsequently fails to reconnect
173
- * [retries every CONNECT_RETRY_CONFIG[:disconnected][:retry_every] seconds](./spec/acceptance/realtime/connection_failures_spec.rb#L322)
173
+ * [retries every 15 seconds](./spec/acceptance/realtime/connection_failures_spec.rb#L322)
174
174
  * when websocket transport is closed
175
175
  * [reconnects automatically](./spec/acceptance/realtime/connection_failures_spec.rb#L365)
176
176
  * after successfully reconnecting and resuming
@@ -276,43 +276,43 @@ _(see [spec/acceptance/realtime/connection_spec.rb](./spec/acceptance/realtime/c
276
276
  * [catches the exception and logs the error](./spec/acceptance/realtime/connection_spec.rb#L508)
277
277
  * recovery
278
278
  * #recovery_key
279
- * [is composed of connection id and serial that is kept up to date with each message ACK received](./spec/acceptance/realtime/connection_spec.rb#L545)
280
- * [is available when connection is in one of the states: connecting, connected, disconnected, suspended, failed](./spec/acceptance/realtime/connection_spec.rb#L566)
281
- * [is nil when connection is explicitly CLOSED](./spec/acceptance/realtime/connection_spec.rb#L590)
279
+ * [is composed of connection key and serial that is kept up to date with each message ACK received](./spec/acceptance/realtime/connection_spec.rb#L545)
280
+ * [is available when connection is in one of the states: connecting, connected, disconnected, suspended, failed](./spec/acceptance/realtime/connection_spec.rb#L568)
281
+ * [is nil when connection is explicitly CLOSED](./spec/acceptance/realtime/connection_spec.rb#L592)
282
282
  * opening a new connection using a recently disconnected connection's #recovery_key
283
283
  * connection#id and connection#key after recovery
284
- * [remains the same](./spec/acceptance/realtime/connection_spec.rb#L604)
284
+ * [remains the same](./spec/acceptance/realtime/connection_spec.rb#L606)
285
285
  * when messages have been sent whilst the old connection is disconnected
286
286
  * the new connection
287
- * [recovers server-side queued messages](./spec/acceptance/realtime/connection_spec.rb#L645)
287
+ * [recovers server-side queued messages](./spec/acceptance/realtime/connection_spec.rb#L647)
288
288
  * with :recover option
289
289
  * with invalid syntax
290
- * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L670)
290
+ * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L672)
291
291
  * with invalid formatted value sent to server
292
- * [triggers a fatal error on the connection object, sets the #error_reason and disconnects](./spec/acceptance/realtime/connection_spec.rb#L679)
292
+ * [triggers a fatal error on the connection object, sets the #error_reason and disconnects](./spec/acceptance/realtime/connection_spec.rb#L681)
293
293
  * with expired (missing) value sent to server
294
- * [triggers an error on the connection object, sets the #error_reason, yet will connect anyway](./spec/acceptance/realtime/connection_spec.rb#L694)
294
+ * [triggers an error on the connection object, sets the #error_reason, yet will connect anyway](./spec/acceptance/realtime/connection_spec.rb#L696)
295
295
  * with many connections simultaneously
296
- * [opens each with a unique connection#id and connection#key](./spec/acceptance/realtime/connection_spec.rb#L713)
296
+ * [opens each with a unique connection#id and connection#key](./spec/acceptance/realtime/connection_spec.rb#L715)
297
297
  * when a state transition is unsupported
298
- * [emits a StateChangeError](./spec/acceptance/realtime/connection_spec.rb#L733)
298
+ * [emits a StateChangeError](./spec/acceptance/realtime/connection_spec.rb#L735)
299
299
  * protocol failure
300
300
  * receiving an invalid ProtocolMessage
301
- * [emits an error on the connection and logs a fatal error message](./spec/acceptance/realtime/connection_spec.rb#L749)
301
+ * [emits an error on the connection and logs a fatal error message](./spec/acceptance/realtime/connection_spec.rb#L751)
302
302
  * undocumented method
303
303
  * #internet_up?
304
- * [returns a Deferrable](./spec/acceptance/realtime/connection_spec.rb#L765)
304
+ * [returns a Deferrable](./spec/acceptance/realtime/connection_spec.rb#L767)
305
305
  * internet up URL protocol
306
306
  * when using TLS for the connection
307
- * [uses TLS for the Internet check to https://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L776)
307
+ * [uses TLS for the Internet check to https://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L778)
308
308
  * when using a non-secured connection
309
- * [uses TLS for the Internet check to http://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L786)
309
+ * [uses TLS for the Internet check to http://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L788)
310
310
  * when the Internet is up
311
- * [calls the block with true](./spec/acceptance/realtime/connection_spec.rb#L795)
312
- * [calls the success callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L802)
311
+ * [calls the block with true](./spec/acceptance/realtime/connection_spec.rb#L797)
312
+ * [calls the success callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L804)
313
313
  * when the Internet is down
314
- * [calls the block with false](./spec/acceptance/realtime/connection_spec.rb#L814)
315
- * [calls the failure callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L821)
314
+ * [calls the block with false](./spec/acceptance/realtime/connection_spec.rb#L816)
315
+ * [calls the failure callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L823)
316
316
 
317
317
  ### Ably::Realtime::Channel Message
318
318
  _(see [spec/acceptance/realtime/message_spec.rb](./spec/acceptance/realtime/message_spec.rb))_
@@ -473,7 +473,7 @@ _(see [spec/acceptance/realtime/presence_spec.rb](./spec/acceptance/realtime/pre
473
473
  * when set to a string
474
474
  * [emits the new data for the leave event](./spec/acceptance/realtime/presence_spec.rb#L561)
475
475
  * when set to nil
476
- * [emits the previously defined value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L574)
476
+ * [emits a nil value for the data attribute when leaving](./spec/acceptance/realtime/presence_spec.rb#L574)
477
477
  * when not passed as an argument
478
478
  * [emits the previously defined value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L587)
479
479
  * it should behave like a public presence method
@@ -582,7 +582,7 @@ _(see [spec/acceptance/realtime/presence_spec.rb](./spec/acceptance/realtime/pre
582
582
  * [expect :left event once underlying connection is closed](./spec/acceptance/realtime/presence_spec.rb#L1310)
583
583
  * [expect :left event with client data from enter event](./spec/acceptance/realtime/presence_spec.rb#L1320)
584
584
  * connection failure mid-way through a large member sync
585
- * PENDING: *[resumes the SYNC operation](./spec/acceptance/realtime/presence_spec.rb#L1339)*
585
+ * [resumes the SYNC operation](./spec/acceptance/realtime/presence_spec.rb#L1338)
586
586
 
587
587
  ### Ably::Realtime::Client#stats
588
588
  _(see [spec/acceptance/realtime/stats_spec.rb](./spec/acceptance/realtime/stats_spec.rb))_
@@ -605,116 +605,116 @@ _(see [spec/acceptance/rest/auth_spec.rb](./spec/acceptance/rest/auth_spec.rb))_
605
605
  * #request_token
606
606
  * [returns a valid requested token in the expected format with valid issued and expires attributes](./spec/acceptance/rest/auth_spec.rb#L69)
607
607
  * with option :client_id
608
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
608
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
609
609
  * with option :capability
610
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
610
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
611
611
  * with option :nonce
612
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
612
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
613
613
  * with option :timestamp
614
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
614
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
615
615
  * with option :ttl
616
- * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L100)
616
+ * [overrides default and uses camelCase notation for attributes](./spec/acceptance/rest/auth_spec.rb#L101)
617
617
  * with :key option
618
- * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L129)
618
+ * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L130)
619
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)
620
+ * [key_name is used in request and signing uses key_secret](./spec/acceptance/rest/auth_spec.rb#L159)
621
621
  * with :query_time option
622
- * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L166)
622
+ * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L167)
623
623
  * without :query_time option
624
- * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L175)
624
+ * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L176)
625
625
  * with :auth_url option
626
626
  * when response from :auth_url is a valid token request
627
- * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L223)
628
- * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L228)
627
+ * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L224)
628
+ * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L229)
629
629
  * with :query_params
630
- * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L235)
630
+ * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L236)
631
631
  * with :headers
632
- * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L243)
632
+ * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L244)
633
633
  * with POST
634
- * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L251)
634
+ * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L252)
635
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)
636
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L277)
637
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)
638
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L294)
639
639
  * when response is invalid
640
640
  * 500
641
- * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L306)
641
+ * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L307)
642
642
  * XML
643
- * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L317)
643
+ * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L318)
644
644
  * with a Proc for the :auth_callback option
645
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)
646
+ * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L337)
647
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L342)
648
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)
649
+ * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L371)
650
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L376)
651
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)
652
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L397)
653
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)
654
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L413)
655
655
  * with client_id
656
- * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L444)
656
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L445)
657
657
  * before #authorise has been called
658
- * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L451)
658
+ * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L452)
659
659
  * #authorise
660
- * [updates the persisted auth options that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L498)
660
+ * [updates the persisted auth options that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L499)
661
661
  * when called for the first time since the client has been instantiated
662
- * [passes all options to #request_token](./spec/acceptance/rest/auth_spec.rb#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)
662
+ * [passes all options to #request_token](./spec/acceptance/rest/auth_spec.rb#L463)
663
+ * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L468)
664
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L472)
665
665
  * with previous authorisation
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)
666
+ * [does not request a token if current_token_details has not expired](./spec/acceptance/rest/auth_spec.rb#L483)
667
+ * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L488)
668
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L494)
669
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)
670
+ * [calls the Proc](./spec/acceptance/rest/auth_spec.rb#L515)
671
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L519)
672
672
  * for every subsequent #request_token
673
673
  * without a :auth_callback Proc
674
- * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L524)
674
+ * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L525)
675
675
  * with a provided block
676
- * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L531)
676
+ * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L532)
677
677
  * #create_token_request
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)
678
+ * [uses the key name from the client](./spec/acceptance/rest/auth_spec.rb#L548)
679
+ * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L552)
680
+ * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L556)
681
681
  * the nonce
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)
682
+ * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L561)
683
+ * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L566)
684
684
  * with option :ttl
685
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L576)
685
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L577)
686
686
  * with option :nonce
687
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L576)
687
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L577)
688
688
  * with option :client_id
689
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L576)
689
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L577)
690
690
  * with additional invalid attributes
691
- * [are ignored](./spec/acceptance/rest/auth_spec.rb#L584)
691
+ * [are ignored](./spec/acceptance/rest/auth_spec.rb#L585)
692
692
  * when required fields are missing
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)
693
+ * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L596)
694
+ * [should raise an exception if key name is missing](./spec/acceptance/rest/auth_spec.rb#L600)
695
695
  * with :query_time option
696
- * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L608)
696
+ * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L609)
697
697
  * with :timestamp option
698
- * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L618)
698
+ * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L619)
699
699
  * signing
700
- * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L640)
700
+ * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L641)
701
701
  * using token authentication
702
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)
703
+ * [authenticates successfully using the provided :token](./spec/acceptance/rest/auth_spec.rb#L664)
704
+ * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L668)
705
+ * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L676)
706
+ * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L684)
707
707
  * when implicit as a result of using :client id
708
708
  * and requests to the Ably server are mocked
709
- * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L711)
709
+ * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L712)
710
710
  * a token is created
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)
711
+ * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L721)
712
+ * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L725)
713
+ * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L729)
714
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)
715
+ * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L744)
716
+ * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L748)
717
+ * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L752)
718
718
 
719
719
  ### Ably::Rest
720
720
  _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
@@ -854,7 +854,7 @@ _(see [spec/acceptance/rest/encoders_spec.rb](./spec/acceptance/rest/encoders_sp
854
854
  * with UTF-8 data
855
855
  * [applies utf-8, cipher and base64 encodings and sets the encoding attribute to "utf-8/cipher+aes-128-cbc/base64"](./spec/acceptance/rest/encoders_spec.rb#L154)
856
856
  * with binary data
857
- * [applies cipher and base64 encoding and sets the encoding attribute to "utf-8/cipher+aes-128-cbc/base64"](./spec/acceptance/rest/encoders_spec.rb#L165)
857
+ * [applies cipher and base64 encoding and sets the encoding attribute to "cipher+aes-128-cbc/base64"](./spec/acceptance/rest/encoders_spec.rb#L165)
858
858
  * with JSON data
859
859
  * [applies json, utf-8, cipher and base64 encoding and sets the encoding attribute to "json/utf-8/cipher+aes-128-cbc/base64"](./spec/acceptance/rest/encoders_spec.rb#L176)
860
860
 
@@ -2068,6 +2068,6 @@ _(see [spec/unit/util/pub_sub_spec.rb](./spec/unit/util/pub_sub_spec.rb))_
2068
2068
 
2069
2069
  ## Test summary
2070
2070
 
2071
- * Passing tests: 1028
2072
- * Pending tests: 7
2071
+ * Passing tests: 1029
2072
+ * Pending tests: 6
2073
2073
  * Failing tests: 0
data/ably.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_runtime_dependency 'faraday', '~> 0.9'
25
25
  spec.add_runtime_dependency 'json'
26
26
  spec.add_runtime_dependency 'websocket-driver', '~> 0.3'
27
- spec.add_runtime_dependency 'msgpack-ably', '~> 0.5.10'
27
+ spec.add_runtime_dependency 'msgpack', '0.6.0pre1'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.3'
30
30
  spec.add_development_dependency 'rake'
@@ -60,7 +60,7 @@ module Ably
60
60
  # The HTTP request has returned a 500 error
61
61
  class ServerError < BaseAblyException; end
62
62
 
63
- # PaginatedResource cannot retrieve the page
63
+ # PaginatedResult cannot retrieve the page
64
64
  class InvalidPageError < BaseAblyException; end
65
65
 
66
66
  # The expected response from the server was invalid
@@ -74,5 +74,8 @@ module Ably
74
74
 
75
75
  # The message could not be delivered to the server
76
76
  class MessageDeliveryError < BaseAblyException; end
77
+
78
+ # The data payload type is not supported
79
+ class UnsupportedDataTypeError < BaseAblyException; end
77
80
  end
78
81
  end
@@ -6,10 +6,10 @@ module Ably::Models
6
6
  #
7
7
  # Paging information is provided by Ably in the LINK HTTP headers
8
8
  #
9
- class PaginatedResource
9
+ class PaginatedResult
10
10
  include Ably::Modules::AsyncWrapper if defined?(Ably::Realtime)
11
11
 
12
- # The items contained within this {PaginatedResource}
12
+ # The items contained within this {PaginatedResult}
13
13
  # @return [Array]
14
14
  attr_reader :items
15
15
 
@@ -17,11 +17,11 @@ module Ably::Models
17
17
  # @param [String] base_url Base URL for request that generated the http_response so that subsequent paged requests can be made
18
18
  # @param [Client] client {Ably::Client} used to make the request to Ably
19
19
  # @param [Hash] options Options for this paged resource
20
- # @option options [Symbol,String] :coerce_into symbol or string representing class that should be used to create each item in the PaginatedResource
20
+ # @option options [Symbol,String] :coerce_into symbol or string representing class that should be used to create each item in the PaginatedResult
21
21
  #
22
22
  # @yield [Object] block will be called for each resource object for the current page. This is a useful way to apply a transformation to any page resources after they are retrieved
23
23
  #
24
- # @return [PaginatedResource]
24
+ # @return [PaginatedResult]
25
25
  def initialize(http_response, base_url, client, options = {}, &each_block)
26
26
  @http_response = http_response
27
27
  @client = client
@@ -40,11 +40,11 @@ module Ably::Models
40
40
  # When used as part of the {Ably::Realtime} library, it will return a {Ably::Util::SafeDeferrable} object,
41
41
  # and allows an optional success callback block to be provided.
42
42
  #
43
- # @return [PaginatedResource,Ably::Util::SafeDeferrable]
43
+ # @return [PaginatedResult,Ably::Util::SafeDeferrable]
44
44
  def first(&success_callback)
45
45
  async_wrap_if_realtime(success_callback) do
46
46
  return nil unless supports_pagination?
47
- PaginatedResource.new(client.get(pagination_url('first')), base_url, client, pagination_options, &each_block)
47
+ PaginatedResult.new(client.get(pagination_url('first')), base_url, client, pagination_options, &each_block)
48
48
  end
49
49
  end
50
50
 
@@ -52,11 +52,11 @@ module Ably::Models
52
52
  # When used as part of the {Ably::Realtime} library, it will return a {Ably::Util::SafeDeferrable} object,
53
53
  # and allows an optional success callback block to be provided.
54
54
  #
55
- # @return [PaginatedResource,Ably::Util::SafeDeferrable]
55
+ # @return [PaginatedResult,Ably::Util::SafeDeferrable]
56
56
  def next(&success_callback)
57
57
  async_wrap_if_realtime(success_callback) do
58
58
  return nil unless has_next?
59
- PaginatedResource.new(client.get(pagination_url('next')), base_url, client, pagination_options, &each_block)
59
+ PaginatedResult.new(client.get(pagination_url('next')), base_url, client, pagination_options, &each_block)
60
60
  end
61
61
  end
62
62