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: "5.5.1"
version: "5.6.0"
changelog:
- date: 2025-09-11
version: v5.6.0
changes:
- type: feature
text: "Add the `encode_channels` parameter for `fetch` to enable or disable channel names percent-encoding in response."
- date: 2025-09-08
version: v5.5.1
changes:
Expand Down Expand Up @@ -608,7 +613,7 @@ sdks:
- x86-64
- distribution-type: package
distribution-repository: RubyGems
package-name: pubnub-5.5.1.gem
package-name: pubnub-5.6.0.gem
location: https://rubygems.org/gems/pubnub
requires:
- name: addressable
Expand Down Expand Up @@ -713,8 +718,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub-5.5.1.gem
location: https://github.com/pubnub/ruby/releases/download/v5.5.1/pubnub-5.5.1.gem
package-name: pubnub-5.6.0.gem
location: https://github.com/pubnub/ruby/releases/download/v5.6.0/pubnub-5.6.0.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 @@
## v5.6.0
September 11 2025

#### Added
- Add the `encode_channels` parameter for `fetch` to enable or disable channel names percent-encoding in response.

## v5.5.1
September 08 2025

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 (5.5.1)
pubnub (5.6.0)
addressable (>= 2.0.0)
concurrent-ruby (~> 1.3.4)
concurrent-ruby-edge (~> 0.7.1)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.5.1
5.6.0

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/pubnub/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def create_variables_from_options(options)
include_custom_message_type include_message_actions include_message_type
replicate with_presence cipher_key_selector include_meta include_uuid join
update get add remove push_token push_gateway environment topic
authorized_uuid authorized_user_id token type status value]
authorized_uuid authorized_user_id token type status value encode_channels]

options = options.each_with_object({}) { |option, obj| obj[option.first.to_sym] = option.last }

Expand Down
2 changes: 2 additions & 0 deletions lib/pubnub/events/fetch_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def initialize(options, app)
@include_custom_message_type = options.fetch(:include_custom_message_type, false)
@include_message_actions = options.fetch(:include_message_actions, false)
@include_message_type = options.fetch(:include_message_type, true)
@encode_channels = options.fetch(:encode_channels, true)
@include_uuid = options.fetch(:include_uuid, true)
@include_meta = options.fetch(:include_meta, false)
@start = options[:start] if options.key?(:start)
Expand Down Expand Up @@ -52,6 +53,7 @@ def parameters(signature = false)
parameters[:include_uuid] = 'true' if @include_uuid
parameters[:include_custom_message_type] = 'true' if @include_custom_message_type
parameters[:include_message_type] = 'true' if @include_message_type
parameters[:encode_channels] = 'false' if !@encode_channels && !@include_message_actions
parameters[:start] = @start unless @start.nil?
parameters[:end] = @end unless @end.nil?
parameters[:max] = @max unless @max.nil?
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 = '5.5.1'.freeze
VERSION = '5.6.0'.freeze
end
56 changes: 56 additions & 0 deletions spec/examples/fetch_messages_examples_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -596,4 +596,60 @@
] } })
end
end

it "__channel__channel|encoded::1___max__5___http_sync__true___callback__nil_" do
VCR.use_cassette("examples/fetch_messages/encoded_channels", :record => :once) do
channel = "channel|encoded::1"
envelope = @pubnub.fetch_messages(channel: channel, max: 5, http_sync: true)
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
expect(envelope.error?).to eq false

expect(envelope.status[:code]).to eq(200)
expect(envelope.status[:category]).to eq(:ack)
expect(envelope.status[:config]).to eq({ :tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com" })

expect(envelope.result[:code]).to eq(200)
expect(envelope.result[:operation]).to eq(:fetch_messages)
expect(envelope.result[:data]).to eq({
:channels => {
"channel%7Cencoded%3A%3A1" => [
{
"message_type" => nil,
"message" => "Hello test world",
"timetoken" => "17575837829949324",
"uuid" => "ruby-test-uuid-client-one"
}
]
}
})
end
end

it "__channel__channel|encoded::2___max__5___encode_channels__false___http_sync__true___callback__nil_" do
VCR.use_cassette("examples/fetch_messages/not_encoded_channels", :record => :once) do
channel = "channel|encoded::2"
envelope = @pubnub.fetch_messages(channel: channel, max: 5, encode_channels: false, http_sync: true)
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
expect(envelope.error?).to eq false

expect(envelope.status[:code]).to eq(200)
expect(envelope.status[:category]).to eq(:ack)
expect(envelope.status[:config]).to eq({ :tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com" })

expect(envelope.result[:code]).to eq(200)
expect(envelope.result[:operation]).to eq(:fetch_messages)
expect(envelope.result[:data]).to eq({
:channels => {
"channel|encoded::2" => [
{
"message_type" => nil,
"message" => "Hello test world",
"timetoken" => "17575842502404510",
"uuid" => "ruby-test-uuid-client-one",
}
]
}
})
end
end
end
Loading