lib/submodules/ably-ruby/lib/ably/rest/channel.rb in ably-rest-0.8.6 vs lib/submodules/ably-ruby/lib/ably/rest/channel.rb in ably-rest-0.8.9

- old
+ new

@@ -17,12 +17,11 @@ # Initialize a new Channel object # # @param client [Ably::Rest::Client] # @param name [String] The name of the channel # @param channel_options [Hash] Channel options, currently reserved for Encryption options - # @option channel_options [Boolean] :encrypted setting this to true for this channel will encrypt & decrypt all messages automatically - # @option channel_options [Hash] :cipher_params A hash of options to configure the encryption. *:key* is required, all other options are optional. See {Ably::Util::Crypto#initialize} for a list of +cipher_params+ options + # @option channel_options [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. See {Ably::Util::Crypto#initialize} for a list of +:cipher+ options # def initialize(client, name, channel_options = {}) ensure_utf_8 :name, name update_options channel_options @@ -63,19 +62,19 @@ ensure_supported_payload data [{ name: name, data: data }.merge(attributes)] end payload = messages.map do |message| - Ably::Models::Message(message.dup).tap do |message| - message.encode self + Ably::Models::Message(message.dup).tap do |msg| + msg.encode self - next if message.client_id.nil? - if message.client_id == '*' + next if msg.client_id.nil? + if msg.client_id == '*' raise Ably::Exceptions::IncompatibleClientId.new('Wildcard client_id is reserved and cannot be used when publishing messages', 400, 40012) end - unless client.auth.can_assume_client_id?(message.client_id) - raise Ably::Exceptions::IncompatibleClientId.new("Cannot publish with client_id '#{message.client_id}' as it is incompatible with the current configured client_id '#{client.client_id}'", 400, 40012) + unless client.auth.can_assume_client_id?(msg.client_id) + raise Ably::Exceptions::IncompatibleClientId.new("Cannot publish with client_id '#{msg.client_id}' as it is incompatible with the current configured client_id '#{client.client_id}'", 400, 40012) end end.as_json end response = client.post("#{base_path}/publish", payload.length == 1 ? payload.first : payload) @@ -109,11 +108,11 @@ } response = client.get(url, options) Ably::Models::PaginatedResult.new(response, url, client, paginated_options) do |message| - message.tap do |message| - decode_message message + message.tap do |msg| + decode_message msg end end end # Return the {Ably::Rest::Presence} object