lib/ably/rest/client.rb in ably-1.2.4 vs lib/ably/rest/client.rb in ably-1.2.6
- old
+ new
@@ -14,10 +14,11 @@
#
class Client
include Ably::Modules::Conversions
include Ably::Modules::HttpHelpers
extend Forwardable
+ using Ably::Util::AblyExtensions
# Default Ably domain for REST
DOMAIN = 'rest.ably.io'
MAX_MESSAGE_SIZE = 65536 # See spec TO3l8
@@ -184,11 +185,11 @@
end
end
@agent = options.delete(:agent) || Ably::AGENT
@realtime_client = options.delete(:realtime_client)
- @tls = options.delete(:tls) == false ? false : true
+ @tls = options.delete_with_default(:tls, true)
@environment = options.delete(:environment) # nil is production
@environment = nil if [:production, 'production'].include?(@environment)
@protocol = options.delete(:protocol) || :msgpack
@debug_http = options.delete(:debug_http)
@log_level = options.delete(:log_level) || ::Logger::WARN
@@ -198,15 +199,12 @@
@custom_tls_port = options.delete(:tls_port)
@add_request_ids = options.delete(:add_request_ids)
@log_retries_as_info = options.delete(:log_retries_as_info)
@max_message_size = options.delete(:max_message_size) || MAX_MESSAGE_SIZE
@max_frame_size = options.delete(:max_frame_size) || MAX_FRAME_SIZE
+ @idempotent_rest_publishing = options.delete_with_default(:idempotent_rest_publishing, true)
- if (@idempotent_rest_publishing = options.delete(:idempotent_rest_publishing)).nil?
- @idempotent_rest_publishing = Ably::PROTOCOL_VERSION.to_f > 1.1
- end
-
if options[:fallback_hosts_use_default] && options[:fallback_hosts]
raise ArgumentError, "fallback_hosts_use_default cannot be set to try when fallback_hosts is also provided"
end
@fallback_hosts = case
when options.delete(:fallback_hosts_use_default)
@@ -597,10 +595,10 @@
if options[:qs_params]
request.params.merge!(options[:qs_params])
end
unless options[:send_auth_header] == false
request.headers[:authorization] = auth.auth_header
-
+ # RSA7e2
options[:headers].to_h.merge(auth.extra_auth_headers).map do |key, val|
request.headers[key] = val
end
end
end.tap do