ably 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/check.yml +15 -1
  3. data/CHANGELOG.md +26 -0
  4. data/README.md +14 -2
  5. data/ably.gemspec +11 -6
  6. data/lib/ably.rb +1 -0
  7. data/lib/ably/agent.rb +3 -0
  8. data/lib/ably/exceptions.rb +6 -0
  9. data/lib/ably/models/connection_details.rb +2 -0
  10. data/lib/ably/models/message.rb +14 -0
  11. data/lib/ably/models/presence_message.rb +14 -0
  12. data/lib/ably/models/protocol_message.rb +8 -0
  13. data/lib/ably/realtime/channel/channel_manager.rb +2 -2
  14. data/lib/ably/realtime/channel/publisher.rb +5 -0
  15. data/lib/ably/realtime/client/incoming_message_dispatcher.rb +14 -6
  16. data/lib/ably/realtime/connection.rb +5 -2
  17. data/lib/ably/rest/channel.rb +8 -1
  18. data/lib/ably/rest/client.rb +11 -11
  19. data/lib/ably/version.rb +1 -13
  20. data/spec/acceptance/realtime/auth_spec.rb +1 -1
  21. data/spec/acceptance/realtime/channel_history_spec.rb +25 -0
  22. data/spec/acceptance/realtime/channel_spec.rb +14 -0
  23. data/spec/acceptance/realtime/connection_failures_spec.rb +3 -1
  24. data/spec/acceptance/realtime/connection_spec.rb +6 -27
  25. data/spec/acceptance/realtime/presence_history_spec.rb +3 -1
  26. data/spec/acceptance/realtime/presence_spec.rb +13 -158
  27. data/spec/acceptance/rest/channel_spec.rb +13 -0
  28. data/spec/acceptance/rest/client_spec.rb +23 -19
  29. data/spec/shared/model_behaviour.rb +1 -1
  30. data/spec/spec_helper.rb +11 -2
  31. data/spec/unit/models/message_spec.rb +59 -0
  32. data/spec/unit/models/presence_message_spec.rb +49 -0
  33. data/spec/unit/models/protocol_message_spec.rb +48 -0
  34. data/spec/unit/realtime/channel_spec.rb +1 -1
  35. data/spec/unit/realtime/incoming_message_dispatcher_spec.rb +38 -0
  36. data/spec/unit/rest/channel_spec.rb +10 -0
  37. data/spec/unit/rest/client_spec.rb +20 -0
  38. metadata +36 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa84b23cf7efa53651ed44ee5ba5fd19fa1e18b63025b5217cb88d069c095b5a
4
- data.tar.gz: 357ce5eb6984d9a0cbc16a96fd267d45de4325d9b885538a9e09550bead51082
3
+ metadata.gz: 99da4e4f2a2934965e19a4541968e651405886d6a0814786e701fc182d6e10ef
4
+ data.tar.gz: f026b079b0b8969df7efe18e99413bc7d79035c2a055c46d2166d12da1d8a8ef
5
5
  SHA512:
