ably-rest 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/submodules/ably-ruby/.github/workflows/check.yml +1 -1
  3. data/lib/submodules/ably-ruby/CHANGELOG.md +21 -27
  4. data/lib/submodules/ably-ruby/README.md +1 -1
  5. data/lib/submodules/ably-ruby/ably.gemspec +11 -24
  6. data/lib/submodules/ably-ruby/lib/ably/auth.rb +5 -5
  7. data/lib/submodules/ably-ruby/lib/ably/logger.rb +4 -4
  8. data/lib/submodules/ably-ruby/lib/ably/models/device_details.rb +1 -1
  9. data/lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb +2 -2
  10. data/lib/submodules/ably-ruby/lib/ably/models/token_request.rb +1 -1
  11. data/lib/submodules/ably-ruby/lib/ably/modules/ably.rb +1 -1
  12. data/lib/submodules/ably-ruby/lib/ably/realtime/auth.rb +2 -2
  13. data/lib/submodules/ably-ruby/lib/ably/rest/client.rb +4 -4
  14. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/encoder.rb +1 -1
  15. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/exceptions.rb +1 -1
  16. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/external_exceptions.rb +1 -1
  17. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb +1 -1
  18. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/logger.rb +1 -1
  19. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/parse_json.rb +1 -1
  20. data/lib/submodules/ably-ruby/lib/ably/rest/middleware/parse_message_pack.rb +1 -1
  21. data/lib/submodules/ably-ruby/lib/ably/version.rb +1 -1
  22. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_spec.rb +20 -0
  23. data/lib/submodules/ably-ruby/spec/acceptance/rest/client_spec.rb +1 -1
  24. data/lib/submodules/ably-ruby/spec/run_parallel_tests +2 -7
  25. data/lib/submodules/ably-ruby/spec/unit/logger_spec.rb +6 -14
  26. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b16a660541b84dea7de4cc797b26170e1b0eaffa5f6cffc114901fc2e47ecce
4
- data.tar.gz: f8dfa10a5d6409260965cd41e6a6940241d15628f4aa7bf20c0b87fc4d652961
3
+ metadata.gz: 181bc1ea329e633dc8c1f535c22daa181ff85ba881003904e3f2c577eba2949f
4
+ data.tar.gz: 3def2802abfda59fed8c56e3e37474ba998876ad26d2d6a328d2cd901283b410
5
5
  SHA512:
6
- metadata.gz: a0954368827dd9d2703c8e3ff3a12ab20c543a4e4fa7b294a098846bcd25a3206f51ecdb48ad5b827a49ee69a705b848484a9bd4db8393f92308a4e50b4e0474
7
- data.tar.gz: e53e2b67a67a915a77b3bdb4dbafd48899957c68aca6f902cd2cb2e14a3f494940cb17a69bba6e587aebfd926299ade94dcf39eed9919c570b4e255c49531afe
6
+ metadata.gz: 51548295cfa55408a15fd87e2b0cc7b769e7eef473a344dde8637f5780ea8d6071a12a555ac5fc8a459beecc0fc5240e3319bd3b487e6df3ee076901d7943cef
7
+ data.tar.gz: 19191a7380d405248e4da807d152769c3f3bcd6e4e6a2f7c9ef4d2843631295e00e917938b47c4a0e35bb8b190807695ea6d04cc0fb051ada87430312daa2799
@@ -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', '3.0' ]
13
+ ruby: [ '2.7', '3.0', '3.1' ]
14
14
  protocol: [ 'json', 'msgpack' ]
15
15
  steps:
16
16
  - uses: actions/checkout@v2
@@ -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
- - 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)
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
 
@@ -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 1.9.3+. For eventmachine and Ruby 3.0 note please visit [Ruby 3.0 support](#ruby-30-support) section.
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
 
@@ -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', '~> 8.0'
24
- spec.add_runtime_dependency 'faraday', '~> 1.0'
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.10.0'
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
- if RUBY_VERSION.match(/^1\./)
45
- spec.add_development_dependency 'public_suffix', '~> 1.4.6' # Later versions do not support Ruby 1.9
46
- spec.add_development_dependency 'webmock', '2.2'
47
- spec.add_development_dependency 'parallel_tests', '~> 2.9.0'
48
- else
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'
@@ -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.io Ably} using basic or token authentication
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.io/documentation/general/authentication/
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.io/documentation/realtime/types#auth-options
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.io/documentation/other/authentication}
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.io Ably} system for the current time instead of using the local time
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]
@@ -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.9.3/libdoc/logger/rdoc/Logger.html Ruby Logger} log level
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.9.3/libdoc/logger/rdoc/Logger.html Ruby Logger} compatible interface.
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.9.3/libdoc/logger/rdoc/Logger.html Ruby Logger}
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.9.3/libdoc/logger/rdoc/Logger.html
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.io/documentation/general/authentication#identified-clients auth documentation}.
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://docs.ably.io/client-lib-development-guide/protocol/ Ably client library developer documentation}
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://docs.ably.io/client-lib-development-guide/protocol/#message-acknowledgement message acknowledgement protocol}
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.io/documentation Ably Authentication documentation} for more details.
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
@@ -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://docs.ably.io/client-lib-development-guide/features/#RSC15a
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
@@ -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.io Ably} using basic or token authentication
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.io/documentation/general/authentication/
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)
@@ -4,7 +4,7 @@ require 'logger'
4
4
  require 'uri'
5
5
 
6
6
  require 'typhoeus'
7
- require 'typhoeus/adapters/faraday'
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.9.3`
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.9.3/libdoc/logger/rdoc/Logger.html
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.io Ably} system for the current time instead of using the local time
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 < ::Faraday::Response::Middleware
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::Response::Middleware
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::Response::Middleware
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::Response::Middleware
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
@@ -3,7 +3,7 @@ require 'faraday'
3
3
  module Ably
4
4
  module Rest
5
5
  module Middleware
6
- class Logger < Faraday::Response::Middleware
6
+ class Logger < Faraday::Middleware
7
7
  extend Forwardable
8
8
 
9
9
  def initialize(app, logger = nil)
@@ -4,7 +4,7 @@ require 'json'
4
4
  module Ably
5
5
  module Rest
6
6
  module Middleware
7
- class ParseJson < Faraday::Response::Middleware
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::Response::Middleware
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
@@ -1,5 +1,5 @@
1
1
  module Ably
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  PROTOCOL_VERSION = '1.2'
4
4
 
5
5
  # @api private
@@ -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.9.3'].each do |agent|
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
 
@@ -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
- if ruby -v | grep -e "1.9"; then
15
- # Output with test ID is not supported with this old version of RSpec
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
@@ -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
- allow_any_instance_of(::Logger).to receive(:warn) do |*args, &block|
24
- expect(args.concat([block ? block.call : nil]).join(',')).to match(/message/)
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
- received = false
140
- allow(custom_logger_object).to receive(:fatal) do |*args, &block|
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', :prevent_log_stubbing do
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ably-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew O'Riordan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-05 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -502,7 +502,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
502
502
  - !ruby/object:Gem::Version
503
503
  version: '0'
504
504
  requirements: []
505
- rubygems_version: 3.3.7
505
+ rubygems_version: 3.3.14
506
506
  signing_key:
507
507
  specification_version: 4
508
508
  summary: A Ruby REST only client library for ably.io realtime messaging