ably 1.2.0 → 1.2.1
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 +1 -1
- data/CHANGELOG.md +21 -27
- data/README.md +1 -1
- data/ably.gemspec +11 -24
- data/lib/ably/auth.rb +5 -5
- data/lib/ably/logger.rb +4 -4
- data/lib/ably/models/device_details.rb +1 -1
- data/lib/ably/models/protocol_message.rb +2 -2
- data/lib/ably/models/token_request.rb +1 -1
- data/lib/ably/modules/ably.rb +1 -1
- data/lib/ably/realtime/auth.rb +2 -2
- data/lib/ably/rest/client.rb +4 -4
- data/lib/ably/rest/middleware/encoder.rb +1 -1
- data/lib/ably/rest/middleware/exceptions.rb +1 -1
- data/lib/ably/rest/middleware/external_exceptions.rb +1 -1
- data/lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb +1 -1
- data/lib/ably/rest/middleware/logger.rb +1 -1
- data/lib/ably/rest/middleware/parse_json.rb +1 -1
- data/lib/ably/rest/middleware/parse_message_pack.rb +1 -1
- data/lib/ably/version.rb +1 -1
- data/spec/acceptance/realtime/connection_spec.rb +20 -0
- data/spec/acceptance/rest/client_spec.rb +1 -1
- data/spec/run_parallel_tests +2 -7
- data/spec/unit/logger_spec.rb +6 -14
- metadata +25 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d535fd596cbed132fc9c540fb46997c5fcaafeae4b4531ab6fbe02dba33178f
|
4
|
+
data.tar.gz: 1792b4e4f47d7044d0a937d3b75f9e3b9d9f1d6a436a36bfde2f9e65ae3f2552
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fad634a453ebbb3d1b05ad13fa7c3683e794635862267376920aa7d43e93afeab7c5ba06398609e048d7f421f8d10f80f9866828f07468e153be843f6b38a136
|
7
|
+
data.tar.gz: 1d76ae8ffe50a043b82fbb553af787a2a49665909d802f6471644e9614d81677d04c38926cb34890a2daeef2d498cabe7c39817c40fbb8d1be88070d2d103669
|
data/.github/workflows/check.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.2.1](https://github.com/ably/ably-ruby/tree/v1.2.1)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.2.0...v1.2.1)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Update Ruby version \(and Gemfile.lock dependencies\) [\#253](https://github.com/ably/ably-ruby/issues/253)
|
10
|
+
- Error not emitted when failing to connect to an endpoint indefinitely [\#233](https://github.com/ably/ably-ruby/issues/233)
|
11
|
+
- Connection errors when there should be warnings [\#198](https://github.com/ably/ably-ruby/issues/198)
|
12
|
+
- Implement presence re-entry requirement change for 1.1 [\#185](https://github.com/ably/ably-ruby/issues/185)
|
13
|
+
|
14
|
+
**Closed issues:**
|
15
|
+
|
16
|
+
- Update urls in readme [\#353](https://github.com/ably/ably-ruby/issues/353)
|
17
|
+
- Reconsider required Ruby version [\#344](https://github.com/ably/ably-ruby/issues/344)
|
18
|
+
|
3
19
|
## [v1.2.0](https://github.com/ably/ably-ruby/tree/v1.2.0)
|
4
20
|
|
5
21
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.8...v1.2.0)
|
@@ -8,33 +24,11 @@ This release updates ably-ruby to be compliant with the 1.2 version of the Ably
|
|
8
24
|
|
9
25
|
**Closed issues:**
|
10
26
|
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
14
|
-
-
|
15
|
-
-
|
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)
|
27
|
+
- Add Channel.setOptions method [\#291](https://github.com/ably/ably-ruby/issues/291)
|
28
|
+
- Add support for channel params [\#288](https://github.com/ably/ably-ruby/issues/288)
|
29
|
+
- Use ATTACH_RESUME flag for unclean attaches [\#287](https://github.com/ably/ably-ruby/issues/287)
|
30
|
+
- Add ChannelOptions param to Channels.get [\#285](https://github.com/ably/ably-ruby/issues/285)
|
31
|
+
- Update library to adhere to new spec for token renewal (see [the spec definition](https://docs.ably.io/client-lib-development-guide/features/#RSA4b) for more info) [\#268](https://github.com/ably/ably-ruby/issues/268)
|
38
32
|
|
39
33
|
**Merged pull requests:**
|
40
34
|
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ This is a Ruby client library for Ably. The library currently targets the [Ably
|
|
9
9
|
|
10
10
|
## Supported platforms
|
11
11
|
|
12
|
-
This SDK supports Ruby
|
12
|
+
This SDK supports Ruby 2.7 and 3.x. For eventmachine and Ruby 3.x note please visit [Ruby 3.0 support](#ruby-30-support) section.
|
13
13
|
|
14
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`.
|
15
15
|
|
data/ably.gemspec
CHANGED
@@ -20,41 +20,28 @@ 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', '~>
|
24
|
-
spec.add_runtime_dependency 'faraday', '~>
|
23
|
+
spec.add_runtime_dependency 'statesman', '~> 9.0'
|
24
|
+
spec.add_runtime_dependency 'faraday', '~> 2.2'
|
25
|
+
spec.add_runtime_dependency 'faraday-typhoeus', '~> 0.2.0'
|
25
26
|
spec.add_runtime_dependency 'typhoeus', '~> 1.4'
|
26
|
-
|
27
|
-
if RUBY_VERSION.match(/^1\./)
|
28
|
-
spec.add_runtime_dependency 'json', '< 2.0'
|
29
|
-
else
|
30
|
-
spec.add_runtime_dependency 'json'
|
31
|
-
end
|
27
|
+
spec.add_runtime_dependency 'json'
|
32
28
|
spec.add_runtime_dependency 'websocket-driver', '~> 0.7'
|
33
29
|
spec.add_runtime_dependency 'msgpack', '>= 1.3.0'
|
34
30
|
spec.add_runtime_dependency 'addressable', '>= 2.0.0'
|
35
31
|
|
36
32
|
spec.add_development_dependency 'rake', '~> 13.0'
|
37
33
|
spec.add_development_dependency 'redcarpet', '~> 3.3'
|
38
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.11.0'
|
39
35
|
spec.add_development_dependency 'rspec-retry', '~> 0.6'
|
40
36
|
spec.add_development_dependency 'yard', '~> 0.9'
|
41
37
|
spec.add_development_dependency 'rspec-instafail', '~> 1.0'
|
42
38
|
spec.add_development_dependency 'bundler', '>= 1.3.0'
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
spec.add_development_dependency 'webmock', '~> 3.11'
|
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'
|
53
|
-
if !RUBY_VERSION.match(/^2\.[0123]/)
|
54
|
-
spec.add_development_dependency 'pry', '~> 0.14.1'
|
55
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.8.0'
|
56
|
-
end
|
57
|
-
end
|
39
|
+
spec.add_development_dependency 'webmock', '~> 3.11'
|
40
|
+
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
41
|
+
spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
|
42
|
+
spec.add_development_dependency 'parallel_tests', '~> 3.8'
|
43
|
+
spec.add_development_dependency 'pry', '~> 0.14.1'
|
44
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.8.0'
|
58
45
|
|
59
46
|
if RUBY_VERSION.match(/^3\./)
|
60
47
|
spec.add_development_dependency 'webrick', '~> 1.7.0'
|
data/lib/ably/auth.rb
CHANGED
@@ -5,9 +5,9 @@ require 'securerandom'
|
|
5
5
|
require 'ably/rest/middleware/external_exceptions'
|
6
6
|
|
7
7
|
module Ably
|
8
|
-
# Auth is responsible for authentication with {https://www.ably.
|
8
|
+
# Auth is responsible for authentication with {https://www.ably.com Ably} using basic or token authentication
|
9
9
|
#
|
10
|
-
# Find out more about Ably authentication at: https://www.ably.
|
10
|
+
# Find out more about Ably authentication at: https://www.ably.com/docs/general/authentication/
|
11
11
|
#
|
12
12
|
# @!attribute [r] client_id
|
13
13
|
# @return [String] The provided client ID, used for identifying this client for presence purposes
|
@@ -35,7 +35,7 @@ module Ably
|
|
35
35
|
|
36
36
|
API_KEY_REGEX = /^[\w-]{2,}\.[\w-]{2,}:[\w-]{2,}$/
|
37
37
|
|
38
|
-
# Supported AuthOption keys, see https://www.ably.
|
38
|
+
# Supported AuthOption keys, see https://www.ably.com/docs/realtime/types#auth-options
|
39
39
|
# TODO: Review client_id usage embedded incorrectly within AuthOptions.
|
40
40
|
# This is legacy code to configure a client with a client_id from the ClientOptions
|
41
41
|
# TODO: Review inclusion of use_token_auth, ttl, token_params in auth options
|
@@ -277,7 +277,7 @@ module Ably
|
|
277
277
|
#
|
278
278
|
# @param [Hash] token_params the token params used in the token request
|
279
279
|
# @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+
|
280
|
-
# @option token_params [Integer] :ttl validity time in seconds for the requested {Ably::Models::TokenDetails}. Limits may apply, see {https://www.ably.
|
280
|
+
# @option token_params [Integer] :ttl validity time in seconds for the requested {Ably::Models::TokenDetails}. Limits may apply, see {https://www.ably.com/docs/general/authentication}
|
281
281
|
# @option token_params [Hash] :capability canonicalised representation of the resource paths and associated operations
|
282
282
|
# @option token_params [Time] :timestamp the time of the request
|
283
283
|
# @option token_params [String] :nonce an unquoted, unescaped random string of at least 16 characters
|
@@ -285,7 +285,7 @@ module Ably
|
|
285
285
|
# @param [Hash] auth_options the authentication options for the token request
|
286
286
|
# @option auth_options [String] :key API key comprising the key name and key secret in a single string
|
287
287
|
# @option auth_options [String] :client_id client ID identifying this connection to other clients (will use +client_id+ specified when library was instanced if provided)
|
288
|
-
# @option auth_options [Boolean] :query_time when true will query the {https://www.ably.
|
288
|
+
# @option auth_options [Boolean] :query_time when true will query the {https://www.ably.com Ably} system for the current time instead of using the local time
|
289
289
|
# @option auth_options [Hash] :token_params convenience to pass in +token_params+ within the +auth_options+ argument, especially useful when setting default token_params in the client constructor
|
290
290
|
#
|
291
291
|
# @return [Models::TokenRequest]
|
data/lib/ably/logger.rb
CHANGED
@@ -7,9 +7,9 @@ module Ably
|
|
7
7
|
extend Forwardable
|
8
8
|
|
9
9
|
# @param client [Ably::Rest::Client,Ably::Realtime::Client] Rest or Realtime Ably client
|
10
|
-
# @param log_level [Integer] {http://www.ruby-doc.org/stdlib-1.
|
10
|
+
# @param log_level [Integer] {http://www.ruby-doc.org/stdlib-3.1.1/libdoc/logger/rdoc/Logger.html Ruby Logger} log level
|
11
11
|
# @param custom_logger [nil,Object] A custom logger can optionally be used instead of the,
|
12
|
-
# however it must provide a {http://www.ruby-doc.org/stdlib-1.
|
12
|
+
# however it must provide a {http://www.ruby-doc.org/stdlib-3.1.1/libdoc/logger/rdoc/Logger.html Ruby Logger} compatible interface.
|
13
13
|
#
|
14
14
|
def initialize(client, log_level, custom_logger = nil)
|
15
15
|
@client = client
|
@@ -24,7 +24,7 @@ module Ably
|
|
24
24
|
@log_mutex = Mutex.new
|
25
25
|
end
|
26
26
|
|
27
|
-
# The logger used by this class, defaults to {http://www.ruby-doc.org/stdlib-1.
|
27
|
+
# The logger used by this class, defaults to {http://www.ruby-doc.org/stdlib-3.1.1/libdoc/logger/rdoc/Logger.html Ruby Logger}
|
28
28
|
# @return {Object,Logger}
|
29
29
|
attr_reader :logger
|
30
30
|
|
@@ -32,7 +32,7 @@ module Ably
|
|
32
32
|
# @return {nil,Object}
|
33
33
|
attr_reader :custom_logger
|
34
34
|
|
35
|
-
# The log level ranging from DEBUG to FATAL, refer to http://www.ruby-doc.org/stdlib-1.
|
35
|
+
# The log level ranging from DEBUG to FATAL, refer to http://www.ruby-doc.org/stdlib-3.1.1/libdoc/logger/rdoc/Logger.html
|
36
36
|
# @return {Integer}
|
37
37
|
attr_reader :log_level
|
38
38
|
|
@@ -27,7 +27,7 @@ module Ably::Models
|
|
27
27
|
# @!attribute [r] form_factor
|
28
28
|
# @return [String] Device form factor such as phone, tablet, watch
|
29
29
|
# @!attribute [r] client_id
|
30
|
-
# @return [String] The authenticated client identifier for this device. See {https://www.ably.
|
30
|
+
# @return [String] The authenticated client identifier for this device. See {https://www.ably.com/docs/general/authentication#identified-clients auth documentation}.
|
31
31
|
# @!attribute [r] metadata
|
32
32
|
# @return [Hash] Arbitrary metadata that can be associated with a device
|
33
33
|
# @!attribute [r] device_secret
|
@@ -3,7 +3,7 @@ module Ably::Models
|
|
3
3
|
# A ProtocolMessage always relates to a single channel only, but
|
4
4
|
# can contain multiple individual Messages or PresenceMessages.
|
5
5
|
# ProtocolMessages are serially numbered on a connection.
|
6
|
-
# See the {http://
|
6
|
+
# See the {http://ably.com/docs/client-lib-development-guide/protocol/ Ably client library developer documentation}
|
7
7
|
# for further details on the members of a ProtocolMessage
|
8
8
|
#
|
9
9
|
# @!attribute [r] action
|
@@ -11,7 +11,7 @@ module Ably::Models
|
|
11
11
|
# @!attribute [r] auth
|
12
12
|
# @return [Ably::Models::AuthDetails] Authentication details used to perform authentication upgrades over an existing transport
|
13
13
|
# @!attribute [r] count
|
14
|
-
# @return [Integer] The count field is used for ACK and NACK actions. See {http://
|
14
|
+
# @return [Integer] The count field is used for ACK and NACK actions. See {http://ably.com/docs/client-lib-development-guide/protocol/#message-acknowledgement message acknowledgement protocol}
|
15
15
|
# @!attribute [r] error
|
16
16
|
# @return [ErrorInfo] Contains error information
|
17
17
|
# @!attribute [r] channel
|
@@ -98,7 +98,7 @@ module Ably::Models
|
|
98
98
|
|
99
99
|
# @!attribute [r] mac
|
100
100
|
# @return [String] the Message Authentication Code for this request. See the
|
101
|
-
# {https://www.ably.
|
101
|
+
# {https://www.ably.com/docs Ably Authentication documentation} for more details.
|
102
102
|
def mac
|
103
103
|
attributes.fetch(:mac) { raise Ably::Exceptions::InvalidTokenRequest, 'MAC is missing' }
|
104
104
|
end
|
data/lib/ably/modules/ably.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
module Ably
|
7
7
|
# Fallback hosts to use when a connection to rest/realtime.ably.io is not possible due to
|
8
8
|
# network failures either at the client, between the client and Ably, within an Ably data center, or at the IO domain registrar
|
9
|
-
# see https://
|
9
|
+
# see https://ably.com/docs/client-lib-development-guide/features/#RSC15a
|
10
10
|
#
|
11
11
|
FALLBACK_DOMAIN = 'ably-realtime.com'.freeze
|
12
12
|
FALLBACK_IDS = %w(a b c d e).freeze
|
data/lib/ably/realtime/auth.rb
CHANGED
@@ -2,10 +2,10 @@ require 'ably/auth'
|
|
2
2
|
|
3
3
|
module Ably
|
4
4
|
module Realtime
|
5
|
-
# Auth is responsible for authentication with {https://www.ably.
|
5
|
+
# Auth is responsible for authentication with {https://www.ably.com Ably} using basic or token authentication
|
6
6
|
# This {Ably::Realtime::Auth Realtime::Auth} class wraps the {Ably::Auth Synchronous Ably::Auth} class in an EventMachine friendly way using Deferrables for all IO. See {Ably::Auth Ably::Auth} for more information
|
7
7
|
#
|
8
|
-
# Find out more about Ably authentication at: https://www.ably.
|
8
|
+
# Find out more about Ably authentication at: https://www.ably.com/docs/general/authentication/
|
9
9
|
#
|
10
10
|
# @!attribute [r] client_id
|
11
11
|
# (see Ably::Auth#client_id)
|
data/lib/ably/rest/client.rb
CHANGED
@@ -4,7 +4,7 @@ require 'logger'
|
|
4
4
|
require 'uri'
|
5
5
|
|
6
6
|
require 'typhoeus'
|
7
|
-
require 'typhoeus
|
7
|
+
require 'faraday/typhoeus'
|
8
8
|
|
9
9
|
require 'ably/rest/middleware/exceptions'
|
10
10
|
|
@@ -55,7 +55,7 @@ module Ably
|
|
55
55
|
# @return [Symbol]
|
56
56
|
attr_reader :protocol
|
57
57
|
|
58
|
-
# Client agent i.e. `example-gem/1.2.0 ably-ruby/1.1.5 ruby/1.
|
58
|
+
# Client agent i.e. `example-gem/1.2.0 ably-ruby/1.1.5 ruby/3.1.1`
|
59
59
|
# @return [String]
|
60
60
|
attr_reader :agent
|
61
61
|
|
@@ -139,7 +139,7 @@ module Ably
|
|
139
139
|
# @option options [Symbol] :protocol (:msgpack) Protocol used to communicate with Ably, :json and :msgpack currently supported
|
140
140
|
# @option options [Boolean] :use_binary_protocol (true) When true will use the MessagePack binary protocol, when false it will use JSON encoding. This option will overide :protocol option
|
141
141
|
# @option options [Logger::Severity,Symbol] :log_level (Logger::WARN) Log level for the standard Logger that outputs to STDOUT. Can be set to :fatal (Logger::FATAL), :error (Logger::ERROR), :warn (Logger::WARN), :info (Logger::INFO), :debug (Logger::DEBUG) or :none
|
142
|
-
# @option options [Logger] :logger A custom logger can be used however it must adhere to the Ruby Logger interface, see http://www.ruby-doc.org/stdlib-1.
|
142
|
+
# @option options [Logger] :logger A custom logger can be used however it must adhere to the Ruby Logger interface, see http://www.ruby-doc.org/stdlib-3.1.1/libdoc/logger/rdoc/Logger.html
|
143
143
|
# @option options [String] :client_id client ID identifying this connection to other clients
|
144
144
|
# @option 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
|
145
145
|
# @option options [Hash] :auth_headers a set of application-specific headers to be added to any request made to the +auth_url+
|
@@ -147,7 +147,7 @@ module Ably
|
|
147
147
|
# @option options [Symbol] :auth_method (:get) HTTP method to use with +auth_url+, must be either +:get+ or +:post+
|
148
148
|
# @option options [Proc] :auth_callback when provided, the Proc will be called with the token params hash as the first argument, whenever a new token is required.
|
149
149
|
# The Proc should return a token string, {Ably::Models::TokenDetails} or JSON equivalent, {Ably::Models::TokenRequest} or JSON equivalent
|
150
|
-
# @option options [Boolean] :query_time when true will query the {https://www.ably.
|
150
|
+
# @option options [Boolean] :query_time when true will query the {https://www.ably.com Ably} system for the current time instead of using the local time
|
151
151
|
# @option options [Hash] :default_token_params convenience to pass in +token_params+ that will be used as a default for all token requests. See {Auth#create_token_request}
|
152
152
|
#
|
153
153
|
# @option options [Integer] :http_open_timeout (4 seconds) timeout in seconds for opening an HTTP connection for all HTTP requests
|
@@ -5,7 +5,7 @@ module Ably
|
|
5
5
|
module Rest
|
6
6
|
module Middleware
|
7
7
|
# Encode the body of the message according to the mime type
|
8
|
-
class Encoder <
|
8
|
+
class Encoder < Faraday::Middleware
|
9
9
|
CONTENT_TYPE = 'Content-Type'.freeze unless defined? CONTENT_TYPE
|
10
10
|
|
11
11
|
def call(env)
|
@@ -6,7 +6,7 @@ module Ably
|
|
6
6
|
module Middleware
|
7
7
|
# HTTP exceptions raised by Ably due to an error status code
|
8
8
|
# Ably returns JSON/Msgpack error codes and messages so include this if possible in the exception messages
|
9
|
-
class Exceptions < Faraday::
|
9
|
+
class Exceptions < Faraday::Middleware
|
10
10
|
def on_complete(env)
|
11
11
|
if env.status >= 400
|
12
12
|
error_status_code = env.status
|
@@ -5,7 +5,7 @@ module Ably
|
|
5
5
|
module Middleware
|
6
6
|
# HTTP exceptions raised due to a status code error on a 3rd party site
|
7
7
|
# Used by auth calls
|
8
|
-
class ExternalExceptions < Faraday::
|
8
|
+
class ExternalExceptions < Faraday::Middleware
|
9
9
|
def on_complete(env)
|
10
10
|
if env.status >= 400
|
11
11
|
error_status_code = env.status
|
@@ -4,7 +4,7 @@ require 'json'
|
|
4
4
|
module Ably
|
5
5
|
module Rest
|
6
6
|
module Middleware
|
7
|
-
class FailIfUnsupportedMimeType < Faraday::
|
7
|
+
class FailIfUnsupportedMimeType < Faraday::Middleware
|
8
8
|
def on_complete(env)
|
9
9
|
unless env.response_headers['Ably-Middleware-Parsed'] == true
|
10
10
|
# Ignore empty body with success status code for no body response
|
@@ -4,7 +4,7 @@ require 'json'
|
|
4
4
|
module Ably
|
5
5
|
module Rest
|
6
6
|
module Middleware
|
7
|
-
class ParseJson < Faraday::
|
7
|
+
class ParseJson < Faraday::Middleware
|
8
8
|
def on_complete(env)
|
9
9
|
if env.response_headers['Content-Type'] == 'application/json'
|
10
10
|
env.body = parse(env.body) unless env.response_headers['Ably-Middleware-Parsed'] == true
|
@@ -4,7 +4,7 @@ require 'msgpack'
|
|
4
4
|
module Ably
|
5
5
|
module Rest
|
6
6
|
module Middleware
|
7
|
-
class ParseMessagePack < Faraday::
|
7
|
+
class ParseMessagePack < Faraday::Middleware
|
8
8
|
def on_complete(env)
|
9
9
|
if env.response_headers['Content-Type'] == 'application/x-msgpack'
|
10
10
|
env.body = parse(env.body) unless env.response_headers['Ably-Middleware-Parsed'] == true
|
data/lib/ably/version.rb
CHANGED
@@ -482,6 +482,26 @@ describe Ably::Realtime::Connection, :event_machine do
|
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
485
|
+
context "when can't connect to host" do
|
486
|
+
let(:client_options) { super().merge(realtime_host: 'non-existent.ably.io') }
|
487
|
+
|
488
|
+
it 'logs error on failed connection attempt' do
|
489
|
+
logger_expectation = lambda do |*args, &block|
|
490
|
+
error_message = "Connection to non-existent.ably.io:443 failed"
|
491
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to include(error_message)
|
492
|
+
stop_reactor
|
493
|
+
end
|
494
|
+
|
495
|
+
expect(connection.logger).to receive(:warn, &logger_expectation).at_least(:once)
|
496
|
+
|
497
|
+
connection.on(:connected) do
|
498
|
+
raise "Connection should not succeed"
|
499
|
+
end
|
500
|
+
|
501
|
+
connection.connect
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
485
505
|
context 'when explicitly reconnecting disconnected/suspended connection in retry (#RTN11c)' do
|
486
506
|
let(:close_connection_proc) do
|
487
507
|
lambda do
|
@@ -1081,7 +1081,7 @@ describe Ably::Rest::Client do
|
|
1081
1081
|
end
|
1082
1082
|
|
1083
1083
|
context 'version headers', :webmock do
|
1084
|
-
[nil, 'ably-ruby/1.1.1 ruby/1.
|
1084
|
+
[nil, 'ably-ruby/1.1.1 ruby/3.1.1'].each do |agent|
|
1085
1085
|
context "with #{agent ? "custom #{agent}" : 'default'} agent" do
|
1086
1086
|
let(:client_options) { default_options.merge(key: api_key, agent: agent) }
|
1087
1087
|
|
data/spec/run_parallel_tests
CHANGED
@@ -11,13 +11,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
11
11
|
bundle exec rspec "${DIR}/unit"
|
12
12
|
unit_status=$?
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
# So it will be jumbled sadly for 1.9.*
|
17
|
-
bundle exec parallel_rspec "${DIR}/acceptance"
|
18
|
-
else
|
19
|
-
bundle exec parallel_rspec "${DIR}/acceptance" --prefix-output-with-test-env-number
|
20
|
-
fi
|
14
|
+
bundle exec parallel_rspec "${DIR}/acceptance" --prefix-output-with-test-env-number
|
15
|
+
|
21
16
|
acceptance_status=$?
|
22
17
|
|
23
18
|
if [ $unit_status -ne 0 ]; then
|
data/spec/unit/logger_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Ably::Logger do
|
3
|
+
describe Ably::Logger, :prevent_log_stubbing do
|
4
4
|
let(:rest_client) do
|
5
5
|
instance_double('Ably::Rest::Client')
|
6
6
|
end
|
@@ -18,14 +18,10 @@ describe Ably::Logger do
|
|
18
18
|
|
19
19
|
context 'internals', :api_private do
|
20
20
|
it 'delegates to the default Logger object' do
|
21
|
-
received = false
|
22
21
|
expect(subject.logger).to be_a(::Logger)
|
23
|
-
|
24
|
-
|
25
|
-
received = true
|
26
|
-
end
|
22
|
+
expect(subject.logger).to receive(:warn).with('message')
|
23
|
+
|
27
24
|
subject.warn 'message'
|
28
|
-
expect(received).to be_truthy
|
29
25
|
end
|
30
26
|
|
31
27
|
context 'formatter' do
|
@@ -136,18 +132,14 @@ describe Ably::Logger do
|
|
136
132
|
end
|
137
133
|
|
138
134
|
it 'delegates log messages to logger', :api_private do
|
139
|
-
|
140
|
-
|
141
|
-
expect(args.concat([block ? block.call : nil]).join(',')).to match(/message/)
|
142
|
-
received = true
|
143
|
-
end
|
135
|
+
expect(custom_logger_object).to receive(:fatal).with('message')
|
136
|
+
|
144
137
|
subject.fatal 'message'
|
145
|
-
expect(received).to be_truthy
|
146
138
|
end
|
147
139
|
end
|
148
140
|
end
|
149
141
|
|
150
|
-
context 'with blocks'
|
142
|
+
context 'with blocks' do
|
151
143
|
it 'does not call the block unless the log level is met' do
|
152
144
|
log_level_blocks = []
|
153
145
|
subject.warn { log_level_blocks << :warn }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ably
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lewis Marshall
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -45,28 +45,42 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '9.0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '9.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: faraday
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '2.2'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '2.2'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: faraday-typhoeus
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.2.0
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.2.0
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: typhoeus
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,14 +185,14 @@ dependencies:
|
|
171
185
|
requirements:
|
172
186
|
- - "~>"
|
173
187
|
- !ruby/object:Gem::Version
|
174
|
-
version: 3.
|
188
|
+
version: 3.11.0
|
175
189
|
type: :development
|
176
190
|
prerelease: false
|
177
191
|
version_requirements: !ruby/object:Gem::Requirement
|
178
192
|
requirements:
|
179
193
|
- - "~>"
|
180
194
|
- !ruby/object:Gem::Version
|
181
|
-
version: 3.
|
195
|
+
version: 3.11.0
|
182
196
|
- !ruby/object:Gem::Dependency
|
183
197
|
name: rspec-retry
|
184
198
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,14 +297,14 @@ dependencies:
|
|
283
297
|
requirements:
|
284
298
|
- - "~>"
|
285
299
|
- !ruby/object:Gem::Version
|
286
|
-
version: '3.
|
300
|
+
version: '3.8'
|
287
301
|
type: :development
|
288
302
|
prerelease: false
|
289
303
|
version_requirements: !ruby/object:Gem::Requirement
|
290
304
|
requirements:
|
291
305
|
- - "~>"
|
292
306
|
- !ruby/object:Gem::Version
|
293
|
-
version: '3.
|
307
|
+
version: '3.8'
|
294
308
|
- !ruby/object:Gem::Dependency
|
295
309
|
name: pry
|
296
310
|
requirement: !ruby/object:Gem::Requirement
|
@@ -565,7 +579,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
565
579
|
- !ruby/object:Gem::Version
|
566
580
|
version: '0'
|
567
581
|
requirements: []
|
568
|
-
rubygems_version: 3.3.
|
582
|
+
rubygems_version: 3.3.14
|
569
583
|
signing_key:
|
570
584
|
specification_version: 4
|
571
585
|
summary: A Ruby client library for ably.io realtime messaging implemented using EventMachine
|