6
- metadata.gz: f17679d2f885d6cf61d99996a3ebdc7bcf0b03e6edf8b0ca35c26806199f897e39ce033c1454f0082f643824e703a508d465be217a413e88650b7a04bd3faddb
7
- data.tar.gz: 3fd85374765d146902fb6f64968fc2f6b9560e40bf168b2d3acf336b6dd94b0f9e98ccf0edcb1b04fb3e38eceb16f41601828c6a4da5a8efe64734e89b1243be
6
+ metadata.gz: 98ac241fc8720f4da77cabe14b8cd2c6b705c8ccac33cd2f81f9c937cb75ddba173e1f129670c0392f9f2a63e0809dba995d71700832d16efbc6aa24f5ae6ad3
7
+ data.tar.gz: 74b4bc0c6aef5ed2ffccf41a432d8d4588a694ef0cad301e8163f8a4607536a382306d22fe0a349c95dbaad7080690220f788de8bb96033588b275e099663eaa
@@ -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,31 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.1.7](https://github.com/ably/ably-ruby/tree/v1.1.7)
4
+
5
+ [Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.6...v1.1.7)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Implement RSC7d \(Ably-Agent header\) [\#230](https://github.com/ably/ably-ruby/issues/230)
10
+ - Support Ruby 3.x [\#220](https://github.com/ably/ably-ruby/issues/220)
11
+
12
+ **Closed issues:**
13
+
14
+ - Create code snippets for homepage \(ruby\) [\#249](https://github.com/ably/ably-ruby/issues/249)
15
+ - Update client options support to 1.1 spec level \(maxMessageSize\) [\#247](https://github.com/ably/ably-ruby/issues/247)
16
+ - Update client options support to 1.1 spec level \(maxFrameSize\) [\#245](https://github.com/ably/ably-ruby/issues/245)
17
+
18
+ **Merged pull requests:**
19
+
20
+ - Enabled TLS hostname validation CVE-2020-13482 [\#263](https://github.com/ably/ably-ruby/pull/263) ([lukaszsliwa](https://github.com/lukaszsliwa))
21
+ - Ruby 3.0 support [\#260](https://github.com/ably/ably-ruby/pull/260) ([lukaszsliwa](https://github.com/lukaszsliwa))
22
+ - TO3l9 Max frame size [\#259](https://github.com/ably/ably-ruby/pull/259) ([lukaszsliwa](https://github.com/lukaszsliwa))
23
+ - Update client options support to 1.1 spec level \(maxMessageSize\) [\#252](https://github.com/ably/ably-ruby/pull/252) ([lukaszsliwa](https://github.com/lukaszsliwa))
24
+ - Update ably-common to latest main [\#251](https://github.com/ably/ably-ruby/pull/251) ([owenpearson](https://github.com/owenpearson))
25
+ - Implement RSC7d \(Ably-Agent header\) [\#248](https://github.com/ably/ably-ruby/pull/248) ([lukaszsliwa](https://github.com/lukaszsliwa))
26
+ - Upgrade statesman to ~\> 8.0 [\#237](https://github.com/ably/ably-ruby/pull/237) ([darkhelmet](https://github.com/darkhelmet))
27
+ - Update attach\_serial before emiting UPDATE event [\#228](https://github.com/ably/ably-ruby/pull/228) ([TheSmartnik](https://github.com/TheSmartnik))
28
+
3
29
  ## [v1.1.6](https://github.com/ably/ably-ruby/tree/v1.1.6)
4
30
 
5
31
  [Full Changelog](https://github.com/ably/ably-ruby/compare/v1.1.5...v1.1.6)
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
- A Ruby client library for [ably.com](https://ably.com), the realtime messaging service. This library currently targets the [Ably 1.1 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).
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.1 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/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', '~> 7.4'
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,7 +33,7 @@ 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', '~> 11.3'
36
+ spec.add_development_dependency 'rake', '~> 13.0'
37
37
  spec.add_development_dependency 'redcarpet', '~> 3.3'
38
38
  spec.add_development_dependency 'rspec', '~> 3.3.0' # version lock, see config.around(:example, :event_machine) in event_machine_helper.rb
39
39
  spec.add_development_dependency 'rspec-retry', '~> 0.6'
@@ -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 'coveralls'
51
- spec.add_development_dependency 'parallel_tests', '~> 2.22'
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.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'addressable/uri'
2
2
 
3
3
  require 'ably/version'
4
+ require 'ably/agent'
4
5
 
5
6
  %w(modules util).each do |namespace|
6
7
  Dir.glob(File.expand_path("ably/#{namespace}/*.rb", File.dirname(__FILE__))).sort.each do |file|
data/lib/ably/agent.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Ably
2
+ AGENT = "ably-ruby/#{Ably::VERSION} ruby/#{RUBY_VERSION}"
3
+ end
@@ -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
 
@@ -38,6 +38,8 @@ module Ably::Models
38
38
  self.attributes[duration_field] = (self.attributes[duration_field].to_f / 1000).round
39
39
  end
40
40
  end
41
+ self.attributes[:max_message_size] ||= 65536
42
+ self.attributes[:max_frame_size] ||= 524288
41
43
  self.attributes.freeze
42
44
  end
43
45
 
@@ -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)
@@ -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)
@@ -185,6 +185,14 @@ module Ably::Models
185
185
  end
186
186
  end
187
187
 
188
+ def message_size
189
+ presence.map(&:size).sum + messages.map(&:size).sum
190
+ end
191
+
192
+ def has_correct_message_size?
193
+ message_size <= connection_details.max_message_size
194
+ end
195
+
188
196
  def flags
189
197
  Integer(attributes[:flags])
190
198
  rescue TypeError
@@ -63,6 +63,8 @@ module Ably::Realtime
63
63
  log_channel_error protocol_message.error
64
64
  end
65
65
 
66
+ channel.properties.set_attach_serial(protocol_message.channel_serial)
67
+
66
68
  if protocol_message.has_channel_resumed_flag?
67
69
  logger.debug { "ChannelManager: Additional resumed ATTACHED message received for #{channel.state} channel '#{channel.name}'" }
68
70
  else
@@ -75,8 +77,6 @@ module Ably::Realtime
75
77
  )
76
78
  update_presence_sync_state_following_attached protocol_message
77
79
  end
78
-
79
- channel.properties.set_attach_serial(protocol_message.channel_serial)
80
80
  end
81
81
 
82
82
  # Handle DETACED messages, see #RTL13 for server-initated detaches
@@ -22,6 +22,11 @@ module Ably::Realtime
22
22
  end
23
23
  end
24
24
 
25
+ if messages.sum(&:size) > Ably::Realtime::Connection::MAX_MESSAGE_SIZE
26
+ error = Ably::Exceptions::MaxMessageSizeExceeded.new("Message size exceeded #{Ably::Realtime::Connection::MAX_MESSAGE_SIZE} bytes.")
27
+ return Ably::Util::SafeDeferrable.new_and_fail_immediately(logger, error)
28
+ end
29
+
25
30
  connection.send_protocol_message(
26
31
  action: Ably::Models::ProtocolMessage::ACTION.Message.to_i,
27
32
  channel: channel_name,
@@ -121,15 +121,23 @@ module Ably::Realtime
121
121
  presence.manager.sync_process_messages protocol_message.channel_serial, protocol_message.presence
122
122
 
123
123
  when ACTION.Presence
124
- presence = get_channel(protocol_message.channel).presence
125
- protocol_message.presence.each do |presence_message|
126
- presence.__incoming_msgbus__.publish :presence, presence_message
124
+ if protocol_message.has_correct_message_size?
125
+ presence = get_channel(protocol_message.channel).presence
126
+ protocol_message.presence.each do |presence_message|
127
+ presence.__incoming_msgbus__.publish :presence, presence_message
128
+ end
129
+ else
130
+ logger.fatal Ably::Exceptions::ProtocolError.new("Not published. Channel message limit exceeded #{protocol_message.message_size} bytes", 400, Ably::Exceptions::Codes::UNABLE_TO_RECOVER_CHANNEL_MESSAGE_LIMIT_EXCEEDED).message
127
131
  end
128
132
 
129
133
  when ACTION.Message
130
- channel = get_channel(protocol_message.channel)
131
- protocol_message.messages.each do |message|
132
- channel.__incoming_msgbus__.publish :message, message
134
+ if protocol_message.has_correct_message_size?
135
+ channel = get_channel(protocol_message.channel)
136
+ protocol_message.messages.each do |message|
137
+ channel.__incoming_msgbus__.publish :message, message
138
+ end
139
+ else
140
+ logger.fatal Ably::Exceptions::ProtocolError.new("Not published. Channel message limit exceeded #{protocol_message.message_size} bytes", 400, Ably::Exceptions::Codes::UNABLE_TO_RECOVER_CHANNEL_MESSAGE_LIMIT_EXCEEDED).message
133
141
  end
134
142
 
135
143
  when ACTION.Auth
@@ -82,6 +82,9 @@ module Ably
82
82
  # Max number of messages to bundle in a single ProtocolMessage
83
83
  MAX_PROTOCOL_MESSAGE_BATCH_SIZE = 50
84
84
 
85
+ # Max message size
86
+ MAX_MESSAGE_SIZE = 65536 # See spec TO3l8
87
+
85
88
  # A unique public identifier for this connection, used to identify this member in presence events and messages
86
89
  # @return [String]
87
90
  attr_reader :id
@@ -292,7 +295,7 @@ module Ably
292
295
  def internet_up?
293
296
  url = "http#{'s' if client.use_tls?}:#{Ably::INTERNET_CHECK.fetch(:url)}"
294
297
  EventMachine::DefaultDeferrable.new.tap do |deferrable|
295
- EventMachine::HttpRequest.new(url).get.tap do |http|
298
+ EventMachine::HttpRequest.new(url, tls: { verify_peer: true }).get.tap do |http|
296
299
  http.errback do
297
300
  yield false if block_given?
298
301
  deferrable.fail Ably::Exceptions::ConnectionFailed.new("Unable to connect to #{url}", nil, Ably::Exceptions::Codes::CONNECTION_FAILED)
@@ -434,7 +437,7 @@ module Ably
434
437
  'format' => client.protocol,
435
438
  'echo' => client.echo_messages,
436
439
  'v' => Ably::PROTOCOL_VERSION,
437
- 'lib' => client.rest_client.lib_version_id,
440
+ 'agent' => client.rest_client.agent
438
441
  )
439
442
 
440
443
  # Use native websocket heartbeats if possible, but allow Ably protocol heartbeats
@@ -23,6 +23,7 @@ module Ably
23
23
  attr_reader :push
24
24
 
25
25
  IDEMPOTENT_LIBRARY_GENERATED_ID_LENGTH = 9 # See spec RSL1k1
26
+ MAX_MESSAGE_SIZE = 65536 # See spec TO3l8
26
27
 
27
28
  # Initialize a new Channel object
28
29
  #
@@ -85,7 +86,13 @@ module Ably
85
86
  [[{ name: first, data: second }.merge(third)], nil]
86
87
  end
87
88
 
88
- payload = messages.each_with_index.map do |message, index|
89
+ messages.map! { |message| Ably::Models::Message(message.dup) }
90
+
91
+ if messages.sum(&:size) > Ably::Rest::Channel::MAX_MESSAGE_SIZE
92
+ raise Ably::Exceptions::MaxMessageSizeExceeded.new("Maximum message size exceeded #{Ably::Rest::Channel::MAX_MESSAGE_SIZE}.")
93
+ end
94
+
95
+ payload = messages.map do |message|
89
96
  Ably::Models::Message(message.dup).tap do |msg|
90
97
  msg.encode client.encoders, options
91
98
 
@@ -25,6 +25,8 @@ module Ably
25
25
  # Default Ably domain for REST
26
26
  DOMAIN = 'rest.ably.io'
27
27
 
28
+ MAX_FRAME_SIZE = 524288
29
+
28
30
  # Configuration for HTTP timeouts and HTTP request reattempts to fallback hosts
29
31
  HTTP_DEFAULTS = {
30
32
  open_timeout: 4,
@@ -52,6 +54,10 @@ module Ably
52
54
  # @return [Symbol]
53
55
  attr_reader :protocol
54
56
 
57
+ # Client agent i.e. `example-gem/1.2.0 ably-ruby/1.1.5 ruby/1.9.3`
58
+ # @return [String]
59
+ attr_reader :agent
60
+
55
61
  # {Ably::Auth} authentication object configured for this connection
56
62
  # @return [Ably::Auth]
57
63
  attr_reader :auth
@@ -168,6 +174,7 @@ module Ably
168
174
  end
169
175
  end
170
176
 
177
+ @agent = options.delete(:agent) || Ably::AGENT
171
178
  @realtime_client = options.delete(:realtime_client)
172
179
  @tls = options.delete(:tls) == false ? false : true
173
180
  @environment = options.delete(:environment) # nil is production
@@ -358,6 +365,9 @@ module Ably
358
365
  send_request(method, path, params, headers: headers)
359
366
  end
360
367
  when :post, :patch, :put
368
+ if body.to_json.bytesize > MAX_FRAME_SIZE
369
+ raise Ably::Exceptions::MaxFrameSizeExceeded.new("Maximum frame size exceeded #{MAX_FRAME_SIZE} bytes.")
370
+ end
361
371
  path_with_params = Addressable::URI.new
362
372
  path_with_params.query_values = params || {}
363
373
  query = path_with_params.query
@@ -473,16 +483,6 @@ module Ably
473
483
  end
474
484
  end
475
485
 
476
- # Library Ably version user agent
477
- # @api private
478
- def lib_version_id
479
- @lib_version_id ||= [
480
- 'ruby',
481
- Ably.lib_variant,
482
- Ably::VERSION
483
- ].compact.join('-')
484
- end
485
-
486
486
  # Allowable duration for an external auth request
487
487
  # For REST client this defaults to request_timeout
488
488
  # For Realtime clients this defaults to 250ms less than the realtime_request_timeout
@@ -663,7 +663,7 @@ module Ably
663
663
  accept: mime_type,
664
664
  user_agent: user_agent,
665
665
  'X-Ably-Version' => Ably::PROTOCOL_VERSION,
666
- 'X-Ably-Lib' => lib_version_id
666
+ 'Ably-Agent' => agent
667
667
  },
668
668
  request: {
669
669
  open_timeout: http_defaults.fetch(:open_timeout),
data/lib/ably/version.rb CHANGED
@@ -1,19 +1,7 @@
1
1
  module Ably
2
- VERSION = '1.1.6'
2
+ VERSION = '1.1.7'
3
3
  PROTOCOL_VERSION = '1.1'
4
4
 
5
- # Allow a variant to be configured for all instances of this client library
6
- # such as ruby-rest-[VERSION]
7
-
8
- # @api private
9
- def self.lib_variant=(variant)
10
- @lib_variant = variant
11
- end
12
-
13
- def self.lib_variant
14
- @lib_variant
15
- end
16
-
17
5
  # @api private
18
6
  def self.major_minor_version_numeric
19
7
  VERSION.gsub(/\.\d+$/, '').to_f
@@ -1237,7 +1237,7 @@ describe Ably::Realtime::Auth, :event_machine do
1237
1237
  let(:basic_capability) { JSON.dump(channel_name => ['subscribe'], channel_with_publish_permissions => ['publish']) }
1238
1238
  let(:auth_callback) do
1239
1239
  lambda do |token_params|
1240
- Faraday.get("#{auth_url}?keyName=#{key_name}&keySecret=#{key_secret}&capability=#{URI.escape(basic_capability)}").body
1240
+ Faraday.get("#{auth_url}?keyName=#{key_name}&keySecret=#{key_secret}&capability=#{URI::Parser.new.escape(basic_capability)}").body
1241
1241
  end
1242
1242
  end
1243
1243
  let(:client_options) { default_options.merge(auth_callback: auth_callback, log_level: :error) }