ably 0.8.7 → 0.8.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -3
- data/ably.gemspec +1 -1
- data/lib/ably/auth.rb +12 -3
- data/lib/ably/logger.rb +3 -1
- data/lib/ably/models/connection_details.rb +2 -1
- data/lib/ably/models/idiomatic_ruby_wrapper.rb +1 -1
- data/lib/ably/models/message.rb +4 -2
- data/lib/ably/models/message_encoders/cipher.rb +2 -2
- data/lib/ably/models/paginated_result.rb +27 -1
- data/lib/ably/models/presence_message.rb +3 -1
- data/lib/ably/models/{stat.rb → stats.rb} +5 -3
- data/lib/ably/modules/async_wrapper.rb +1 -1
- data/lib/ably/modules/channels_collection.rb +11 -1
- data/lib/ably/modules/enum.rb +18 -2
- data/lib/ably/modules/event_emitter.rb +3 -3
- data/lib/ably/modules/safe_deferrable.rb +1 -1
- data/lib/ably/modules/safe_yield.rb +2 -2
- data/lib/ably/modules/state_emitter.rb +8 -8
- data/lib/ably/modules/statesman_monkey_patch.rb +2 -2
- data/lib/ably/modules/uses_state_machine.rb +4 -2
- data/lib/ably/realtime.rb +1 -0
- data/lib/ably/realtime/auth.rb +6 -2
- data/lib/ably/realtime/channel.rb +6 -4
- data/lib/ably/realtime/channel/channel_manager.rb +7 -1
- data/lib/ably/realtime/client.rb +7 -12
- data/lib/ably/realtime/client/incoming_message_dispatcher.rb +9 -2
- data/lib/ably/realtime/client/outgoing_message_dispatcher.rb +7 -1
- data/lib/ably/realtime/connection.rb +19 -8
- data/lib/ably/realtime/connection/connection_manager.rb +16 -9
- data/lib/ably/realtime/connection/websocket_transport.rb +12 -3
- data/lib/ably/realtime/presence.rb +6 -6
- data/lib/ably/realtime/presence/members_map.rb +21 -7
- data/lib/ably/rest/channel.rb +8 -8
- data/lib/ably/rest/client.rb +1 -1
- data/lib/ably/rest/middleware/exceptions.rb +3 -1
- data/lib/ably/rest/presence.rb +4 -4
- data/lib/ably/version.rb +1 -1
- data/spec/acceptance/realtime/channel_history_spec.rb +4 -4
- data/spec/acceptance/realtime/connection_failures_spec.rb +2 -4
- data/spec/acceptance/realtime/connection_spec.rb +46 -8
- data/spec/acceptance/realtime/presence_spec.rb +49 -34
- data/spec/acceptance/rest/auth_spec.rb +1 -1
- data/spec/acceptance/rest/base_spec.rb +1 -1
- data/spec/shared/safe_deferrable_behaviour.rb +4 -4
- data/spec/unit/models/message_encoders/cipher_spec.rb +1 -1
- data/spec/unit/models/token_details_spec.rb +20 -18
- data/spec/unit/modules/event_emitter_spec.rb +2 -2
- data/spec/unit/modules/state_emitter_spec.rb +6 -6
- data/spec/unit/realtime/channel_spec.rb +4 -4
- data/spec/unit/realtime/connection_spec.rb +1 -1
- data/spec/unit/realtime/presence_spec.rb +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b659327cc341068fce6404895940be1547529f7
|
4
|
+
data.tar.gz: 1cefe9e6c6ea0a874b71f37834088d85efd76307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca4059010c9811beb36753c2cc346c74fed4ac94a20caa45d3a62ec3d4abf5ba32dc90d0687c0f7a88bd642224e843a78dcc1a4537215d3d9a24b7adbb31c84c
|
7
|
+
data.tar.gz: a24b1ecf027d74490030d49bffafff647c4d9066b70ce603f7b82f1e987679817931267857e5087b3a0d84d197e6d058136417aa2b98c44fb7f64da109821a14
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.8.8](https://github.com/ably/ably-ruby/tree/v0.8.8)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.7...v0.8.8)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Support :key in ClientOptions and deprecate :api\_key [\#73](https://github.com/ably/ably-ruby/issues/73)
|
10
|
+
|
11
|
+
## [v0.8.7](https://github.com/ably/ably-ruby/tree/v0.8.7) (2015-12-31)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.6...v0.8.7)
|
14
|
+
|
3
15
|
## [v0.8.6](https://github.com/ably/ably-ruby/tree/v0.8.6) (2015-12-02)
|
4
16
|
|
5
17
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.5...v0.8.6)
|
@@ -13,6 +25,7 @@
|
|
13
25
|
- 0.8 final spec \(98% compliance\) [\#66](https://github.com/ably/ably-ruby/pull/66) ([mattheworiordan](https://github.com/mattheworiordan))
|
14
26
|
|
15
27
|
## [v0.8.5](https://github.com/ably/ably-ruby/tree/v0.8.5) (2015-10-08)
|
28
|
+
|
16
29
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.4...v0.8.5)
|
17
30
|
|
18
31
|
**Implemented enhancements:**
|
@@ -22,7 +35,9 @@
|
|
22
35
|
**Fixed bugs:**
|
23
36
|
|
24
37
|
- Switch arity of auth methods [\#61](https://github.com/ably/ably-ruby/issues/61)
|
38
|
+
|
25
39
|
- Add test: Message published, connection dropped, then restores to point before last message was published [\#56](https://github.com/ably/ably-ruby/issues/56)
|
40
|
+
|
26
41
|
- Documentation for constructor is incorrect [\#49](https://github.com/ably/ably-ruby/issues/49)
|
27
42
|
|
28
43
|
**Merged pull requests:**
|
@@ -30,30 +45,41 @@
|
|
30
45
|
- Ensure connections are always closed in tests [\#63](https://github.com/ably/ably-ruby/pull/63) ([mattheworiordan](https://github.com/mattheworiordan))
|
31
46
|
|
32
47
|
## [v0.8.4](https://github.com/ably/ably-ruby/tree/v0.8.4) (2015-09-08)
|
48
|
+
|
33
49
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.3...v0.8.4)
|
34
50
|
|
35
51
|
**Implemented enhancements:**
|
36
52
|
|
37
53
|
- Add compatibility support for default Crypto params [\#53](https://github.com/ably/ably-ruby/issues/53)
|
54
|
+
|
38
55
|
- EventEmitter on connection [\#52](https://github.com/ably/ably-ruby/issues/52)
|
56
|
+
|
39
57
|
- Add test for connectionId attribute for a message sent over REST [\#50](https://github.com/ably/ably-ruby/issues/50)
|
40
58
|
|
41
59
|
**Merged pull requests:**
|
42
60
|
|
43
61
|
- Spec update to fix a number of issues [\#60](https://github.com/ably/ably-ruby/pull/60) ([mattheworiordan](https://github.com/mattheworiordan))
|
62
|
+
|
44
63
|
- 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))
|
45
64
|
|
46
65
|
## [v0.8.3](https://github.com/ably/ably-ruby/tree/v0.8.3) (2015-08-19)
|
66
|
+
|
47
67
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.2...v0.8.3)
|
48
68
|
|
49
69
|
**Implemented enhancements:**
|
50
70
|
|
51
71
|
- Implement :queue\_messages option [\#36](https://github.com/ably/ably-ruby/issues/36)
|
72
|
+
|
52
73
|
- Check that a non 200-299 status code for REST requests uses fallback hosts [\#35](https://github.com/ably/ably-ruby/issues/35)
|
74
|
+
|
53
75
|
- Move stats fixtures into ably-common [\#34](https://github.com/ably/ably-ruby/issues/34)
|
76
|
+
|
54
77
|
- Add tests for messages with no data or name fields [\#21](https://github.com/ably/ably-ruby/issues/21)
|
78
|
+
|
55
79
|
- Namespace MsgPack as MsgPack5 because compliance is not merged in [\#12](https://github.com/ably/ably-ruby/issues/12)
|
80
|
+
|
56
81
|
- 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)
|
82
|
+
|
57
83
|
- Add async methods for Authentication in the realtime library [\#8](https://github.com/ably/ably-ruby/issues/8)
|
58
84
|
|
59
85
|
**Fixed bugs:**
|
@@ -63,28 +89,37 @@
|
|
63
89
|
**Closed issues:**
|
64
90
|
|
65
91
|
- Scope default token params in arguments [\#55](https://github.com/ably/ably-ruby/issues/55)
|
92
|
+
|
66
93
|
- Channel options can be reset when accessing a channel with \#get [\#46](https://github.com/ably/ably-ruby/issues/46)
|
67
94
|
|
68
95
|
**Merged pull requests:**
|
69
96
|
|
70
97
|
- Separate token params for auth [\#57](https://github.com/ably/ably-ruby/pull/57) ([mattheworiordan](https://github.com/mattheworiordan))
|
98
|
+
|
71
99
|
- Ensure files are required in a consistent order [\#51](https://github.com/ably/ably-ruby/pull/51) ([SimonWoolf](https://github.com/SimonWoolf))
|
72
100
|
|
73
101
|
## [v0.8.2](https://github.com/ably/ably-ruby/tree/v0.8.2) (2015-05-20)
|
102
|
+
|
74
103
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.1...v0.8.2)
|
75
104
|
|
76
105
|
**Implemented enhancements:**
|
77
106
|
|
78
107
|
- Ensure Array object can be used in place of Hash for payload [\#44](https://github.com/ably/ably-ruby/issues/44)
|
108
|
+
|
79
109
|
- Change connect\_automatically option to auto\_connect for consistency [\#42](https://github.com/ably/ably-ruby/issues/42)
|
110
|
+
|
80
111
|
- Rename PaginatedResource to PaginatedResult for consistency [\#40](https://github.com/ably/ably-ruby/issues/40)
|
112
|
+
|
81
113
|
- EventEmitter should use `emit` not `trigger` to be consistent with other libs [\#31](https://github.com/ably/ably-ruby/issues/31)
|
114
|
+
|
82
115
|
- Add exceptions when data attribute for messages/presence is not String, Binary or JSON data [\#4](https://github.com/ably/ably-ruby/issues/4)
|
116
|
+
|
83
117
|
- Auth Callback and Auth URL should support tokens as well as token requests [\#2](https://github.com/ably/ably-ruby/issues/2)
|
84
118
|
|
85
119
|
**Closed issues:**
|
86
120
|
|
87
121
|
- Realtime Presence\#get does not wait by default [\#47](https://github.com/ably/ably-ruby/issues/47)
|
122
|
+
|
88
123
|
- No implicit attach when accessing channel.presence [\#45](https://github.com/ably/ably-ruby/issues/45)
|
89
124
|
|
90
125
|
**Merged pull requests:**
|
@@ -92,9 +127,11 @@
|
|
92
127
|
- Reject invalid payload type [\#48](https://github.com/ably/ably-ruby/pull/48) ([mattheworiordan](https://github.com/mattheworiordan))
|
93
128
|
|
94
129
|
## [v0.8.1](https://github.com/ably/ably-ruby/tree/v0.8.1) (2015-04-23)
|
130
|
+
|
95
131
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.8.0...v0.8.1)
|
96
132
|
|
97
133
|
## [v0.8.0](https://github.com/ably/ably-ruby/tree/v0.8.0) (2015-04-23)
|
134
|
+
|
98
135
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.6...v0.8.0)
|
99
136
|
|
100
137
|
**Merged pull requests:**
|
@@ -102,15 +139,18 @@
|
|
102
139
|
- Token naming refactor [\#29](https://github.com/ably/ably-ruby/pull/29) ([mattheworiordan](https://github.com/mattheworiordan))
|
103
140
|
|
104
141
|
## [v0.7.6](https://github.com/ably/ably-ruby/tree/v0.7.6) (2015-04-17)
|
142
|
+
|
105
143
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.5...v0.7.6)
|
106
144
|
|
107
145
|
**Implemented enhancements:**
|
108
146
|
|
109
147
|
- Rename Stat to Stats for consistency [\#32](https://github.com/ably/ably-ruby/issues/32)
|
148
|
+
|
110
149
|
- Stats objects [\#24](https://github.com/ably/ably-ruby/issues/24)
|
150
|
+
|
111
151
|
- Need a test to handle errors in callbacks [\#13](https://github.com/ably/ably-ruby/issues/13)
|
152
|
+
|
112
153
|
- Allow token ID or API key in the client constructor [\#5](https://github.com/ably/ably-ruby/issues/5)
|
113
|
-
- 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))
|
114
154
|
|
115
155
|
**Fixed bugs:**
|
116
156
|
|
@@ -123,14 +163,19 @@
|
|
123
163
|
**Merged pull requests:**
|
124
164
|
|
125
165
|
- Test encoded presence fixture data for \#get & \#history [\#28](https://github.com/ably/ably-ruby/pull/28) ([mattheworiordan](https://github.com/mattheworiordan))
|
166
|
+
|
126
167
|
- Add coveralls.io coverage reporting [\#27](https://github.com/ably/ably-ruby/pull/27) ([mattheworiordan](https://github.com/mattheworiordan))
|
168
|
+
|
127
169
|
- New paginated resource [\#26](https://github.com/ably/ably-ruby/pull/26) ([mattheworiordan](https://github.com/mattheworiordan))
|
128
|
-
|
170
|
+
|
171
|
+
- 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))
|
129
172
|
|
130
173
|
## [v0.7.5](https://github.com/ably/ably-ruby/tree/v0.7.5) (2015-03-21)
|
174
|
+
|
131
175
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.4...v0.7.5)
|
132
176
|
|
133
177
|
## [v0.7.4](https://github.com/ably/ably-ruby/tree/v0.7.4) (2015-03-21)
|
178
|
+
|
134
179
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.2...v0.7.4)
|
135
180
|
|
136
181
|
**Merged pull requests:**
|
@@ -138,6 +183,7 @@
|
|
138
183
|
- Presence Member Map [\#14](https://github.com/ably/ably-ruby/pull/14) ([mattheworiordan](https://github.com/mattheworiordan))
|
139
184
|
|
140
185
|
## [v0.7.2](https://github.com/ably/ably-ruby/tree/v0.7.2) (2015-02-10)
|
186
|
+
|
141
187
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.1...v0.7.2)
|
142
188
|
|
143
189
|
**Implemented enhancements:**
|
@@ -147,12 +193,15 @@
|
|
147
193
|
**Merged pull requests:**
|
148
194
|
|
149
195
|
- Update README to include various missing snippets for core features [\#9](https://github.com/ably/ably-ruby/pull/9) ([kouno](https://github.com/kouno))
|
196
|
+
|
150
197
|
- Fix connection retry frequency [\#7](https://github.com/ably/ably-ruby/pull/7) ([kouno](https://github.com/kouno))
|
151
198
|
|
152
199
|
## [v0.7.1](https://github.com/ably/ably-ruby/tree/v0.7.1) (2015-01-18)
|
200
|
+
|
153
201
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.7.0...v0.7.1)
|
154
202
|
|
155
203
|
## [v0.7.0](https://github.com/ably/ably-ruby/tree/v0.7.0) (2015-01-12)
|
204
|
+
|
156
205
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.6.2...v0.7.0)
|
157
206
|
|
158
207
|
**Closed issues:**
|
@@ -160,30 +209,39 @@
|
|
160
209
|
- JSON encoder should only append utf-8 before a cipher encoder is applied [\#1](https://github.com/ably/ably-ruby/issues/1)
|
161
210
|
|
162
211
|
## [v0.6.2](https://github.com/ably/ably-ruby/tree/v0.6.2) (2014-12-10)
|
212
|
+
|
163
213
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.2.0...v0.6.2)
|
164
214
|
|
165
215
|
## [v0.2.0](https://github.com/ably/ably-ruby/tree/v0.2.0) (2014-12-09)
|
216
|
+
|
166
217
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.6...v0.2.0)
|
167
218
|
|
168
219
|
## [v0.1.6](https://github.com/ably/ably-ruby/tree/v0.1.6) (2014-10-31)
|
220
|
+
|
169
221
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.5...v0.1.6)
|
170
222
|
|
171
223
|
## [v0.1.5](https://github.com/ably/ably-ruby/tree/v0.1.5) (2014-10-23)
|
224
|
+
|
172
225
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.4...v0.1.5)
|
173
226
|
|
174
227
|
## [v0.1.4](https://github.com/ably/ably-ruby/tree/v0.1.4) (2014-09-27)
|
228
|
+
|
175
229
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.3...v0.1.4)
|
176
230
|
|
177
231
|
## [v0.1.3](https://github.com/ably/ably-ruby/tree/v0.1.3) (2014-09-26)
|
232
|
+
|
178
233
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.2...v0.1.3)
|
179
234
|
|
180
235
|
## [v0.1.2](https://github.com/ably/ably-ruby/tree/v0.1.2) (2014-09-25)
|
236
|
+
|
181
237
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.1...v0.1.2)
|
182
238
|
|
183
239
|
## [v0.1.1](https://github.com/ably/ably-ruby/tree/v0.1.1) (2014-09-23)
|
240
|
+
|
184
241
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v0.1.0...v0.1.1)
|
185
242
|
|
186
243
|
## [v0.1.0](https://github.com/ably/ably-ruby/tree/v0.1.0) (2014-09-23)
|
187
244
|
|
188
245
|
|
189
|
-
|
246
|
+
|
247
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/ably.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency 'statesman', '~> 1.0.0'
|
24
24
|
spec.add_runtime_dependency 'faraday', '~> 0.9'
|
25
25
|
spec.add_runtime_dependency 'json'
|
26
|
-
spec.add_runtime_dependency 'websocket-driver', '~> 0.
|
26
|
+
spec.add_runtime_dependency 'websocket-driver', '~> 0.6'
|
27
27
|
spec.add_runtime_dependency 'msgpack', '>= 0.6.2'
|
28
28
|
spec.add_runtime_dependency 'addressable', '>= 2.0.0'
|
29
29
|
|
data/lib/ably/auth.rb
CHANGED
@@ -54,6 +54,10 @@ module Ably
|
|
54
54
|
raise ArgumentError, 'Expected token_params to be a Hash'
|
55
55
|
end
|
56
56
|
|
57
|
+
# Ensure instance variables are defined
|
58
|
+
@client_id = nil
|
59
|
+
@client_id_validated = nil
|
60
|
+
|
57
61
|
ensure_valid_auth_attributes auth_options
|
58
62
|
|
59
63
|
@client = client
|
@@ -401,8 +405,13 @@ module Ably
|
|
401
405
|
end
|
402
406
|
|
403
407
|
private
|
404
|
-
|
405
|
-
|
408
|
+
def client
|
409
|
+
@client
|
410
|
+
end
|
411
|
+
|
412
|
+
def token_option
|
413
|
+
@token_option
|
414
|
+
end
|
406
415
|
|
407
416
|
def ensure_valid_auth_attributes(attributes)
|
408
417
|
if attributes[:timestamp]
|
@@ -453,7 +462,7 @@ module Ably
|
|
453
462
|
end
|
454
463
|
|
455
464
|
def split_api_key_into_key_and_secret!(options)
|
456
|
-
api_key_parts = options[:key].to_s.match(/(?<name>[\
|
465
|
+
api_key_parts = options[:key].to_s.match(/(?<name>[\w-]+\.[\w-]+):(?<secret>[\w-]+)/)
|
457
466
|
raise ArgumentError, 'key is invalid' unless api_key_parts
|
458
467
|
|
459
468
|
options[:key_name] = api_key_parts[:name].encode(Encoding::UTF_8)
|
data/lib/ably/logger.rb
CHANGED
@@ -28,6 +28,7 @@ module Ably::Models
|
|
28
28
|
# @option attributes [Integer] :max_frame_size maximum size for a single frame of data sent to Ably. This restriction applies to a {Ably::Models::ProtocolMessage} sent over a realtime connection, or the total body size for a REST request
|
29
29
|
# @option attributes [Integer] :max_inbound_rate maximum allowable number of requests per second from a client
|
30
30
|
# @option attributes [Integer] :connection_state_ttl duration in seconds that Ably will persist the connection state when a Realtime client is abruptly disconnected
|
31
|
+
# @option attributes [String] :server_id unique identifier of the Ably server where the connection is established
|
31
32
|
#
|
32
33
|
def initialize(attributes = {})
|
33
34
|
@hash_object = IdiomaticRubyWrapper(attributes.clone)
|
@@ -35,7 +36,7 @@ module Ably::Models
|
|
35
36
|
hash.freeze
|
36
37
|
end
|
37
38
|
|
38
|
-
%w(client_id connection_key max_message_size max_frame_size max_inbound_rate connection_state_ttl).each do |attribute|
|
39
|
+
%w(client_id connection_key max_message_size max_frame_size max_inbound_rate connection_state_ttl server_id).each do |attribute|
|
39
40
|
define_method attribute do
|
40
41
|
hash[attribute.to_sym]
|
41
42
|
end
|
@@ -150,7 +150,7 @@ module Ably::Models
|
|
150
150
|
# wrapper.as_json({ 'mixedCase': true, 'snakeCase': 1 })
|
151
151
|
def as_json(*args)
|
152
152
|
hash.each_with_object({}) do |key_val, new_hash|
|
153
|
-
key
|
153
|
+
key = key_val[0]
|
154
154
|
mixed_case_key = convert_to_mixed_case(key)
|
155
155
|
wrapped_val = self[key]
|
156
156
|
wrapped_val = wrapped_val.as_json(args) if wrapped_val.kind_of?(IdiomaticRubyWrapper)
|
data/lib/ably/models/message.rb
CHANGED
@@ -62,7 +62,7 @@ module Ably::Models
|
|
62
62
|
ensure_utf_8 :encoding, encoding, allow_nil: true
|
63
63
|
end
|
64
64
|
|
65
|
-
%w( name client_id encoding
|
65
|
+
%w( name client_id encoding ).each do |attribute|
|
66
66
|
define_method attribute do
|
67
67
|
hash[attribute.to_sym]
|
68
68
|
end
|
@@ -120,7 +120,9 @@ module Ably::Models
|
|
120
120
|
end
|
121
121
|
|
122
122
|
private
|
123
|
-
|
123
|
+
def raw_hash_object
|
124
|
+
@raw_hash_object
|
125
|
+
end
|
124
126
|
|
125
127
|
def protocol_message_index
|
126
128
|
protocol_message.messages.map(&:object_id).index(self.object_id)
|
@@ -73,11 +73,11 @@ module Ably::Models::MessageEncoders
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def cipher_algorithm(message)
|
76
|
-
current_encoding_part(message).to_s[/^#{ENCODING_ID}\+([\
|
76
|
+
current_encoding_part(message).to_s[/^#{ENCODING_ID}\+([\w-]+)$/, 1]
|
77
77
|
end
|
78
78
|
|
79
79
|
def already_encrypted?(message)
|
80
|
-
message.fetch(:encoding, '').to_s.match(%r{(^|/)#{ENCODING_ID}\+([\
|
80
|
+
message.fetch(:encoding, '').to_s.match(%r{(^|/)#{ENCODING_ID}\+([\w-]+)($|/)})
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -95,7 +95,33 @@ module Ably::Models
|
|
95
95
|
end
|
96
96
|
|
97
97
|
private
|
98
|
-
|
98
|
+
def http_response
|
99
|
+
@http_response
|
100
|
+
end
|
101
|
+
|
102
|
+
def base_url
|
103
|
+
@base_url
|
104
|
+
end
|
105
|
+
|
106
|
+
def client
|
107
|
+
@client
|
108
|
+
end
|
109
|
+
|
110
|
+
def coerce_into
|
111
|
+
@coerce_into
|
112
|
+
end
|
113
|
+
|
114
|
+
def raw_body
|
115
|
+
@raw_body
|
116
|
+
end
|
117
|
+
|
118
|
+
def each_block
|
119
|
+
@each_block
|
120
|
+
end
|
121
|
+
|
122
|
+
def make_async
|
123
|
+
@make_async
|
124
|
+
end
|
99
125
|
|
100
126
|
def coerce_items_into(items, type_string)
|
101
127
|
items.map do |item|
|
@@ -82,7 +82,7 @@ module Ably::Models
|
|
82
82
|
def from_interval_id(interval_id)
|
83
83
|
raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String)
|
84
84
|
|
85
|
-
format = INTERVAL_FORMAT_STRING.find { |
|
85
|
+
format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length }
|
86
86
|
raise ArgumentError, 'Interval ID is an invalid length' unless format
|
87
87
|
|
88
88
|
Time.strptime("#{interval_id} +0000", "#{format} %z").utc
|
@@ -99,7 +99,7 @@ module Ably::Models
|
|
99
99
|
def granularity_from_interval_id(interval_id)
|
100
100
|
raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String)
|
101
101
|
|
102
|
-
format = INTERVAL_FORMAT_STRING.find { |
|
102
|
+
format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length }
|
103
103
|
raise ArgumentError, 'Interval ID is an invalid length' unless format
|
104
104
|
|
105
105
|
GRANULARITY[INTERVAL_FORMAT_STRING.index(format)]
|
@@ -195,7 +195,9 @@ module Ably::Models
|
|
195
195
|
end
|
196
196
|
|
197
197
|
private
|
198
|
-
|
198
|
+
def raw_hash_object
|
199
|
+
@raw_hash_object
|
200
|
+
end
|
199
201
|
|
200
202
|
def set_hash_object(hash)
|
201
203
|
@hash_object = IdiomaticRubyWrapper(hash.clone.freeze)
|
@@ -42,7 +42,7 @@ module Ably::Modules
|
|
42
42
|
raise ArgumentError, 'Block required' unless block_given?
|
43
43
|
|
44
44
|
Ably::Util::SafeDeferrable.new(logger).tap do |deferrable|
|
45
|
-
deferrable.callback
|
45
|
+
deferrable.callback(&success_callback) if success_callback
|
46
46
|
|
47
47
|
operation_with_exception_handling = proc do
|
48
48
|
begin
|