Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
version: "6.2.0"
version: "6.2.1"
changelog:
- date: 2026-11-23
version: v6.2.1
changes:
- type: bug
text: "Preserve block callbacks in async history methods."
- date: 2026-10-21
version: v6.2.0
changes:
Expand Down Expand Up @@ -661,7 +666,7 @@ sdks:
- x86-64
- distribution-type: package
distribution-repository: RubyGems
package-name: pubnub-6.2.0.gem
package-name: pubnub-6.2.1.gem
location: https://rubygems.org/gems/pubnub
requires:
- name: addressable
Expand Down Expand Up @@ -766,8 +771,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub-6.2.0.gem
location: https://github.com/pubnub/ruby/releases/download/v6.2.0/pubnub-6.2.0.gem
package-name: pubnub-6.2.1.gem
location: https://github.com/pubnub/ruby/releases/download/v6.2.1/pubnub-6.2.1.gem
requires:
- name: addressable
min-version: 2.0.0
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v6.2.1
November 23 2026

#### Fixed
- Preserve block callbacks in async history methods. Fixed the following issues reported by [@pcbeingused333](https://github.com/pcbeingused333): [#182](https://github.com/pubnub/ruby/issues/182).

## v6.2.0
October 21 2026

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pubnub (6.2.0)
pubnub (6.2.1)
addressable (>= 2.0.0)
base64
concurrent-ruby (~> 1.3.4)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.0
6.2.1
4 changes: 2 additions & 2 deletions lib/pubnub/client/paged_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def all_history_messages(options = {}, &block)
if options[:http_sync]
sync_all_history_messages(channel, include_token, page_size, reverse, maximum, callback, start: start_tt, end: end_tt)
else
async_all_history_messages(options)
async_all_history_messages(options.merge(callback: callback))
end
end

Expand All @@ -42,7 +42,7 @@ def paged_history(options = {}, &block)
if options[:http_sync]
sync_paged_history(channel, page, limit, include_token, callback, start: start_tt, end: end_tt)
else
async_paged_history(options)
async_paged_history(options.merge(callback: callback))
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pubnub/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Toplevel Pubnub module.
module Pubnub
VERSION = '6.2.0'.freeze
VERSION = '6.2.1'.freeze
end
49 changes: 49 additions & 0 deletions spec/lib/paged_history_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

require 'concurrent'
require_relative '../../lib/pubnub/client/paged_history'

RSpec.describe Pubnub::Client::PagedHistory do
let(:client) { Class.new { include Pubnub::Client::PagedHistory }.new }
let(:envelope) do
double(status: { category: :ack },
result: { data: { messages: ['message'], start: '1', end: '2' } })
end

before do
allow(client).to receive(:history).and_return(envelope)
allow(client).to receive(:envelope_with_messages).and_return(envelope)
end

[:paged_history, :all_history_messages].each do |method|
[true, false].each do |sync|
it "delivers #{method} results to a block with http_sync=#{sync}" do
received = []
options = { channel: 'demo', http_sync: sync }.freeze
result = client.public_send(method, options) { |value| received << value }
result.value! if result.is_a?(Concurrent::Future)

expect(received).to eq([envelope])
end
end

it "prefers the explicit #{method} callback over a block asynchronously" do
received = []
callback = ->(value) { received << value }
result = client.public_send(method, channel: 'demo', callback: callback) do
raise 'The explicit callback should take precedence'
end
result.value!

expect(received).to eq([envelope])
end

it "respects an explicit nil #{method} callback asynchronously" do
result = client.public_send(method, channel: 'demo', callback: nil) do
raise 'An explicit nil callback should suppress the block'
end

expect { result.value! }.not_to raise_error
end
end
end
Loading