ably 0.8.14 → 0.8.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7ff0fc1dc14fc84ea707c200752a84943571d53
4
- data.tar.gz: 7ba75aa7a6bfdacd097ffa694409bb172711eddb
3
+ metadata.gz: 9214384ab04b11d18a4cbcd0cfa430854bf04e52
4
+ data.tar.gz: 945b41698a5cf1cccfd98b3dfa9e7f9894fcd1a5
5
5
  SHA512:
6
- metadata.gz: 8eaf2f813c5003c87c64c0f9dbd33e6231ac1d9c1fbd2a1e07117f566c648b6eed4fd50eb4ec15e622bf510dc225e70cd3d6a42dfe25ca4da8ca69529d5001f4
7
- data.tar.gz: f07522639b0068f1a1aea116d04bcfbc745d7d9862ad12ea64111921854c1da4eb785480f2c5881083c0aa30c052ce1741552ad8b8195c7fd75f4868df58a556
6
+ metadata.gz: 371d2f0d7a4200d6bb7946e2fba94b9bed19176d76140fd05335206c7ee3af20fd54ac2c7c3d0477bd004131fb835ee54b74779060de1fff2c1b3e0251b82ee4
7
+ data.tar.gz: 6c6722c07d086c2ecfc6825c4d406a3b66f22df079b50690dc2912875669e0d5beba5e2ec566ec9e9bfdb2e7ab32bfd1abec552c3c3b65568fd170d7b0cc02d6
@@ -1,7 +1,52 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased](https://github.com/ably/ably-ruby/tree/v0.8.14)
3
+ ## [v0.8.15](https://github.com/ably/ably-ruby/tree/v0.8.15)
4
4
 
5
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.14...v0.8.15)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Fix HttpRequest & HttpRetry timeouts [\#110](https://github.com/ably/ably-ruby/issues/110)
10
+ - Logger should take blocks [\#107](https://github.com/ably/ably-ruby/issues/107)
11
+ - 0.9: Use separate internal/external listeners [\#106](https://github.com/ably/ably-ruby/issues/106)
12
+ - Add reuse library test [\#83](https://github.com/ably/ably-ruby/issues/83)
13
+ - 0.8 final spec check [\#71](https://github.com/ably/ably-ruby/issues/71)
14
+ - Use connection\#id not connection\#key to determine if connection has been resumed [\#62](https://github.com/ably/ably-ruby/issues/62)
15
+ - Channel Presence suspended state [\#41](https://github.com/ably/ably-ruby/issues/41)
16
+ - Attach / detach timeouts + protocol error handling for Channel [\#38](https://github.com/ably/ably-ruby/issues/38)
17
+ - Connection retry and timeout needs to be configurable [\#6](https://github.com/ably/ably-ruby/issues/6)
18
+
19
+ **Fixed bugs:**
20
+
21
+ - Subscribing to all connection state changes doesn't work [\#103](https://github.com/ably/ably-ruby/issues/103)
22
+ - Ensure DETACHED or DISCONNECTED with error is non-fatal [\#93](https://github.com/ably/ably-ruby/issues/93)
23
+ - Incorrect assumption for channel errors [\#91](https://github.com/ably/ably-ruby/issues/91)
24
+ - authCallback assumes a blocking callback, even in EM [\#89](https://github.com/ably/ably-ruby/issues/89)
25
+ - Token Reauth error codes [\#86](https://github.com/ably/ably-ruby/issues/86)
26
+ - Do not persist authorise attributes force & timestamp [\#72](https://github.com/ably/ably-ruby/issues/72)
27
+ - 0.8 final spec check [\#71](https://github.com/ably/ably-ruby/issues/71)
28
+ - Receiving CONNECTED when already connected [\#69](https://github.com/ably/ably-ruby/issues/69)
29
+ - Connection\#connect callback may not be called as expected [\#68](https://github.com/ably/ably-ruby/issues/68)
30
+ - nodename nor servname provided [\#65](https://github.com/ably/ably-ruby/issues/65)
31
+ - Channel Presence suspended state [\#41](https://github.com/ably/ably-ruby/issues/41)
32
+ - Intermittent test fixes [\#33](https://github.com/ably/ably-ruby/issues/33)
33
+
34
+ **Closed issues:**
35
+
36
+ - Remove deprecated ProtocolMessage\#connectionKey [\#108](https://github.com/ably/ably-ruby/issues/108)
37
+ - 0.9 Extras field [\#105](https://github.com/ably/ably-ruby/issues/105)
38
+ - 0.9 UPDATE spec [\#104](https://github.com/ably/ably-ruby/issues/104)
39
+ - Token issue bug [\#75](https://github.com/ably/ably-ruby/issues/75)
40
+ - Ensure client\_id provided is string or cast to string in Auth request\_token [\#74](https://github.com/ably/ably-ruby/issues/74)
41
+ - Standardise timeouts [\#64](https://github.com/ably/ably-ruby/issues/64)
42
+ - Ensure RSpec retry compatibility is used [\#54](https://github.com/ably/ably-ruby/issues/54)
43
+ - Spec validation [\#43](https://github.com/ably/ably-ruby/issues/43)
44
+
45
+ **Merged pull requests:**
46
+
47
+ - From encoded [\#101](https://github.com/ably/ably-ruby/pull/101) ([mattheworiordan](https://github.com/mattheworiordan))
48
+
49
+ ## [v0.8.14](https://github.com/ably/ably-ruby/tree/v0.8.14) (2016-09-30)
5
50
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.13...v0.8.14)
6
51
 
7
52
  **Fixed bugs:**
@@ -17,7 +62,6 @@
17
62
  - Fallback host improvements [\#97](https://github.com/ably/ably-ruby/pull/97) ([mattheworiordan](https://github.com/mattheworiordan))
18
63
 
19
64
  ## [v0.8.13](https://github.com/ably/ably-ruby/tree/v0.8.13) (2016-09-29)
20
-
21
65
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.12...v0.8.13)
22
66
 
23
67
  **Merged pull requests:**
@@ -25,7 +69,6 @@
25
69
  - Ensure interoperability with other libraries with JSON protocol [\#94](https://github.com/ably/ably-ruby/pull/94) ([mattheworiordan](https://github.com/mattheworiordan))
26
70
 
27
71
  ## [v0.8.12](https://github.com/ably/ably-ruby/tree/v0.8.12) (2016-05-23)
28
-
29
72
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.11...v0.8.12)
30
73
 
31
74
  **Fixed bugs:**
@@ -37,7 +80,6 @@
37
80
  - Reauthorise [\#90](https://github.com/ably/ably-ruby/pull/90) ([mattheworiordan](https://github.com/mattheworiordan))
38
81
 
39
82
  ## [v0.8.11](https://github.com/ably/ably-ruby/tree/v0.8.11) (2016-04-05)
40
-
41
83
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.10...v0.8.11)
42
84
 
43
85
  **Merged pull requests:**
@@ -45,17 +87,14 @@
45
87
  - Ensure message emitter callbacks are safe \(i.e. cannot break the EM\) [\#85](https://github.com/ably/ably-ruby/pull/85) ([mattheworiordan](https://github.com/mattheworiordan))
46
88
 
47
89
  ## [v0.8.10](https://github.com/ably/ably-ruby/tree/v0.8.10) (2016-04-01)
48
-
49
90
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.9...v0.8.10)
50
91
 
51
92
  ## [v0.8.9](https://github.com/ably/ably-ruby/tree/v0.8.9) (2016-03-01)
52
-
53
93
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.8...v0.8.9)
54
94
 
55
95
  **Fixed bugs:**
56
96
 
57
97
  - Support enter\(data\) [\#79](https://github.com/ably/ably-ruby/issues/79)
58
-
59
98
  - Update documentation to hide private API methods [\#77](https://github.com/ably/ably-ruby/issues/77)
60
99
 
61
100
  **Closed issues:**
@@ -65,11 +104,9 @@
65
104
  **Merged pull requests:**
66
105
 
67
106
  - Various fixes for open issues [\#82](https://github.com/ably/ably-ruby/pull/82) ([mattheworiordan](https://github.com/mattheworiordan))
68
-
69
107
  - Encryption spec update [\#81](https://github.com/ably/ably-ruby/pull/81) ([mattheworiordan](https://github.com/mattheworiordan))
70
108
 
71
109
  ## [v0.8.8](https://github.com/ably/ably-ruby/tree/v0.8.8) (2016-01-26)
72
-
73
110
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.7...v0.8.8)
74
111
 
75
112
  **Closed issues:**
@@ -77,23 +114,18 @@
77
114
  - Support :key in ClientOptions and deprecate :api\_key [\#73](https://github.com/ably/ably-ruby/issues/73)
78
115
 
79
116
  ## [v0.8.7](https://github.com/ably/ably-ruby/tree/v0.8.7) (2015-12-31)
80
-
81
117
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.6...v0.8.7)
82
118
 
83
119
  ## [v0.8.6](https://github.com/ably/ably-ruby/tree/v0.8.6) (2015-12-02)
84
-
85
120
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.5...v0.8.6)
86
121
 
87
122
  **Merged pull requests:**
88
123
 
89
124
  - Some intermittent test fixes & enable tests that were blocked [\#70](https://github.com/ably/ably-ruby/pull/70) ([mattheworiordan](https://github.com/mattheworiordan))
90
-
91
125
  - Output detailed log for any text failures [\#67](https://github.com/ably/ably-ruby/pull/67) ([mattheworiordan](https://github.com/mattheworiordan))
92
-
93
126
  - 0.8 final spec \(98% compliance\) [\#66](https://github.com/ably/ably-ruby/pull/66) ([mattheworiordan](https://github.com/mattheworiordan))
94
127
 
95
128
  ## [v0.8.5](https://github.com/ably/ably-ruby/tree/v0.8.5) (2015-10-08)
96
-
97
129
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.4...v0.8.5)
98
130
 
99
131
  **Implemented enhancements:**
@@ -103,9 +135,7 @@
103
135
  **Fixed bugs:**
104
136
 
105
137
  - Switch arity of auth methods [\#61](https://github.com/ably/ably-ruby/issues/61)
106
-
107
138
  - Add test: Message published, connection dropped, then restores to point before last message was published [\#56](https://github.com/ably/ably-ruby/issues/56)
108
-
109
139
  - Documentation for constructor is incorrect [\#49](https://github.com/ably/ably-ruby/issues/49)
110
140
 
111
141
  **Merged pull requests:**
@@ -113,41 +143,30 @@
113
143
  - Ensure connections are always closed in tests [\#63](https://github.com/ably/ably-ruby/pull/63) ([mattheworiordan](https://github.com/mattheworiordan))
114
144
 
115
145
  ## [v0.8.4](https://github.com/ably/ably-ruby/tree/v0.8.4) (2015-09-08)
116
-
117
146
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.3...v0.8.4)
118
147
 
119
148
  **Implemented enhancements:**
120
149
 
121
150
  - Add compatibility support for default Crypto params [\#53](https://github.com/ably/ably-ruby/issues/53)
122
-
123
151
  - EventEmitter on connection [\#52](https://github.com/ably/ably-ruby/issues/52)
124
-
125
152
  - Add test for connectionId attribute for a message sent over REST [\#50](https://github.com/ably/ably-ruby/issues/50)
126
153
 
127
154
  **Merged pull requests:**
128
155
 
129
156
  - Spec update to fix a number of issues [\#60](https://github.com/ably/ably-ruby/pull/60) ([mattheworiordan](https://github.com/mattheworiordan))
130
-
131
157
  - Allow clientId to be provided on init if using externally created token [\#58](https://github.com/ably/ably-ruby/pull/58) ([SimonWoolf](https://github.com/SimonWoolf))
132
158
 
133
159
  ## [v0.8.3](https://github.com/ably/ably-ruby/tree/v0.8.3) (2015-08-19)
134
-
135
160
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.2...v0.8.3)
136
161
 
137
162
  **Implemented enhancements:**
138
163
 
139
164
  - Implement :queue\_messages option [\#36](https://github.com/ably/ably-ruby/issues/36)
140
-
141
165
  - Check that a non 200-299 status code for REST requests uses fallback hosts [\#35](https://github.com/ably/ably-ruby/issues/35)
142
-
143
166
  - Move stats fixtures into ably-common [\#34](https://github.com/ably/ably-ruby/issues/34)
144
-
145
167
  - Add tests for messages with no data or name fields [\#21](https://github.com/ably/ably-ruby/issues/21)
146
-
147
168
  - Namespace MsgPack as MsgPack5 because compliance is not merged in [\#12](https://github.com/ably/ably-ruby/issues/12)
148
-
149
169
  - Add test coverage for receiving messages more than once i.e. historical messages resent somehow on reconnect [\#11](https://github.com/ably/ably-ruby/issues/11)
150
-
151
170
  - Add async methods for Authentication in the realtime library [\#8](https://github.com/ably/ably-ruby/issues/8)
152
171
 
153
172
  **Fixed bugs:**
@@ -157,37 +176,28 @@
157
176
  **Closed issues:**
158
177
 
159
178
  - Scope default token params in arguments [\#55](https://github.com/ably/ably-ruby/issues/55)
160
-
161
179
  - Channel options can be reset when accessing a channel with \#get [\#46](https://github.com/ably/ably-ruby/issues/46)
162
180
 
163
181
  **Merged pull requests:**
164
182
 
165
183
  - Separate token params for auth [\#57](https://github.com/ably/ably-ruby/pull/57) ([mattheworiordan](https://github.com/mattheworiordan))
166
-
167
184
  - Ensure files are required in a consistent order [\#51](https://github.com/ably/ably-ruby/pull/51) ([SimonWoolf](https://github.com/SimonWoolf))
168
185
 
169
186
  ## [v0.8.2](https://github.com/ably/ably-ruby/tree/v0.8.2) (2015-05-20)
170
-
171
187
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.1...v0.8.2)
172
188
 
173
189
  **Implemented enhancements:**
174
190
 
175
191
  - Ensure Array object can be used in place of Hash for payload [\#44](https://github.com/ably/ably-ruby/issues/44)
176
-
177
192
  - Change connect\_automatically option to auto\_connect for consistency [\#42](https://github.com/ably/ably-ruby/issues/42)
178
-
179
193
  - Rename PaginatedResource to PaginatedResult for consistency [\#40](https://github.com/ably/ably-ruby/issues/40)
180
-
181
194
  - EventEmitter should use `emit` not `trigger` to be consistent with other libs [\#31](https://github.com/ably/ably-ruby/issues/31)
182
-
183
195
  - Add exceptions when data attribute for messages/presence is not String, Binary or JSON data [\#4](https://github.com/ably/ably-ruby/issues/4)
184
-
185
196
  - Auth Callback and Auth URL should support tokens as well as token requests [\#2](https://github.com/ably/ably-ruby/issues/2)
186
197
 
187
198
  **Closed issues:**
188
199
 
189
200
  - Realtime Presence\#get does not wait by default [\#47](https://github.com/ably/ably-ruby/issues/47)
190
-
191
201
  - No implicit attach when accessing channel.presence [\#45](https://github.com/ably/ably-ruby/issues/45)
192
202
 
193
203
  **Merged pull requests:**
@@ -195,11 +205,9 @@
195
205
  - Reject invalid payload type [\#48](https://github.com/ably/ably-ruby/pull/48) ([mattheworiordan](https://github.com/mattheworiordan))
196
206
 
197
207
  ## [v0.8.1](https://github.com/ably/ably-ruby/tree/v0.8.1) (2015-04-23)
198
-
199
208
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.0...v0.8.1)
200
209
 
201
210
  ## [v0.8.0](https://github.com/ably/ably-ruby/tree/v0.8.0) (2015-04-23)
202
-
203
211
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.6...v0.8.0)
204
212
 
205
213
  **Merged pull requests:**
@@ -207,18 +215,15 @@
207
215
  - Token naming refactor [\#29](https://github.com/ably/ably-ruby/pull/29) ([mattheworiordan](https://github.com/mattheworiordan))
208
216
 
209
217
  ## [v0.7.6](https://github.com/ably/ably-ruby/tree/v0.7.6) (2015-04-17)
210
-
211
218
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.5...v0.7.6)
212
219
 
213
220
  **Implemented enhancements:**
214
221
 
215
222
  - Rename Stat to Stats for consistency [\#32](https://github.com/ably/ably-ruby/issues/32)
216
-
217
223
  - Stats objects [\#24](https://github.com/ably/ably-ruby/issues/24)
218
-
219
224
  - Need a test to handle errors in callbacks [\#13](https://github.com/ably/ably-ruby/issues/13)
220
-
221
225
  - Allow token ID or API key in the client constructor [\#5](https://github.com/ably/ably-ruby/issues/5)
226
+ - Typed stats similar to Java library + zero default for empty stats [\#25](https://github.com/ably/ably-ruby/pull/25) ([mattheworiordan](https://github.com/mattheworiordan))
222
227
 
223
228
  **Fixed bugs:**
224
229
 
@@ -231,19 +236,14 @@
231
236
  **Merged pull requests:**
232
237
 
233
238
  - Test encoded presence fixture data for \#get & \#history [\#28](https://github.com/ably/ably-ruby/pull/28) ([mattheworiordan](https://github.com/mattheworiordan))
234
-
235
239
  - Add coveralls.io coverage reporting [\#27](https://github.com/ably/ably-ruby/pull/27) ([mattheworiordan](https://github.com/mattheworiordan))
236
-
237
240
  - New paginated resource [\#26](https://github.com/ably/ably-ruby/pull/26) ([mattheworiordan](https://github.com/mattheworiordan))
238
-
239
- - Typed stats similar to Java library + zero default for empty stats [\#25](https://github.com/ably/ably-ruby/pull/25) ([mattheworiordan](https://github.com/mattheworiordan))
241
+ - History since attach [\#22](https://github.com/ably/ably-ruby/pull/22) ([mattheworiordan](https://github.com/mattheworiordan))
240
242
 
241
243
  ## [v0.7.5](https://github.com/ably/ably-ruby/tree/v0.7.5) (2015-03-21)
242
-
243
244
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.4...v0.7.5)
244
245
 
245
246
  ## [v0.7.4](https://github.com/ably/ably-ruby/tree/v0.7.4) (2015-03-21)
246
-
247
247
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.2...v0.7.4)
248
248
 
249
249
  **Merged pull requests:**
@@ -251,7 +251,6 @@
251
251
  - Presence Member Map [\#14](https://github.com/ably/ably-ruby/pull/14) ([mattheworiordan](https://github.com/mattheworiordan))
252
252
 
253
253
  ## [v0.7.2](https://github.com/ably/ably-ruby/tree/v0.7.2) (2015-02-10)
254
-
255
254
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.1...v0.7.2)
256
255
 
257
256
  **Implemented enhancements:**
@@ -261,15 +260,12 @@
261
260
  **Merged pull requests:**
262
261
 
263
262
  - Update README to include various missing snippets for core features [\#9](https://github.com/ably/ably-ruby/pull/9) ([kouno](https://github.com/kouno))
264
-
265
263
  - Fix connection retry frequency [\#7](https://github.com/ably/ably-ruby/pull/7) ([kouno](https://github.com/kouno))
266
264
 
267
265
  ## [v0.7.1](https://github.com/ably/ably-ruby/tree/v0.7.1) (2015-01-18)
268
-
269
266
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.0...v0.7.1)
270
267
 
271
268
  ## [v0.7.0](https://github.com/ably/ably-ruby/tree/v0.7.0) (2015-01-12)
272
-
273
269
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.6.2...v0.7.0)
274
270
 
275
271
  **Closed issues:**
@@ -277,39 +273,30 @@
277
273
  - JSON encoder should only append utf-8 before a cipher encoder is applied [\#1](https://github.com/ably/ably-ruby/issues/1)
278
274
 
279
275
  ## [v0.6.2](https://github.com/ably/ably-ruby/tree/v0.6.2) (2014-12-10)
280
-
281
276
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.2.0...v0.6.2)
282
277
 
283
278
  ## [v0.2.0](https://github.com/ably/ably-ruby/tree/v0.2.0) (2014-12-09)
284
-
285
279
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.6...v0.2.0)
286
280
 
287
281
  ## [v0.1.6](https://github.com/ably/ably-ruby/tree/v0.1.6) (2014-10-31)
288
-
289
282
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.5...v0.1.6)
290
283
 
291
284
  ## [v0.1.5](https://github.com/ably/ably-ruby/tree/v0.1.5) (2014-10-23)
292
-
293
285
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.4...v0.1.5)
294
286
 
295
287
  ## [v0.1.4](https://github.com/ably/ably-ruby/tree/v0.1.4) (2014-09-27)
296
-
297
288
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.3...v0.1.4)
298
289
 
299
290
  ## [v0.1.3](https://github.com/ably/ably-ruby/tree/v0.1.3) (2014-09-26)
300
-
301
291
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.2...v0.1.3)
302
292
 
303
293
  ## [v0.1.2](https://github.com/ably/ably-ruby/tree/v0.1.2) (2014-09-25)
304
-
305
294
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.1...v0.1.2)
306
295
 
307
296
  ## [v0.1.1](https://github.com/ably/ably-ruby/tree/v0.1.1) (2014-09-23)
308
-
309
297
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.0...v0.1.1)
310
298
 
311
299
  ## [v0.1.0](https://github.com/ably/ably-ruby/tree/v0.1.0) (2014-09-23)
312
300
 
313
301
 
314
-
315
302
  \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/README.md CHANGED
@@ -24,6 +24,12 @@ And then install this Bundler dependency:
24
24
  Or install it yourself as:
25
25
 
26
26
  $ gem install ably
27
+
28
+ ### Using with Rails or Sinatra
29
+
30
+ This `ably` gem provides both a [Realtime](http://www.ably.io/documentation/realtime/usage) and [REST](http://www.ably.io/documentation/rest/usage) version of the Ably library. Realtime depends on EventMachine to provide an asynchronous evented framework to run the library in, whereas the REST library depends only on synchronous libraries such as Faraday.
31
+
32
+ If you are using Ably within your Rails or Sinatra apps, more often than not, you probably want to use the REST only version of the library that has no dependency on EventMachine and provides a synchronous API that you will be used to using within Rails and Sinatra. [See the REST only Ruby version of the Ably library](https://github.com/ably/ably-ruby-rest).
27
33
 
28
34
  ## Using the Realtime API
29
35
 
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'rspec', '~> 3.2.0' # version lock, see config.around(:example, :event_machine) in event_machine_helper.rb
38
38
  spec.add_development_dependency 'rspec-retry'
39
39
  spec.add_development_dependency 'yard'
40
- spec.add_development_dependency 'webmock'
40
+ spec.add_development_dependency 'webmock', '~> 2.3.0'
41
41
 
42
42
  spec.add_development_dependency 'coveralls'
43
43
 
@@ -0,0 +1,90 @@
1
+ require 'ably/models/paginated_result'
2
+
3
+ module Ably::Models
4
+ # HTTP respones object from Rest#request object
5
+ # Wraps any Ably HTTP response that supports paging and provides methods to iterate through
6
+ # the pages using {#first}, {#next}, {#has_next?} and {#last?}
7
+
8
+ class HttpPaginatedResponse < PaginatedResult
9
+ # Retrieve the first page of results.
10
+ # When used as part of the {Ably::Realtime} library, it will return a {Ably::Util::SafeDeferrable} object,
11
+ # and allows an optional success callback block to be provided.
12
+ #
13
+ # @return [HttpPaginatedResponse,Ably::Util::SafeDeferrable]
14
+ def first(&success_callback)
15
+ async_wrap_if_realtime(success_callback) do
16
+ return nil unless supports_pagination?
17
+ HttpPaginatedResponse.new(client.get(pagination_url('first')), base_url, client, pagination_options, &each_block)
18
+ end
19
+ end
20
+
21
+ # Retrieve the next page of results.
22
+ # When used as part of the {Ably::Realtime} library, it will return a {Ably::Util::SafeDeferrable} object,
23
+ # and allows an optional success callback block to be provided.
24
+ #
25
+ # @return [HttpPaginatedResponse,Ably::Util::SafeDeferrable]
26
+ def next(&success_callback)
27
+ async_wrap_if_realtime(success_callback) do
28
+ return nil unless has_next?
29
+ HttpPaginatedResponse.new(client.get(pagination_url('next')), base_url, client, pagination_options, &each_block)
30
+ end
31
+ end
32
+
33
+ # HTTP status code for response
34
+ # @return [Integer]
35
+ def status_code
36
+ http_response.status.to_i
37
+ end
38
+
39
+ # True if the response is considered successful due to the HTTP status code
40
+ # @return [Boolean]
41
+ def success?
42
+ (200..299).include?(http_response.status.to_i)
43
+ end
44
+
45
+ # Ably error code from +X-Ably-Errorcode+ header if available from response
46
+ # @return [Integer]
47
+ def error_code
48
+ if http_response.headers['X-Ably-Errorcode']
49
+ http_response.headers['X-Ably-Errorcode'].to_i
50
+ end
51
+ end
52
+
53
+ # Error message from +X-Ably-Errormessage+ header if available from response
54
+ # @return [String]
55
+ def error_message
56
+ http_response.headers['X-Ably-Errormessage']
57
+ end
58
+
59
+ # Headers for the HTTP response
60
+ # @return [Hash<String, String>]
61
+ def headers
62
+ http_response.headers || {}
63
+ end
64
+
65
+ # Farady compatible response object used when an exception is raised
66
+ # @api private
67
+ class ErrorResponse
68
+ def initialize(status, error_code, error_message)
69
+ @status = status
70
+ @error_code = error_code
71
+ @error_message = error_message
72
+ end
73
+
74
+ def status
75
+ @status
76
+ end
77
+
78
+ def headers
79
+ {
80
+ 'X-Ably-Errorcode' => @error_code,
81
+ 'X-Ably-Errormessage' => @error_message
82
+ }
83
+ end
84
+
85
+ def body
86
+ nil
87
+ end
88
+ end
89
+ end
90
+ end