ably 1.2.2 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ably/capabilities.yaml +112 -0
- data/.github/workflows/check.yml +13 -3
- data/.github/workflows/docs.yml +36 -0
- data/.github/workflows/features.yml +14 -0
- data/.rspec_parallel +3 -0
- data/CHANGELOG.md +26 -0
- data/INTRO.md +14 -0
- data/README.md +2 -0
- data/lib/ably/auth.rb +26 -23
- data/lib/ably/models/auth_details.rb +9 -6
- data/lib/ably/models/channel_details.rb +15 -5
- data/lib/ably/models/channel_metrics.rb +31 -8
- data/lib/ably/models/channel_occupancy.rb +10 -3
- data/lib/ably/models/channel_options.rb +26 -3
- data/lib/ably/models/channel_state_change.rb +45 -15
- data/lib/ably/models/channel_status.rb +14 -4
- data/lib/ably/models/cipher_params.rb +36 -13
- data/lib/ably/models/connection_details.rb +91 -10
- data/lib/ably/models/connection_state_change.rb +54 -15
- data/lib/ably/models/delta_extras.rb +6 -7
- data/lib/ably/models/device_details.rb +60 -21
- data/lib/ably/models/device_push_details.rb +27 -19
- data/lib/ably/models/error_info.rb +59 -17
- data/lib/ably/models/http_paginated_response.rb +27 -5
- data/lib/ably/models/idiomatic_ruby_wrapper.rb +3 -2
- data/lib/ably/models/message.rb +64 -24
- data/lib/ably/models/message_encoders/base.rb +6 -0
- data/lib/ably/models/paginated_result.rb +29 -14
- data/lib/ably/models/presence_message.rb +72 -22
- data/lib/ably/models/protocol_message.rb +0 -4
- data/lib/ably/models/push_channel_subscription.rb +40 -15
- data/lib/ably/models/stats.rb +76 -40
- data/lib/ably/models/stats_types.rb +16 -40
- data/lib/ably/models/token_details.rb +34 -12
- data/lib/ably/models/token_request.rb +63 -2
- data/lib/ably/modules/async_wrapper.rb +1 -0
- data/lib/ably/modules/enum.rb +2 -0
- data/lib/ably/modules/event_emitter.rb +14 -1
- data/lib/ably/modules/model_common.rb +5 -0
- data/lib/ably/modules/state_emitter.rb +2 -0
- data/lib/ably/modules/state_machine.rb +4 -0
- data/lib/ably/realtime/channel/channel_properties.rb +9 -2
- data/lib/ably/realtime/channel/publisher.rb +2 -0
- data/lib/ably/realtime/channel/push_channel.rb +17 -10
- data/lib/ably/realtime/channel.rb +79 -42
- data/lib/ably/realtime/channels.rb +4 -3
- data/lib/ably/realtime/client/incoming_message_dispatcher.rb +6 -14
- data/lib/ably/realtime/client.rb +53 -32
- data/lib/ably/realtime/connection/connection_manager.rb +4 -0
- data/lib/ably/realtime/connection/websocket_transport.rb +4 -2
- data/lib/ably/realtime/connection.rb +94 -55
- data/lib/ably/realtime/presence.rb +61 -36
- data/lib/ably/realtime/push/admin.rb +16 -2
- data/lib/ably/realtime/push.rb +15 -3
- data/lib/ably/rest/channel/push_channel.rb +0 -3
- data/lib/ably/rest/channel.rb +29 -21
- data/lib/ably/rest/channels.rb +6 -3
- data/lib/ably/rest/client.rb +41 -35
- data/lib/ably/rest/presence.rb +27 -12
- data/lib/ably/rest/push/admin.rb +4 -0
- data/lib/ably/rest/push/device_registrations.rb +13 -2
- data/lib/ably/rest/push.rb +2 -0
- data/lib/ably/util/crypto.rb +14 -10
- data/lib/ably/version.rb +1 -1
- data/spec/acceptance/realtime/connection_spec.rb +0 -15
- data/spec/acceptance/realtime/message_spec.rb +3 -3
- data/spec/unit/models/protocol_message_spec.rb +0 -26
- data/spec/unit/realtime/incoming_message_dispatcher_spec.rb +0 -38
- metadata +8 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aafd721799a12227e92448a091789f8fec18f0bd7fd538fbe0aee39df0f85380
|
4
|
+
data.tar.gz: 403b90f2620d3c16f9e9795f89ae9efd3fa93a60b0c5c1ef60be2a1fe4687f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258d7bb424f74706a35402b8867a5d936080344f80e7a9e62f58b6fe225a6e25118f8735940d9383154af1cfb7087c2233b72cecd81a5d60f1c13fb75ae043a1
|
7
|
+
data.tar.gz: a6d8953155ad413b0d1da0aa89c7054ef4a163d87f0860f9c8f375bb682412d809e7ba926471665c37e00df6dec4894beb145179d833f9521bc09842399e748a
|
@@ -0,0 +1,112 @@
|
|
1
|
+
%YAML 1.2
|
2
|
+
---
|
3
|
+
common-version: 1.2.0
|
4
|
+
compliance:
|
5
|
+
Agent Identifier:
|
6
|
+
Agents:
|
7
|
+
Runtime:
|
8
|
+
Authentication:
|
9
|
+
API Key:
|
10
|
+
Token:
|
11
|
+
Callback:
|
12
|
+
Literal:
|
13
|
+
URL:
|
14
|
+
Query Time:
|
15
|
+
Debugging:
|
16
|
+
Error Information:
|
17
|
+
Logs:
|
18
|
+
Protocol:
|
19
|
+
JSON:
|
20
|
+
Maximum Message Size:
|
21
|
+
MessagePack:
|
22
|
+
Realtime:
|
23
|
+
Channel:
|
24
|
+
Attach:
|
25
|
+
|
26
|
+
# setOptions on existing channel instance is missing (i.e. it works but is inelegant, requiring soft-deprecated mechanism)
|
27
|
+
# see:
|
28
|
+
# - https://sdk.ably.com/builds/ably/specification/main/features/#RSN3c
|
29
|
+
# - https://sdk.ably.com/builds/ably/specification/main/features/#RTS3c
|
30
|
+
Encryption:
|
31
|
+
|
32
|
+
History:
|
33
|
+
Presence:
|
34
|
+
Enter:
|
35
|
+
Client:
|
36
|
+
Get:
|
37
|
+
History:
|
38
|
+
Subscribe:
|
39
|
+
Update:
|
40
|
+
Client:
|
41
|
+
Publish:
|
42
|
+
Retry Timeout:
|
43
|
+
State Events:
|
44
|
+
Subscribe:
|
45
|
+
Rewind:
|
46
|
+
Connection:
|
47
|
+
Disconnected Retry Timeout:
|
48
|
+
Get Identifier:
|
49
|
+
Lifecycle Control:
|
50
|
+
Ping:
|
51
|
+
Recovery:
|
52
|
+
State Events:
|
53
|
+
Suspended Retry Timeout:
|
54
|
+
Message Echoes:
|
55
|
+
Message Queuing:
|
56
|
+
Transport Parameters:
|
57
|
+
REST:
|
58
|
+
Authentication:
|
59
|
+
Authorize:
|
60
|
+
Create Token Request:
|
61
|
+
Get Client Identifier:
|
62
|
+
Request Token:
|
63
|
+
Channel:
|
64
|
+
Existence Check:
|
65
|
+
Get:
|
66
|
+
History:
|
67
|
+
Iterate:
|
68
|
+
Name:
|
69
|
+
Presence:
|
70
|
+
History:
|
71
|
+
Member List:
|
72
|
+
Publish:
|
73
|
+
Idempotence:
|
74
|
+
Release:
|
75
|
+
Status:
|
76
|
+
Channel Details: # https://github.com/ably/ably-ruby/pull/365
|
77
|
+
Opaque Request:
|
78
|
+
Push Notifications Administration:
|
79
|
+
Channel Subscription:
|
80
|
+
List:
|
81
|
+
List Channels:
|
82
|
+
Remove:
|
83
|
+
Save:
|
84
|
+
Device Registration:
|
85
|
+
Get:
|
86
|
+
List:
|
87
|
+
Remove:
|
88
|
+
Save:
|
89
|
+
Publish:
|
90
|
+
Request Identifiers:
|
91
|
+
Request Timeout:
|
92
|
+
Service:
|
93
|
+
Get Time:
|
94
|
+
Statistics:
|
95
|
+
Query:
|
96
|
+
Service:
|
97
|
+
Environment:
|
98
|
+
Fallbacks:
|
99
|
+
Hosts:
|
100
|
+
Internet Up Check:
|
101
|
+
Retry Count:
|
102
|
+
Retry Duration:
|
103
|
+
Retry Timeout:
|
104
|
+
Host:
|
105
|
+
Testing:
|
106
|
+
Disable TLS:
|
107
|
+
TCP Insecure Port:
|
108
|
+
TCP Secure Port:
|
109
|
+
Transport:
|
110
|
+
Connection Open Timeout:
|
111
|
+
HTTP/2: # https://github.com/ably/ably-ruby/pull/197
|
112
|
+
Maximum Frame Size:
|
data/.github/workflows/check.yml
CHANGED
@@ -26,14 +26,24 @@ jobs:
|
|
26
26
|
PARALLEL_TEST_PROCESSORS: 2
|
27
27
|
RSPEC_RETRY: true
|
28
28
|
PROTOCOL: ${{ matrix.protocol }}
|
29
|
-
|
29
|
+
TEST_TYPE: ${{ matrix.type }}
|
30
|
+
RUBY_VERSION: ${{ matrix.ruby }}
|
31
|
+
run: |
|
32
|
+
mkdir junit
|
33
|
+
bundle exec parallel_rspec --prefix-output-with-test-env-number --first-is-1 -- spec/${{ matrix.type }}
|
34
|
+
- uses: actions/upload-artifact@v3
|
35
|
+
with:
|
36
|
+
path: |
|
37
|
+
junit/
|
38
|
+
coverage/
|
39
|
+
retention-days: 7
|
30
40
|
- name: Upload test results
|
31
41
|
if: always()
|
32
|
-
uses: ably
|
42
|
+
uses: ably/test-observability-action@v1
|
33
43
|
with:
|
34
44
|
server-url: 'https://test-observability.herokuapp.com'
|
35
45
|
server-auth: ${{ secrets.TEST_OBSERVABILITY_SERVER_AUTH_KEY }}
|
36
|
-
path: '
|
46
|
+
path: 'junit/'
|
37
47
|
- uses: coverallsapp/github-action@1.1.3
|
38
48
|
with:
|
39
49
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
on:
|
2
|
+
pull_request:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
permissions:
|
10
|
+
deployments: write
|
11
|
+
id-token: write
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: '2.7'
|
18
|
+
bundler-cache: true
|
19
|
+
|
20
|
+
- name: Build Documentation
|
21
|
+
run: |
|
22
|
+
bundle exec yard --readme INTRO.md --tag "spec:Specification"
|
23
|
+
ls -al doc/
|
24
|
+
- name: Configure AWS Credentials
|
25
|
+
uses: aws-actions/configure-aws-credentials@v1
|
26
|
+
with:
|
27
|
+
aws-region: eu-west-2
|
28
|
+
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/ably-sdk-builds-ably-ruby
|
29
|
+
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"
|
30
|
+
|
31
|
+
- name: Upload Documentation
|
32
|
+
uses: ably/sdk-upload-action@v1
|
33
|
+
with:
|
34
|
+
sourcePath: doc/
|
35
|
+
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
36
|
+
artifactName: docs
|
data/.rspec_parallel
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.2.4](https://github.com/ably/ably-ruby/tree/v1.2.4)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.2.3...v1.2.4)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- fix: unpin msgpack dependency minor/patch version [\#382](https://github.com/ably/ably-ruby-rest/pull/29)
|
10
|
+
|
11
|
+
## [v1.2.3](https://github.com/ably/ably-ruby/tree/v1.2.3)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.2.2...v1.2.3)
|
14
|
+
|
15
|
+
**Implemented enhancements:**
|
16
|
+
|
17
|
+
- Add full docstring coverage to public API [\#376](https://github.com/ably/ably-ruby/pull/376) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
18
|
+
|
19
|
+
**Fixed bugs:**
|
20
|
+
|
21
|
+
- Incorrect ProtocolMessage\#connection\_details object \(overwrites original connection\_details send on CONNECTED state\) [\#377](https://github.com/ably/ably-ruby/issues/377)
|
22
|
+
|
23
|
+
**Merged pull requests:**
|
24
|
+
|
25
|
+
- fix: remove inbound message size validation [\#382](https://github.com/ably/ably-ruby/pull/382) ([owenpearson](https://github.com/owenpearson))
|
26
|
+
- Changes related to docstring, generate docs and CI workflow [\#376](https://github.com/ably/ably-ruby/pull/376) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
27
|
+
- Fix doc comment: incorrect channel.state type [\#375](https://github.com/ably/ably-ruby/pull/375) ([lukaszsliwa](https://github.com/lukaszsliwa))
|
28
|
+
|
3
29
|
## [v1.2.2](https://github.com/ably/ably-ruby/tree/v1.2.2)
|
4
30
|
|
5
31
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.2.1...v1.2.2)
|
data/INTRO.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Ably `Ruby` Client Library SDK API Reference
|
2
|
+
|
3
|
+
The `Ruby` Client Library SDK supports a realtime and a REST interface.
|
4
|
+
|
5
|
+
The realtime interface enables a client to maintain a persistent connection to Ably and publish, subscribe and be present on channels.
|
6
|
+
The REST interface is stateless and typically implemented server-side. It is used to make requests such as retrieving statistics,
|
7
|
+
token authentication and publishing to a channel.
|
8
|
+
|
9
|
+
**Note**: The `Ruby` Client Library SDK implements the realtime and REST interfaces as two separate libraries.
|
10
|
+
|
11
|
+
The `Ruby` API references are generated from the [Ably `Ruby` Client Library SDK source code](https://github.com/ably/ably-ruby)
|
12
|
+
using [`yard`](https://yardoc.org/). View the [Ably docs](http://ably.com/docs/) for conceptual information on using Ably
|
13
|
+
and for client library API references split between the [realtime](http://ably.com/docs/api/realtime-sdk)
|
14
|
+
and [REST](http://ably.com/docs/api/rest-sdk) interfaces.
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# [Ably](https://ably.com)
|
2
2
|
|
3
|
+
[![Features](https://github.com/ably/ably-ruby/actions/workflows/features.yml/badge.svg)](https://github.com/ably/ably-ruby/actions/workflows/features.yml)
|
4
|
+
|
3
5
|
[![Gem Version](https://img.shields.io/gem/v/ably?style=flat)](https://img.shields.io/gem/v/ably?style=flat)
|
4
6
|
[![Coverage Status](https://coveralls.io/repos/ably/ably-ruby/badge.svg)](https://coveralls.io/r/ably/ably-ruby)
|
5
7
|
|
data/lib/ably/auth.rb
CHANGED
@@ -5,24 +5,7 @@ require 'securerandom'
|
|
5
5
|
require 'ably/rest/middleware/external_exceptions'
|
6
6
|
|
7
7
|
module Ably
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# Find out more about Ably authentication at: https://www.ably.com/docs/general/authentication/
|
11
|
-
#
|
12
|
-
# @!attribute [r] client_id
|
13
|
-
# @return [String] The provided client ID, used for identifying this client for presence purposes
|
14
|
-
# @!attribute [r] current_token_details
|
15
|
-
# @return [Ably::Models::TokenDetails] Current {Ably::Models::TokenDetails} issued by this library or one of the provided callbacks used to authenticate requests
|
16
|
-
# @!attribute [r] key
|
17
|
-
# @return [String] Complete API key containing both the key name and key secret, if present
|
18
|
-
# @!attribute [r] key_name
|
19
|
-
# @return [String] Key name (public part of the API key), if present
|
20
|
-
# @!attribute [r] key_secret
|
21
|
-
# @return [String] Key secret (private secure part of the API key), if present
|
22
|
-
# @!attribute [r] options
|
23
|
-
# @return [Hash] Default {Ably::Auth} options configured for this client
|
24
|
-
# @!attribute [r] token_params
|
25
|
-
# @return [Hash] Default token params used for token requests, see {#request_token}
|
8
|
+
# Creates Ably {Ably::Models::TokenRequest} objects and obtains Ably Tokens from Ably to subsequently issue to less trusted clients.
|
26
9
|
#
|
27
10
|
class Auth
|
28
11
|
include Ably::Modules::Conversions
|
@@ -124,9 +107,13 @@ module Ably
|
|
124
107
|
@token_params.freeze
|
125
108
|
end
|
126
109
|
|
127
|
-
#
|
110
|
+
# Instructs the library to get a new token immediately. When using the realtime client, it upgrades the current
|
111
|
+
# realtime connection to use the new token, or if not connected, initiates a connection to Ably, once the new token
|
112
|
+
# has been obtained. Also stores any `token_params` and `auth_options` passed
|
113
|
+
# in as the new defaults, to be used for all subsequent implicit or explicit token requests. Any `token_params`
|
114
|
+
# and `auth_options` objects passed in entirely replace, as opposed to being merged with, the current client library saved values.
|
128
115
|
#
|
129
|
-
#
|
116
|
+
# @spec RSA10
|
130
117
|
#
|
131
118
|
# @param [Hash, nil] token_params the token params used for future token requests. When nil, previously configured token params are used
|
132
119
|
# @param [Hash, nil] auth_options the authentication options used for future token requests. When nil, previously configure authentication options are used
|
@@ -205,7 +192,13 @@ module Ably
|
|
205
192
|
authorize(*args, &block)
|
206
193
|
end
|
207
194
|
|
208
|
-
#
|
195
|
+
# Calls the requestToken REST API endpoint to obtain an Ably Token according to the specified `token_params` and `auth_options`.
|
196
|
+
# Both `token_params` and `auth_options` are optional. When omitted or null, the default token parameters and authentication
|
197
|
+
# options for the client library are used, as specified in the `client_options` when the client library was instantiated,
|
198
|
+
# or later updated with an explicit authorize request. Values passed in are used instead of, rather than being merged with, the default values.
|
199
|
+
# To understand why an Ably {Ably::Models::TokenRequest} may be issued to clients in favor of a token, see Token Authentication explained.
|
200
|
+
#
|
201
|
+
# @spec RSA8e
|
209
202
|
#
|
210
203
|
# @param [Hash] auth_options (see #create_token_request)
|
211
204
|
# @option auth_options [String] :auth_url a URL to be used to GET or POST a set of token request params, to obtain a signed token request
|
@@ -217,7 +210,7 @@ module Ably
|
|
217
210
|
# @param [Hash] token_params (see #create_token_request)
|
218
211
|
# @option (see #create_token_request)
|
219
212
|
#
|
220
|
-
# @return [Ably::Models::TokenDetails]
|
213
|
+
# @return [Ably::Models::TokenDetails] A {Ably::Models::TokenDetails} object. RSA16
|
221
214
|
#
|
222
215
|
# @example
|
223
216
|
# # simple token request using basic auth
|
@@ -273,7 +266,17 @@ module Ably
|
|
273
266
|
send_token_request(token_request)
|
274
267
|
end
|
275
268
|
|
276
|
-
# Creates and signs
|
269
|
+
# Creates and signs an {Ably::Models::TokenRequest} based on the specified (or if none specified, the client
|
270
|
+
# library stored) `token_params` and `auth_options`. Note this can only be used when the API key value is available
|
271
|
+
# locally. Otherwise, the {Ably::Models::TokenRequest} must be obtained from the key owner. Use this to generate
|
272
|
+
# an {Ably::Models::TokenRequest} in order to implement an Ably Token request callback for use by other clients.
|
273
|
+
# Both `token_params` and `auth_options` are optional. When omitted or null, the default token parameters
|
274
|
+
# and authentication options for the client library are used, as specified in the `client_options` when the client
|
275
|
+
# library was instantiated, or later updated with an explicit authorize request. Values passed in are used instead
|
276
|
+
# of, rather than being merged with, the default values. To understand why an {Ably::Models::TokenRequest} may be
|
277
|
+
# issued to clients in favor of a token, see Token Authentication explained.
|
278
|
+
#
|
279
|
+
# @spec RSA9
|
277
280
|
#
|
278
281
|
# @param [Hash] token_params the token params used in the token request
|
279
282
|
# @option token_params [String] :client_id A client ID to associate with this token. The generated token may be used to authenticate as this +client_id+
|
@@ -4,6 +4,7 @@ module Ably::Models
|
|
4
4
|
# @param attributes (see #initialize)
|
5
5
|
#
|
6
6
|
# @return [AuthDetails]
|
7
|
+
#
|
7
8
|
def self.AuthDetails(attributes)
|
8
9
|
case attributes
|
9
10
|
when AuthDetails
|
@@ -27,14 +28,16 @@ module Ably::Models
|
|
27
28
|
self.attributes.freeze
|
28
29
|
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
# The authentication token string.
|
32
|
+
#
|
33
|
+
# @spec AD2
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
def access_token
|
38
|
+
attributes[:access_token]
|
34
39
|
end
|
35
40
|
|
36
|
-
# @!attribute [r] attributes
|
37
|
-
# @return [Hash] Access the token details Hash object ruby'fied to use symbolized keys
|
38
41
|
def attributes
|
39
42
|
@hash_object
|
40
43
|
end
|
@@ -4,6 +4,7 @@ module Ably::Models
|
|
4
4
|
# @param attributes (see #initialize)
|
5
5
|
#
|
6
6
|
# @return [ChannelDetails]
|
7
|
+
#
|
7
8
|
def self.ChannelDetails(attributes)
|
8
9
|
case attributes
|
9
10
|
when ChannelDetails
|
@@ -13,14 +14,17 @@ module Ably::Models
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
#
|
17
|
+
# Contains the details of a {Ably::Models::Rest::Channel} or {Ably::Models::Realtime::Channel} object
|
18
|
+
# such as its ID and {Ably::Models::ChannelStatus}.
|
17
19
|
#
|
18
20
|
class ChannelDetails
|
19
21
|
extend Ably::Modules::Enum
|
20
22
|
extend Forwardable
|
21
23
|
include Ably::Modules::ModelCommon
|
22
24
|
|
23
|
-
# The attributes of ChannelDetails
|
25
|
+
# The attributes of ChannelDetails
|
26
|
+
#
|
27
|
+
# @spec CHD2
|
24
28
|
#
|
25
29
|
attr_reader :attributes
|
26
30
|
|
@@ -32,7 +36,9 @@ module Ably::Models
|
|
32
36
|
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
33
37
|
end
|
34
38
|
|
35
|
-
# The identifier of the channel
|
39
|
+
# The identifier of the channel
|
40
|
+
#
|
41
|
+
# @spec CHD2a
|
36
42
|
#
|
37
43
|
# @return [String]
|
38
44
|
#
|
@@ -40,7 +46,9 @@ module Ably::Models
|
|
40
46
|
attributes[:channel_id]
|
41
47
|
end
|
42
48
|
|
43
|
-
# The identifier of the channel
|
49
|
+
# The identifier of the channel
|
50
|
+
#
|
51
|
+
# @spec CHD2a
|
44
52
|
#
|
45
53
|
# @return [String]
|
46
54
|
#
|
@@ -48,7 +56,9 @@ module Ably::Models
|
|
48
56
|
attributes[:name]
|
49
57
|
end
|
50
58
|
|
51
|
-
#
|
59
|
+
# A {Ably::Models::ChannelStatus} object.
|
60
|
+
#
|
61
|
+
# @spec CHD2b
|
52
62
|
#
|
53
63
|
# @return [Ably::Models::ChannelStatus, nil]
|
54
64
|
#
|
@@ -4,6 +4,7 @@ module Ably::Models
|
|
4
4
|
# @param attributes (see #initialize)
|
5
5
|
#
|
6
6
|
# @return [ChannelMetrics]
|
7
|
+
#
|
7
8
|
def self.ChannelMetrics(attributes)
|
8
9
|
case attributes
|
9
10
|
when ChannelMetrics
|
@@ -13,8 +14,10 @@ module Ably::Models
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
#
|
17
|
-
#
|
17
|
+
# Contains the metrics associated with a {Ably::Models::Rest::Channel} or {Ably::Models::Realtime::Channel},
|
18
|
+
# such as the number of publishers, subscribers and connections it has.
|
19
|
+
#
|
20
|
+
# @spec CHM1
|
18
21
|
#
|
19
22
|
class ChannelMetrics
|
20
23
|
extend Ably::Modules::Enum
|
@@ -33,7 +36,9 @@ module Ably::Models
|
|
33
36
|
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
34
37
|
end
|
35
38
|
|
36
|
-
# The
|
39
|
+
# The number of realtime connections attached to the channel.
|
40
|
+
#
|
41
|
+
# @spec CHM2a
|
37
42
|
#
|
38
43
|
# @return [Integer]
|
39
44
|
#
|
@@ -41,7 +46,11 @@ module Ably::Models
|
|
41
46
|
attributes[:connections]
|
42
47
|
end
|
43
48
|
|
44
|
-
# The
|
49
|
+
# The number of realtime connections attached to the channel with permission to enter the presence set, regardless
|
50
|
+
# of whether or not they have entered it. This requires the presence capability and for a client to not have specified
|
51
|
+
# a {Ably::Models::ChannelOptions::MODES} flag that excludes {Ably::Models::ChannelOptions::MODES}#PRESENCE.
|
52
|
+
#
|
53
|
+
# @spec CHM2b
|
45
54
|
#
|
46
55
|
# @return [Integer]
|
47
56
|
#
|
@@ -49,7 +58,9 @@ module Ably::Models
|
|
49
58
|
attributes[:presence_connections]
|
50
59
|
end
|
51
60
|
|
52
|
-
# The
|
61
|
+
# The number of members in the presence set of the channel.
|
62
|
+
#
|
63
|
+
# @spec CHM2c
|
53
64
|
#
|
54
65
|
# @return [Integer]
|
55
66
|
#
|
@@ -57,7 +68,11 @@ module Ably::Models
|
|
57
68
|
attributes[:presence_members]
|
58
69
|
end
|
59
70
|
|
60
|
-
# The
|
71
|
+
# The number of realtime attachments receiving presence messages on the channel. This requires the subscribe capability
|
72
|
+
# and for a client to not have specified a {Ably::Models::ChannelOptions::MODES} flag that excludes
|
73
|
+
# {Ably::Models::ChannelOptions::MODES}#PRESENCE_SUBSCRIBE.
|
74
|
+
#
|
75
|
+
# @spec CHM2d
|
61
76
|
#
|
62
77
|
# @return [Integer]
|
63
78
|
#
|
@@ -65,7 +80,11 @@ module Ably::Models
|
|
65
80
|
attributes[:presence_subscribers]
|
66
81
|
end
|
67
82
|
|
68
|
-
# The
|
83
|
+
# The number of realtime attachments permitted to publish messages to the channel. This requires the publish
|
84
|
+
# capability and for a client to not have specified a {Ably::Models::ChannelOptions::MODES} flag that excludes
|
85
|
+
# {Ably::Models::ChannelOptions::MODES}#PUBLISH.
|
86
|
+
#
|
87
|
+
# @spec CHM2e
|
69
88
|
#
|
70
89
|
# @return [Integer]
|
71
90
|
#
|
@@ -73,7 +92,11 @@ module Ably::Models
|
|
73
92
|
attributes[:publishers]
|
74
93
|
end
|
75
94
|
|
76
|
-
# The
|
95
|
+
# The number of realtime attachments receiving messages on the channel. This requires the subscribe capability and
|
96
|
+
# for a client to not have specified a {Ably::Models::ChannelOptions::MODES} flag that excludes
|
97
|
+
# {Ably::Models::ChannelOptions::MODES}#SUBSCRIBE.
|
98
|
+
#
|
99
|
+
# @spec CHM2f
|
77
100
|
#
|
78
101
|
# @return [Integer]
|
79
102
|
#
|
@@ -4,6 +4,7 @@ module Ably::Models
|
|
4
4
|
# @param attributes (see #initialize)
|
5
5
|
#
|
6
6
|
# @return [ChannelOccupancy]
|
7
|
+
#
|
7
8
|
def self.ChannelOccupancy(attributes)
|
8
9
|
case attributes
|
9
10
|
when ChannelOccupancy
|
@@ -13,14 +14,18 @@ module Ably::Models
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
#
|
17
|
+
# Contains the metrics of a {Ably::Models::Rest::Channel} or {Ably::Models::Realtime::Channel} object.
|
18
|
+
#
|
19
|
+
# @spec CHO1
|
17
20
|
#
|
18
21
|
class ChannelOccupancy
|
19
22
|
extend Ably::Modules::Enum
|
20
23
|
extend Forwardable
|
21
24
|
include Ably::Modules::ModelCommon
|
22
25
|
|
23
|
-
# The attributes of ChannelOccupancy
|
26
|
+
# The attributes of ChannelOccupancy.
|
27
|
+
#
|
28
|
+
# @spec CH02
|
24
29
|
#
|
25
30
|
attr_reader :attributes
|
26
31
|
|
@@ -32,7 +37,9 @@ module Ably::Models
|
|
32
37
|
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
33
38
|
end
|
34
39
|
|
35
|
-
#
|
40
|
+
# A {Ably::Models::ChannelMetrics} object.
|
41
|
+
#
|
42
|
+
# @spec CHO2a
|
36
43
|
#
|
37
44
|
# @return [Ably::Models::ChannelMetrics, nil]
|
38
45
|
#
|
@@ -4,6 +4,7 @@ module Ably::Models
|
|
4
4
|
# @param attributes (see #initialize)
|
5
5
|
#
|
6
6
|
# @return [ChannelOptions]
|
7
|
+
#
|
7
8
|
def self.ChannelOptions(attributes)
|
8
9
|
case attributes
|
9
10
|
when ChannelOptions
|
@@ -19,6 +20,15 @@ module Ably::Models
|
|
19
20
|
extend Forwardable
|
20
21
|
include Ably::Modules::ModelCommon
|
21
22
|
|
23
|
+
# Describes the possible flags used to configure client capabilities, using {Ably::Models::ChannelOptions::MODES}.
|
24
|
+
#
|
25
|
+
# PRESENCE The client can enter the presence set.
|
26
|
+
# PUBLISH The client can publish messages.
|
27
|
+
# SUBSCRIBE The client can subscribe to messages.
|
28
|
+
# PRESENCE_SUBSCRIBE The client can receive presence messages.
|
29
|
+
#
|
30
|
+
# @spec TB2d
|
31
|
+
#
|
22
32
|
MODES = ruby_enum('MODES',
|
23
33
|
presence: 0,
|
24
34
|
publish: 1,
|
@@ -33,6 +43,8 @@ module Ably::Models
|
|
33
43
|
def_delegators :attributes, :fetch, :size, :empty?
|
34
44
|
# Initialize a new ChannelOptions
|
35
45
|
#
|
46
|
+
# @spec TB3
|
47
|
+
#
|
36
48
|
# @option params [Hash] (TB2c) params (for realtime client libraries only) a of key/value pairs
|
37
49
|
# @option modes [Hash] modes (for realtime client libraries only) an array of ChannelMode
|
38
50
|
# @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.
|
@@ -45,23 +57,33 @@ module Ably::Models
|
|
45
57
|
attributes.clone
|
46
58
|
end
|
47
59
|
|
48
|
-
#
|
60
|
+
# Requests encryption for this channel when not null, and specifies encryption-related parameters (such as algorithm,
|
61
|
+
# chaining mode, key length and key). See an example.
|
62
|
+
#
|
63
|
+
# @spec RSL5a, TB2b
|
49
64
|
#
|
50
65
|
# @return [CipherParams]
|
66
|
+
#
|
51
67
|
def cipher
|
52
68
|
attributes[:cipher]
|
53
69
|
end
|
54
70
|
|
55
|
-
#
|
71
|
+
# Channel Parameters that configure the behavior of the channel.
|
72
|
+
#
|
73
|
+
# @spec TB2c
|
56
74
|
#
|
57
75
|
# @return [Hash]
|
76
|
+
#
|
58
77
|
def params
|
59
78
|
attributes[:params].to_h
|
60
79
|
end
|
61
80
|
|
62
|
-
#
|
81
|
+
# An array of {Ably:Models:ChannelOptions::MODES} objects.
|
82
|
+
#
|
83
|
+
# @spec TB2d
|
63
84
|
#
|
64
85
|
# @return [Array<ChannelOptions::MODES>]
|
86
|
+
#
|
65
87
|
def modes
|
66
88
|
attributes[:modes]
|
67
89
|
end
|
@@ -69,6 +91,7 @@ module Ably::Models
|
|
69
91
|
# Converts modes to a bitfield that coresponds to ProtocolMessage#flags
|
70
92
|
#
|
71
93
|
# @return [Integer]
|
94
|
+
#
|
72
95
|
def modes_to_flags
|
73
96
|
modes.map { |mode| Ably::Models::ProtocolMessage::ATTACH_FLAGS_MAPPING[mode.to_sym] }.reduce(:|)
|
74
97
|
end
|