lib/submodules/ably-ruby/lib/ably/rest/channel.rb in ably-rest-0.8.1 vs lib/submodules/ably-ruby/lib/ably/rest/channel.rb in ably-rest-0.8.2
- old
+ new
@@ -35,10 +35,11 @@
# @param name [String] The event name of the message to publish
# @param data [String] The message payload
# @return [Boolean] true if the message was published, otherwise false
def publish(name, data)
ensure_utf_8 :name, name
+ ensure_supported_payload data
payload = {
name: name,
data: data
}
@@ -58,11 +59,11 @@
# @option options [Integer,Time] :start Ensure earliest time or millisecond since epoch for any messages retrieved is +:start+
# @option options [Integer,Time] :end Ensure latest time or millisecond since epoch for any messages retrieved is +:end+
# @option options [Symbol] :direction +:forwards+ or +:backwards+, defaults to +:backwards+
# @option options [Integer] :limit Maximum number of messages to retrieve up to 1,000, defaults to 100
#
- # @return [Ably::Models::PaginatedResource<Ably::Models::Message>] First {Ably::Models::PaginatedResource page} of {Ably::Models::Message} objects accessible with {Ably::Models::PaginatedResource#items #items}.
+ # @return [Ably::Models::PaginatedResult<Ably::Models::Message>] First {Ably::Models::PaginatedResult page} of {Ably::Models::Message} objects accessible with {Ably::Models::PaginatedResult#items #items}.
#
def history(options = {})
url = "#{base_path}/messages"
options = {
:direction => :backwards,
@@ -76,10 +77,10 @@
async_blocking_operations: options.delete(:async_blocking_operations),
}
response = client.get(url, options)
- Ably::Models::PaginatedResource.new(response, url, client, paginated_options) do |message|
+ Ably::Models::PaginatedResult.new(response, url, client, paginated_options) do |message|
message.tap do |message|
decode_message message
end
end
end