ably 1.1.6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check.yml +15 -1
- data/CHANGELOG.md +131 -0
- data/COPYRIGHT +1 -1
- data/README.md +14 -2
- data/SPEC.md +0 -7
- data/UPDATING.md +30 -0
- data/ably.gemspec +12 -7
- data/lib/ably/agent.rb +3 -0
- data/lib/ably/auth.rb +3 -3
- data/lib/ably/exceptions.rb +6 -0
- data/lib/ably/models/channel_options.rb +97 -0
- data/lib/ably/models/connection_details.rb +8 -0
- data/lib/ably/models/delta_extras.rb +29 -0
- data/lib/ably/models/error_info.rb +6 -2
- data/lib/ably/models/idiomatic_ruby_wrapper.rb +4 -0
- data/lib/ably/models/message.rb +28 -3
- data/lib/ably/models/presence_message.rb +14 -0
- data/lib/ably/models/protocol_message.rb +29 -12
- data/lib/ably/models/token_details.rb +7 -2
- data/lib/ably/modules/channels_collection.rb +22 -2
- data/lib/ably/modules/conversions.rb +34 -0
- data/lib/ably/realtime/channel/channel_manager.rb +18 -6
- data/lib/ably/realtime/channel/channel_state_machine.rb +10 -1
- data/lib/ably/realtime/channel/publisher.rb +6 -0
- data/lib/ably/realtime/channel.rb +54 -22
- data/lib/ably/realtime/channels.rb +1 -1
- data/lib/ably/realtime/client/incoming_message_dispatcher.rb +14 -6
- data/lib/ably/realtime/connection/connection_manager.rb +13 -4
- data/lib/ably/realtime/connection/connection_state_machine.rb +4 -0
- data/lib/ably/realtime/connection.rb +2 -2
- data/lib/ably/rest/channel.rb +31 -31
- data/lib/ably/rest/client.rb +27 -12
- data/lib/ably/util/crypto.rb +1 -1
- data/lib/ably/version.rb +2 -14
- data/lib/ably.rb +1 -0
- data/spec/acceptance/realtime/auth_spec.rb +1 -1
- data/spec/acceptance/realtime/channel_history_spec.rb +25 -0
- data/spec/acceptance/realtime/channel_spec.rb +466 -21
- data/spec/acceptance/realtime/channels_spec.rb +59 -7
- data/spec/acceptance/realtime/connection_failures_spec.rb +59 -2
- data/spec/acceptance/realtime/connection_spec.rb +256 -28
- data/spec/acceptance/realtime/message_spec.rb +77 -0
- data/spec/acceptance/realtime/presence_history_spec.rb +3 -1
- data/spec/acceptance/realtime/presence_spec.rb +31 -159
- data/spec/acceptance/rest/auth_spec.rb +18 -0
- data/spec/acceptance/rest/channel_spec.rb +84 -9
- data/spec/acceptance/rest/channels_spec.rb +23 -6
- data/spec/acceptance/rest/client_spec.rb +25 -21
- data/spec/acceptance/rest/message_spec.rb +61 -3
- data/spec/lib/unit/models/channel_options_spec.rb +52 -0
- data/spec/shared/model_behaviour.rb +1 -1
- data/spec/spec_helper.rb +11 -2
- data/spec/support/test_app.rb +1 -1
- data/spec/unit/models/delta_extras_spec.rb +14 -0
- data/spec/unit/models/error_info_spec.rb +17 -1
- data/spec/unit/models/message_spec.rb +97 -0
- data/spec/unit/models/presence_message_spec.rb +49 -0
- data/spec/unit/models/protocol_message_spec.rb +125 -27
- data/spec/unit/models/token_details_spec.rb +14 -0
- data/spec/unit/realtime/channel_spec.rb +3 -2
- data/spec/unit/realtime/channels_spec.rb +53 -15
- data/spec/unit/realtime/incoming_message_dispatcher_spec.rb +38 -0
- data/spec/unit/rest/channel_spec.rb +44 -1
- data/spec/unit/rest/channels_spec.rb +81 -14
- data/spec/unit/rest/client_spec.rb +47 -0
- metadata +60 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f42d74184e0de100d535fa3c01595727b78a6d2cd6018d1743e2593c20fe7ed7
|
4
|
+
data.tar.gz: db674f894bc006187816c0e51df19b84a7473d178b8360271a27640e7b3e4f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5950df21ad66e4c59eb6bd772ab71aa91b421679139166ddaa9076ea4fc7cc9a6eb9993a3f4e15e30a2d362a05c008587b153617c967da6a41aa6e0efdc3f091
|
7
|
+
data.tar.gz: a9d61d9b6c12397df274f55028a1fcbd6c285235cb489027188c799949466a6a74c4e6ea3829bd44851be48af14e05a2f7d49494ea61d1ea190176773079df23
|
data/.github/workflows/check.yml
CHANGED
@@ -10,7 +10,7 @@ jobs:
|
|
10
10
|
continue-on-error: true
|
11
11
|
strategy:
|
12
12
|
matrix:
|
13
|
-
ruby: [ '2.5', '2.6', '2.7' ]
|
13
|
+
ruby: [ '2.5', '2.6', '2.7', '3.0' ]
|
14
14
|
protocol: [ 'json', 'msgpack' ]
|
15
15
|
steps:
|
16
16
|
- uses: actions/checkout@v2
|
@@ -25,3 +25,17 @@ jobs:
|
|
25
25
|
PARALLEL_TEST_PROCESSORS: 2
|
26
26
|
PROTOCOL: ${{ matrix.protocol }}
|
27
27
|
run: ./spec/run_parallel_tests
|
28
|
+
- uses: coverallsapp/github-action@1.1.3
|
29
|
+
with:
|
30
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
31
|
+
flag-name: run-ruby_${{ matrix.ruby }}-${{ matrix.protocol }}_protocol
|
32
|
+
parallel: true
|
33
|
+
finish:
|
34
|
+
needs: check
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
steps:
|
37
|
+
- name: Coveralls Finished
|
38
|
+
uses: coverallsapp/github-action@1.1.3
|
39
|
+
with:
|
40
|
+
github-token: ${{ secrets.github_token }}
|
41
|
+
parallel-finished: true
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,136 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.2.0](https://github.com/ably/ably-ruby/tree/v1.2.0)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.8...v1.2.0)
|
6
|
+
|
7
|
+
This release updates ably-ruby to be compliant with the 1.2 version of the Ably client library feature specification. There are some minor breaking changes, please see [the migration guide](./UPDATING.md) for more information.
|
8
|
+
|
9
|
+
**Closed issues:**
|
10
|
+
|
11
|
+
- create migration guide for the upgrade to ruby 1.2 [\#347](https://github.com/ably/ably-ruby/issues/347)
|
12
|
+
- Write spec tests for RTL17 [\#304](https://github.com/ably/ably-ruby/issues/304)
|
13
|
+
- Write spec tests for RTL16, RTL16a [\#303](https://github.com/ably/ably-ruby/issues/303)
|
14
|
+
- Write spec tests for RTL4m [\#302](https://github.com/ably/ably-ruby/issues/302)
|
15
|
+
- Write spec tests for RTL4l [\#301](https://github.com/ably/ably-ruby/issues/301)
|
16
|
+
- Write spec tests for RTL4k, RTL4k1 [\#300](https://github.com/ably/ably-ruby/issues/300)
|
17
|
+
- Write spec tests for RTL4j, RTL4j1, RTL4j2 [\#299](https://github.com/ably/ably-ruby/issues/299)
|
18
|
+
- Write spec tests for RTS3c, RTS3c1 [\#298](https://github.com/ably/ably-ruby/issues/298)
|
19
|
+
- Write spec tests for RTS3a [\#297](https://github.com/ably/ably-ruby/issues/297)
|
20
|
+
- Add support for RTL21 [\#296](https://github.com/ably/ably-ruby/issues/296)
|
21
|
+
- Add support for RTL17 [\#292](https://github.com/ably/ably-ruby/issues/292)
|
22
|
+
- Add support for RTL16, RTL16a [\#291](https://github.com/ably/ably-ruby/issues/291)
|
23
|
+
- Add support for RTL4m [\#290](https://github.com/ably/ably-ruby/issues/290)
|
24
|
+
- Add support for RTL4l [\#289](https://github.com/ably/ably-ruby/issues/289)
|
25
|
+
- Add support for RTL4k, RTL4k1 [\#288](https://github.com/ably/ably-ruby/issues/288)
|
26
|
+
- Add support for RTL4j, RTL4j1, RTL4j2 [\#287](https://github.com/ably/ably-ruby/issues/287)
|
27
|
+
- Add support for RTS3c, RTS3c1 [\#286](https://github.com/ably/ably-ruby/issues/286)
|
28
|
+
- Add support for RTS3a [\#285](https://github.com/ably/ably-ruby/issues/285)
|
29
|
+
- Write spec tests for RSL1a, b, h, k1, k2, l, l1 \(Channels\) [\#283](https://github.com/ably/ably-ruby/issues/283)
|
30
|
+
- Write spec tests for RSN3a, c \(Channels\) [\#282](https://github.com/ably/ably-ruby/issues/282)
|
31
|
+
- Write spec tests for RSA4b, b1, c, RSA16 \(Authentication\) [\#281](https://github.com/ably/ably-ruby/issues/281)
|
32
|
+
- Add support for RSN3a, c \(Channels\) [\#269](https://github.com/ably/ably-ruby/issues/269)
|
33
|
+
- Add support for RSA4b, b1, c, RSA16 \(Authentication\) [\#268](https://github.com/ably/ably-ruby/issues/268)
|
34
|
+
- Add support for RSC7a, RSC7c \(RestClient\)
|
35
|
+
[\#266](https://github.com/ably/ably-ruby/issues/266)
|
36
|
+
- Add support for Test Guidance G4 [\#265](https://github.com/ably/ably-ruby/issues/265)
|
37
|
+
- Add support for TO3o, TO3p [\#264](https://github.com/ably/ably-ruby/issues/264)
|
38
|
+
|
39
|
+
**Merged pull requests:**
|
40
|
+
|
41
|
+
- Add migration guide from 1.1.8 to 1.2.0 [\#348](https://github.com/ably/ably-ruby/pull/348) ([TheSmartnik](https://github.com/TheSmartnik))
|
42
|
+
- RTL21 [\#345](https://github.com/ably/ably-ruby/pull/345) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
43
|
+
- RTL4j [\#341](https://github.com/ably/ably-ruby/pull/341) ([TheSmartnik](https://github.com/TheSmartnik))
|
44
|
+
- RSL1a, RSL1b [\#340](https://github.com/ably/ably-ruby/pull/340) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
45
|
+
- Add support for RSA4b, b1, c, RSA16 \(Authentication\) [\#338](https://github.com/ably/ably-ruby/pull/338) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
46
|
+
- ChannelOptions related tasks [\#336](https://github.com/ably/ably-ruby/pull/336) ([TheSmartnik](https://github.com/TheSmartnik))
|
47
|
+
- Update RSC7 [\#334](https://github.com/ably/ably-ruby/pull/334) ([TheSmartnik](https://github.com/TheSmartnik))
|
48
|
+
|
49
|
+
## [v1.1.8](https://github.com/ably/ably-ruby/tree/v1.1.8)
|
50
|
+
|
51
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.7...v1.1.8)
|
52
|
+
|
53
|
+
**Fixed bugs:**
|
54
|
+
|
55
|
+
- Lib apparently closing the socket after each request [\#211](https://github.com/ably/ably-ruby/issues/211)
|
56
|
+
|
57
|
+
**Closed issues:**
|
58
|
+
|
59
|
+
- Resolve config.around\(\) issue and upgrade rspec [\#313](https://github.com/ably/ably-ruby/issues/313)
|
60
|
+
- Write spec tests for RTL21 [\#308](https://github.com/ably/ably-ruby/issues/308)
|
61
|
+
- Write spec tests for RTL20 [\#307](https://github.com/ably/ably-ruby/issues/307)
|
62
|
+
- Write spec tests for RTL19, RTL19a, b, c [\#306](https://github.com/ably/ably-ruby/issues/306)
|
63
|
+
- Write spec tests for RTL18, RTL18a, b, c [\#305](https://github.com/ably/ably-ruby/issues/305)
|
64
|
+
- Add support for RTL20 [\#295](https://github.com/ably/ably-ruby/issues/295)
|
65
|
+
- Add support for RTL19, RTL19a, b, c [\#294](https://github.com/ably/ably-ruby/issues/294)
|
66
|
+
- Add support for RTL18, RTL18a, b, c [\#293](https://github.com/ably/ably-ruby/issues/293)
|
67
|
+
- Write spec tests for RSL6b, RLS7 \(Channels\) [\#284](https://github.com/ably/ably-ruby/issues/284)
|
68
|
+
- Write spec tests for RSC15e, d, f \(Host Fallback \)
|
69
|
+
[\#280](https://github.com/ably/ably-ruby/issues/280)
|
70
|
+
- Write spec tests for RSC7a, RSC7c \(RestClient\)
|
71
|
+
[\#279](https://github.com/ably/ably-ruby/issues/279)
|
72
|
+
- Add support for DataTypes ChannelOptions TB2c, d [\#278](https://github.com/ably/ably-ruby/issues/278)
|
73
|
+
- Add support for DataTypes TokenParams AO2g [\#277](https://github.com/ably/ably-ruby/issues/277)
|
74
|
+
- Add support for DataTypes ClientOptions TO3j10 [\#276](https://github.com/ably/ably-ruby/issues/276)
|
75
|
+
- Add support for DataTypes ErrorInfo TI1 [\#275](https://github.com/ably/ably-ruby/issues/275)
|
76
|
+
- Add support for DataTypes ProtocolMessage TR3f, TR4i, q [\#274](https://github.com/ably/ably-ruby/issues/274)
|
77
|
+
- Add support for TM2i \(DataTypes Message\) [\#273](https://github.com/ably/ably-ruby/issues/273)
|
78
|
+
- Add support for PC1, PC2, PC3, PC3a \(Plugins\) [\#272](https://github.com/ably/ably-ruby/issues/272)
|
79
|
+
- Add support for RSL6b, RLS7 \(Channels\) [\#271](https://github.com/ably/ably-ruby/issues/271)
|
80
|
+
- Add support for RSL1a, b, h, k1, k2, l, l1 \(Channels\) [\#270](https://github.com/ably/ably-ruby/issues/270)
|
81
|
+
- Add support for RSC15e, d, f \(Host Fallback \)
|
82
|
+
[\#267](https://github.com/ably/ably-ruby/issues/267)
|
83
|
+
- Update client options support to 1.1 spec level \(logExceptionReportingUrl\) [\#246](https://github.com/ably/ably-ruby/issues/246)
|
84
|
+
- Confirm status of remaining realtime spec items for 1.0 [\#244](https://github.com/ably/ably-ruby/issues/244)
|
85
|
+
|
86
|
+
**Merged pull requests:**
|
87
|
+
|
88
|
+
- Allowing ConnectionDetails\#max\_message\_size [\#342](https://github.com/ably/ably-ruby/pull/342) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
89
|
+
- Add specs for RTL17 [\#335](https://github.com/ably/ably-ruby/pull/335) ([TheSmartnik](https://github.com/TheSmartnik))
|
90
|
+
- Add spec for RTP5b [\#332](https://github.com/ably/ably-ruby/pull/332) ([TheSmartnik](https://github.com/TheSmartnik))
|
91
|
+
- Update specs with comments to docs seciton for RSN3a/RSN3c [\#331](https://github.com/ably/ably-ruby/pull/331) ([TheSmartnik](https://github.com/TheSmartnik))
|
92
|
+
- Fix after suite hook in specs [\#329](https://github.com/ably/ably-ruby/pull/329) ([TheSmartnik](https://github.com/TheSmartnik))
|
93
|
+
- Add specs for RTN15h2 [\#328](https://github.com/ably/ably-ruby/pull/328) ([TheSmartnik](https://github.com/TheSmartnik))
|
94
|
+
- Add specs for RTN12f [\#327](https://github.com/ably/ably-ruby/pull/327) ([TheSmartnik](https://github.com/TheSmartnik))
|
95
|
+
- Added Channel\#set\_options and Channel\#options= aliases [\#326](https://github.com/ably/ably-ruby/pull/326) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
96
|
+
- Added DeltaExtras class and Message\#delta\_extras method. \(TM2i\) [\#325](https://github.com/ably/ably-ruby/pull/325) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
97
|
+
- When connection disconnectes and can't renew token it fails \(RTN15h1\) [\#324](https://github.com/ably/ably-ruby/pull/324) ([TheSmartnik](https://github.com/TheSmartnik))
|
98
|
+
- RTN-13c Add spec that channels do not reattach when connection isn't connected [\#323](https://github.com/ably/ably-ruby/pull/323) ([TheSmartnik](https://github.com/TheSmartnik))
|
99
|
+
- Add support for DataTypes ProtocolMessage: has\_attach\_resume\_flag? [\#322](https://github.com/ably/ably-ruby/pull/322) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
100
|
+
- Added request\_id and cause attributes to the ErrorInfo class TI1, RSC7c [\#321](https://github.com/ably/ably-ruby/pull/321) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
101
|
+
- Add spec for RTN12d [\#318](https://github.com/ably/ably-ruby/pull/318) ([TheSmartnik](https://github.com/TheSmartnik))
|
102
|
+
- Change behavior when reconnecting from failed state \(RTN11d\) [\#316](https://github.com/ably/ably-ruby/pull/316) ([TheSmartnik](https://github.com/TheSmartnik))
|
103
|
+
- Remove deprecated ProtocolMessage\#connection\_key TR4e [\#315](https://github.com/ably/ably-ruby/pull/315) ([TheSmartnik](https://github.com/TheSmartnik))
|
104
|
+
- Upgrade rspec to 3.10 [\#314](https://github.com/ably/ably-ruby/pull/314) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
105
|
+
- Add a spec for \#RTN11c [\#257](https://github.com/ably/ably-ruby/pull/257) ([TheSmartnik](https://github.com/TheSmartnik))
|
106
|
+
|
107
|
+
|
108
|
+
## [v1.1.7](https://github.com/ably/ably-ruby/tree/v1.1.7)
|
109
|
+
|
110
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.6...v1.1.7)
|
111
|
+
|
112
|
+
**Implemented enhancements:**
|
113
|
+
|
114
|
+
- Implement RSC7d \(Ably-Agent header\) [\#230](https://github.com/ably/ably-ruby/issues/230)
|
115
|
+
- Support Ruby 3.x [\#220](https://github.com/ably/ably-ruby/issues/220)
|
116
|
+
|
117
|
+
**Closed issues:**
|
118
|
+
|
119
|
+
- Create code snippets for homepage \(ruby\) [\#249](https://github.com/ably/ably-ruby/issues/249)
|
120
|
+
- Update client options support to 1.1 spec level \(maxMessageSize\) [\#247](https://github.com/ably/ably-ruby/issues/247)
|
121
|
+
- Update client options support to 1.1 spec level \(maxFrameSize\) [\#245](https://github.com/ably/ably-ruby/issues/245)
|
122
|
+
|
123
|
+
**Merged pull requests:**
|
124
|
+
|
125
|
+
- Enabled TLS hostname validation CVE-2020-13482 [\#263](https://github.com/ably/ably-ruby/pull/263) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
126
|
+
- Ruby 3.0 support [\#260](https://github.com/ably/ably-ruby/pull/260) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
127
|
+
- TO3l9 Max frame size [\#259](https://github.com/ably/ably-ruby/pull/259) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
128
|
+
- Update client options support to 1.1 spec level \(maxMessageSize\) [\#252](https://github.com/ably/ably-ruby/pull/252) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
129
|
+
- Update ably-common to latest main [\#251](https://github.com/ably/ably-ruby/pull/251) ([owenpearson](https://github.com/owenpearson))
|
130
|
+
- Implement RSC7d \(Ably-Agent header\) [\#248](https://github.com/ably/ably-ruby/pull/248) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
131
|
+
- Upgrade statesman to ~\> 8.0 [\#237](https://github.com/ably/ably-ruby/pull/237) ([darkhelmet](https://github.com/darkhelmet))
|
132
|
+
- Update attach\_serial before emiting UPDATE event [\#228](https://github.com/ably/ably-ruby/pull/228) ([TheSmartnik](https://github.com/TheSmartnik))
|
133
|
+
|
3
134
|
## [v1.1.6](https://github.com/ably/ably-ruby/tree/v1.1.6)
|
4
135
|
|
5
136
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.5...v1.1.6)
|
data/COPYRIGHT
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Copyright 2015-
|
1
|
+
Copyright 2015-2022 Ably Real-time Ltd (ably.com)
|
data/README.md
CHANGED
@@ -3,11 +3,13 @@
|
|
3
3
|
[![Gem Version](https://img.shields.io/gem/v/ably?style=flat)](https://img.shields.io/gem/v/ably?style=flat)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/ably/ably-ruby/badge.svg)](https://coveralls.io/r/ably/ably-ruby)
|
5
5
|
|
6
|
-
|
6
|
+
_[Ably](https://ably.com) is the platform that powers synchronized digital experiences in realtime. Whether attending an event in a virtual venue, receiving realtime financial information, or monitoring live car performance data – consumers simply expect realtime digital experiences as standard. Ably provides a suite of APIs to build, extend, and deliver powerful digital experiences in realtime for more than 250 million devices across 80 countries each month. Organizations like Bloomberg, HubSpot, Verizon, and Hopin depend on Ably’s platform to offload the growing complexity of business-critical realtime data synchronization at global scale. For more information, see the [Ably documentation](https://ably.com/documentation)._
|
7
|
+
|
8
|
+
This is a Ruby client library for Ably. The library currently targets the [Ably 1.2 client library specification](https://ably.com/documentation/client-lib-development-guide/features/). You can see the complete list of features this client library supports in [our client library SDKs feature support matrix](https://ably.com/download/sdk-feature-support-matrix).
|
7
9
|
|
8
10
|
## Supported platforms
|
9
11
|
|
10
|
-
This SDK supports Ruby 1.9.3+.
|
12
|
+
This SDK supports Ruby 1.9.3+. For eventmachine and Ruby 3.0 note please visit [Ruby 3.0 support](#ruby-30-support) section.
|
11
13
|
|
12
14
|
As of v1.1.5 this library requires `libcurl` as a system dependency. On most systems this is already installed but in rare cases where it isn't (for example debian-slim Docker images such as ruby-slim) you will need to install it yourself. On debian you can install it with the command `sudo apt-get install libcurl4`.
|
13
15
|
|
@@ -287,6 +289,16 @@ stats_page.next # retrieves the next page => #<Ably::Models::PaginatedResult ...
|
|
287
289
|
client.time #=> 2013-12-12 14:23:34 +0000
|
288
290
|
```
|
289
291
|
|
292
|
+
## Ruby 3.0 support
|
293
|
+
|
294
|
+
If you cannot install ably realtime gem because of eventmachine openssl problems, please try to set your `openssl-dir`, i.e.:
|
295
|
+
|
296
|
+
```ruby
|
297
|
+
gem install eventmachine -- --with-openssl-dir=/usr/local/opt/openssl@1.1
|
298
|
+
```
|
299
|
+
|
300
|
+
More about eventmachine and ruby 3.0 support here https://github.com/eventmachine/eventmachine/issues/932
|
301
|
+
|
290
302
|
## Dependencies
|
291
303
|
|
292
304
|
If you only need to use the REST features of this library and do not want EventMachine as a dependency, then you should consider using the [Ably Ruby REST gem](https://rubygems.org/gems/ably-rest).
|
data/SPEC.md
CHANGED
@@ -3299,8 +3299,6 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
|
|
3299
3299
|
* [retrieves attribute :channel_serial](./spec/shared/model_behaviour.rb#L15)
|
3300
3300
|
* #connection_id
|
3301
3301
|
* [retrieves attribute :connection_id](./spec/shared/model_behaviour.rb#L15)
|
3302
|
-
* #connection_key
|
3303
|
-
* [retrieves attribute :connection_key](./spec/shared/model_behaviour.rb#L15)
|
3304
3302
|
* #==
|
3305
3303
|
* [is true when attributes are the same](./spec/shared/model_behaviour.rb#L41)
|
3306
3304
|
* [is false when attributes are not the same](./spec/shared/model_behaviour.rb#L46)
|
@@ -3386,11 +3384,6 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
|
|
3386
3384
|
* [contains the attributes from the JSON auth details](./spec/unit/models/protocol_message_spec.rb#L358)
|
3387
3385
|
* without a JSON value
|
3388
3386
|
* [contains an empty AuthDetails object](./spec/unit/models/protocol_message_spec.rb#L366)
|
3389
|
-
* #connection_key (#TR4e)
|
3390
|
-
* existing only in #connection_details.connection_key
|
3391
|
-
* [is returned](./spec/unit/models/protocol_message_spec.rb#L377)
|
3392
|
-
* existing in both #connection_key and #connection_details.connection_key
|
3393
|
-
* [returns #connection_details.connection_key as #connection_key will be deprecated > 0.8](./spec/unit/models/protocol_message_spec.rb#L385)
|
3394
3387
|
|
3395
3388
|
### Ably::Models::PushChannelSubscription
|
3396
3389
|
_(see [spec/unit/models/push_channel_subscription_spec.rb](./spec/unit/models/push_channel_subscription_spec.rb))_
|
data/UPDATING.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Upgrade / Migration Guide
|
2
|
+
|
3
|
+
## Version 1.1.8 to 1.2.0
|
4
|
+
|
5
|
+
### Notable Changes
|
6
|
+
This release is all about channel options. Here is the full [changelog](https://github.com/ably/ably-ruby/blob/main/CHANGELOG.md)
|
7
|
+
|
8
|
+
* Channel options were extracted into a seperate model [ChannelOptions](https://github.com/ably/ably-ruby/blob/main/lib/ably/models/channel_options.rb). However it's still backward campatible with `Hash` and you don't need to do make any adjustments to your code
|
9
|
+
|
10
|
+
* The `ChannelOptions` class now supports `:params`, `:modes` and `:cipher` as options. Previously only `:cipher` was available
|
11
|
+
|
12
|
+
* The client `:idempotent_rest_publishing` option is `true` by default. Previously `:idempotent_rest_publishing` was `false` by default.
|
13
|
+
|
14
|
+
### Breaking Changes
|
15
|
+
|
16
|
+
* Changing channel options with `Channels#get` is now deprecated in favor of explicit options change
|
17
|
+
|
18
|
+
1. If channel state is attached or attaching an exception will be raised
|
19
|
+
2. Otherwise the library will emit a warning
|
20
|
+
|
21
|
+
For example, the following code
|
22
|
+
```
|
23
|
+
client.channels.get(channel_name, new_channel_options)
|
24
|
+
```
|
25
|
+
|
26
|
+
Should be changed to:
|
27
|
+
```
|
28
|
+
channel = client.channels.get(channel_name)
|
29
|
+
channel.options = new_channel_options
|
30
|
+
```
|
data/ably.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'eventmachine', '~> 1.2.6'
|
22
22
|
spec.add_runtime_dependency 'em-http-request', '~> 1.1'
|
23
|
-
spec.add_runtime_dependency 'statesman', '~>
|
23
|
+
spec.add_runtime_dependency 'statesman', '~> 8.0'
|
24
24
|
spec.add_runtime_dependency 'faraday', '~> 1.0'
|
25
25
|
spec.add_runtime_dependency 'typhoeus', '~> 1.4'
|
26
26
|
|
@@ -33,9 +33,9 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_runtime_dependency 'msgpack', '>= 1.3.0'
|
34
34
|
spec.add_runtime_dependency 'addressable', '>= 2.0.0'
|
35
35
|
|
36
|
-
spec.add_development_dependency 'rake', '~>
|
36
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
37
37
|
spec.add_development_dependency 'redcarpet', '~> 3.3'
|
38
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
39
39
|
spec.add_development_dependency 'rspec-retry', '~> 0.6'
|
40
40
|
spec.add_development_dependency 'yard', '~> 0.9'
|
41
41
|
spec.add_development_dependency 'rspec-instafail', '~> 1.0'
|
@@ -47,11 +47,16 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency 'parallel_tests', '~> 2.9.0'
|
48
48
|
else
|
49
49
|
spec.add_development_dependency 'webmock', '~> 3.11'
|
50
|
-
spec.add_development_dependency '
|
51
|
-
spec.add_development_dependency '
|
50
|
+
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
51
|
+
spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
|
52
|
+
spec.add_development_dependency 'parallel_tests', '~> 3.7'
|
52
53
|
if !RUBY_VERSION.match(/^2\.[0123]/)
|
53
|
-
spec.add_development_dependency 'pry'
|
54
|
-
spec.add_development_dependency 'pry-byebug'
|
54
|
+
spec.add_development_dependency 'pry', '~> 0.14.1'
|
55
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.8.0'
|
55
56
|
end
|
56
57
|
end
|
58
|
+
|
59
|
+
if RUBY_VERSION.match(/^3\./)
|
60
|
+
spec.add_development_dependency 'webrick', '~> 1.7.0'
|
61
|
+
end
|
57
62
|
end
|
data/lib/ably/agent.rb
ADDED
data/lib/ably/auth.rb
CHANGED
@@ -510,11 +510,11 @@ module Ably
|
|
510
510
|
end
|
511
511
|
|
512
512
|
def authorize_when_necessary
|
513
|
-
if current_token_details && !current_token_details.expired?
|
513
|
+
if current_token_details && !current_token_details.expired?(from: current_time)
|
514
514
|
return current_token_details
|
515
|
-
else
|
516
|
-
authorize
|
517
515
|
end
|
516
|
+
|
517
|
+
authorize
|
518
518
|
end
|
519
519
|
|
520
520
|
# Returns the current device clock time unless the
|
data/lib/ably/exceptions.rb
CHANGED
@@ -52,6 +52,12 @@ module Ably
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
# Maximum frame size exceeded TO3l9
|
56
|
+
class MaxFrameSizeExceeded < BaseAblyException; end
|
57
|
+
|
58
|
+
# Maximum message size exceeded TO3l8
|
59
|
+
class MaxMessageSizeExceeded < BaseAblyException; end
|
60
|
+
|
55
61
|
# An invalid request was received by Ably
|
56
62
|
class InvalidRequest < BaseAblyException; end
|
57
63
|
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Ably::Models
|
2
|
+
# Convert token details argument to a {ChannelOptions} object
|
3
|
+
#
|
4
|
+
# @param attributes (see #initialize)
|
5
|
+
#
|
6
|
+
# @return [ChannelOptions]
|
7
|
+
def self.ChannelOptions(attributes)
|
8
|
+
case attributes
|
9
|
+
when ChannelOptions
|
10
|
+
return attributes
|
11
|
+
else
|
12
|
+
ChannelOptions.new(attributes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Represents options of a channel
|
17
|
+
class ChannelOptions
|
18
|
+
extend Ably::Modules::Enum
|
19
|
+
extend Forwardable
|
20
|
+
include Ably::Modules::ModelCommon
|
21
|
+
|
22
|
+
MODES = ruby_enum('MODES',
|
23
|
+
presence: 0,
|
24
|
+
publish: 1,
|
25
|
+
subscribe: 2,
|
26
|
+
presence_subscribe: 3
|
27
|
+
)
|
28
|
+
|
29
|
+
attr_reader :attributes
|
30
|
+
|
31
|
+
alias_method :to_h, :attributes
|
32
|
+
|
33
|
+
def_delegators :attributes, :fetch, :size, :empty?
|
34
|
+
# Initialize a new ChannelOptions
|
35
|
+
#
|
36
|
+
# @option params [Hash] (TB2c) params (for realtime client libraries only) a of key/value pairs
|
37
|
+
# @option modes [Hash] modes (for realtime client libraries only) an array of ChannelMode
|
38
|
+
# @option cipher [Hash,Ably::Models::CipherParams] :cipher A hash of options or a {Ably::Models::CipherParams} to configure the encryption. *:key* is required, all other options are optional.
|
39
|
+
#
|
40
|
+
def initialize(attrs)
|
41
|
+
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
42
|
+
|
43
|
+
attributes[:modes] = modes.to_a.map { |mode| Ably::Models::ChannelOptions::MODES[mode] } if modes
|
44
|
+
attributes[:cipher] = Ably::Models::CipherParams(cipher) if cipher
|
45
|
+
attributes.clone
|
46
|
+
end
|
47
|
+
|
48
|
+
# @!attribute cipher
|
49
|
+
#
|
50
|
+
# @return [CipherParams]
|
51
|
+
def cipher
|
52
|
+
attributes[:cipher]
|
53
|
+
end
|
54
|
+
|
55
|
+
# @!attribute params
|
56
|
+
#
|
57
|
+
# @return [Hash]
|
58
|
+
def params
|
59
|
+
attributes[:params].to_h
|
60
|
+
end
|
61
|
+
|
62
|
+
# @!attribute modes
|
63
|
+
#
|
64
|
+
# @return [Array<ChannelOptions::MODES>]
|
65
|
+
def modes
|
66
|
+
attributes[:modes]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Converts modes to a bitfield that coresponds to ProtocolMessage#flags
|
70
|
+
#
|
71
|
+
# @return [Integer]
|
72
|
+
def modes_to_flags
|
73
|
+
modes.map { |mode| Ably::Models::ProtocolMessage::ATTACH_FLAGS_MAPPING[mode.to_sym] }.reduce(:|)
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Hash]
|
77
|
+
# @api private
|
78
|
+
def set_params(hash)
|
79
|
+
attributes[:params] = hash
|
80
|
+
end
|
81
|
+
|
82
|
+
# Sets modes from ProtocolMessage#flags
|
83
|
+
#
|
84
|
+
# @return [Array<ChannelOptions::MODES>]
|
85
|
+
# @api private
|
86
|
+
def set_modes_from_flags(flags)
|
87
|
+
return unless flags
|
88
|
+
|
89
|
+
message_modes = MODES.select do |mode|
|
90
|
+
flag = Ably::Models::ProtocolMessage::ATTACH_FLAGS_MAPPING[mode.to_sym]
|
91
|
+
flags & flag == flag
|
92
|
+
end
|
93
|
+
|
94
|
+
attributes[:modes] = message_modes.map { |mode| Ably::Models::ChannelOptions::MODES[mode] }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -21,6 +21,12 @@ module Ably::Models
|
|
21
21
|
class ConnectionDetails
|
22
22
|
include Ably::Modules::ModelCommon
|
23
23
|
|
24
|
+
# Max message size
|
25
|
+
MAX_MESSAGE_SIZE = 65536 # See spec TO3l8
|
26
|
+
|
27
|
+
# Max frame size
|
28
|
+
MAX_FRAME_SIZE = 524288 # See spec TO3l9
|
29
|
+
|
24
30
|
# @param attributes [Hash]
|
25
31
|
# @option attributes [String] :client_id contains the client ID assigned to the connection
|
26
32
|
# @option attributes [String] :connection_key the connection secret key string that is used to resume a connection and its state
|
@@ -38,6 +44,8 @@ module Ably::Models
|
|
38
44
|
self.attributes[duration_field] = (self.attributes[duration_field].to_f / 1000).round
|
39
45
|
end
|
40
46
|
end
|
47
|
+
self.attributes[:max_message_size] ||= MAX_MESSAGE_SIZE
|
48
|
+
self.attributes[:max_frame_size] ||= MAX_FRAME_SIZE
|
41
49
|
self.attributes.freeze
|
42
50
|
end
|
43
51
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Ably::Models
|
2
|
+
#
|
3
|
+
# @!attribute [r] from
|
4
|
+
# @return [String] The id of the message the delta was generated from
|
5
|
+
# @!attribute [r] format
|
6
|
+
# @return [String] The delta format. Only vcdiff is supported as at API version 1.2
|
7
|
+
#
|
8
|
+
class DeltaExtras
|
9
|
+
include Ably::Modules::ModelCommon
|
10
|
+
|
11
|
+
# The id of the message the delta was generated from.
|
12
|
+
# @return [String, nil]
|
13
|
+
#
|
14
|
+
attr_reader :from
|
15
|
+
|
16
|
+
# The delta format.
|
17
|
+
# @return [String, nil]
|
18
|
+
#
|
19
|
+
attr_reader :format
|
20
|
+
|
21
|
+
def initialize(attributes = {})
|
22
|
+
@from, @format = IdiomaticRubyWrapper((attributes || {}), stop_at: [:from, :format]).attributes.values_at(:from, :format)
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_json(*args)
|
26
|
+
as_json(args).to_json
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -27,6 +27,10 @@ module Ably::Models
|
|
27
27
|
# @return [Integer] Ably error code (see ably-common/protocol/errors.json)
|
28
28
|
# @!attribute [r] status
|
29
29
|
# @return [Integer] HTTP Status Code corresponding to this error, where applicable
|
30
|
+
# @!attribute [r] request_id
|
31
|
+
# @return [Integer] HTTP RequestId corresponding to this error, where applicable (#RSC7c)
|
32
|
+
# @!attribute [r] cause
|
33
|
+
# @return [Integer] HTTP Status Code corresponding to this error, where applicable (#TI1)
|
30
34
|
# @!attribute [r] attributes
|
31
35
|
# @return [Hash] Access the protocol message Hash object ruby'fied to use symbolized keys
|
32
36
|
#
|
@@ -38,7 +42,7 @@ module Ably::Models
|
|
38
42
|
@hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze)
|
39
43
|
end
|
40
44
|
|
41
|
-
%w(message code href status_code).each do |attribute|
|
45
|
+
%w(message code href status_code request_id cause).each do |attribute|
|
42
46
|
define_method attribute do
|
43
47
|
attributes[attribute.to_sym]
|
44
48
|
end
|
@@ -52,7 +56,7 @@ module Ably::Models
|
|
52
56
|
def to_s
|
53
57
|
error_href = href || (code ? "https://help.ably.io/error/#{code}" : '')
|
54
58
|
see_msg = " -> see #{error_href} for help" unless message.to_s.include?(error_href.to_s)
|
55
|
-
"<Error: #{message} (code: #{code}, http status: #{status})>#{see_msg}"
|
59
|
+
"<Error: #{message} (code: #{code}, http status: #{status} request_id: #{request_id} cause: #{cause})>#{see_msg}"
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end
|
data/lib/ably/models/message.rb
CHANGED
@@ -105,6 +105,20 @@ module Ably::Models
|
|
105
105
|
end.to_json
|
106
106
|
end
|
107
107
|
|
108
|
+
# The size is the sum over name, data, clientId, and extras in bytes (TO3l8a)
|
109
|
+
#
|
110
|
+
def size
|
111
|
+
%w(name data client_id extras).map do |attr|
|
112
|
+
if (value = attributes[attr.to_sym]).is_a?(String)
|
113
|
+
value.bytesize
|
114
|
+
elsif value.nil?
|
115
|
+
0
|
116
|
+
else
|
117
|
+
value.to_json.bytesize
|
118
|
+
end
|
119
|
+
end.sum
|
120
|
+
end
|
121
|
+
|
108
122
|
# Assign this message to a ProtocolMessage before delivery to the Ably system
|
109
123
|
# @api private
|
110
124
|
def assign_to_protocol_message(protocol_message)
|
@@ -128,6 +142,9 @@ module Ably::Models
|
|
128
142
|
|
129
143
|
# Contains any arbitrary key value pairs which may also contain other primitive JSON types, JSON-encodable objects or JSON-encodable arrays.
|
130
144
|
# The extras field is provided to contain message metadata and/or ancillary payloads in support of specific functionality, e.g. push
|
145
|
+
# 1.2 adds the delta extension which is of type DeltaExtras, and the headers extension, which contains arbitrary string->string key-value pairs,
|
146
|
+
# settable at publish time. Unless otherwise specified, the client library should not attempt to do any filtering or validation of the extras
|
147
|
+
# field itself, but should treat it opaquely, encoding it and passing it to realtime unaltered.
|
131
148
|
# @api private
|
132
149
|
def extras
|
133
150
|
attributes[:extras].tap do |val|
|
@@ -137,15 +154,23 @@ module Ably::Models
|
|
137
154
|
end
|
138
155
|
end
|
139
156
|
|
140
|
-
|
141
|
-
|
142
|
-
|
157
|
+
# Delta extras extension (TM2i)
|
158
|
+
# @return [DeltaExtras, nil]
|
159
|
+
# @api private
|
160
|
+
def delta_extras
|
161
|
+
return nil if attributes[:extras][:delta].nil?
|
162
|
+
@delta_extras ||= DeltaExtras.new(attributes[:extras][:delta]).freeze
|
143
163
|
end
|
144
164
|
|
145
165
|
def protocol_message_index
|
146
166
|
protocol_message.messages.map(&:object_id).index(self.object_id)
|
147
167
|
end
|
148
168
|
|
169
|
+
private
|
170
|
+
def raw_hash_object
|
171
|
+
@raw_hash_object
|
172
|
+
end
|
173
|
+
|
149
174
|
def set_attributes_object(new_attributes)
|
150
175
|
@attributes = IdiomaticRubyWrapper(new_attributes.clone, stop_at: [:data, :extras])
|
151
176
|
end
|
@@ -125,6 +125,20 @@ module Ably::Models
|
|
125
125
|
end.to_json
|
126
126
|
end
|
127
127
|
|
128
|
+
# The size is the sum over data and clientId in bytes (TO3l8a)
|
129
|
+
#
|
130
|
+
def size
|
131
|
+
%w(data client_id).map do |attr|
|
132
|
+
if (value = attributes[attr.to_sym]).is_a?(String)
|
133
|
+
value.bytesize
|
134
|
+
elsif value.nil?
|
135
|
+
0
|
136
|
+
else
|
137
|
+
value.to_json.bytesize
|
138
|
+
end
|
139
|
+
end.sum
|
140
|
+
end
|
141
|
+
|
128
142
|
# Assign this presence message to a ProtocolMessage before delivery to the Ably system
|
129
143
|
# @api private
|
130
144
|
def assign_to_protocol_message(protocol_message)
|