Skip to content

Commit

Permalink
PubNub SDK v4.3.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
client-engineering-bot committed Oct 18, 2020
1 parent cb3c4eb commit d8ee391
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 25 deletions.
11 changes: 9 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
---
version: "4.2.7"
version: "4.3.0"
changelog:
-
changes:
-
text: "Add `delete` permission for `channel` to Grant."
type: feature
date: 18-10-2020
version: v4.3.0
-
changes:
-
Expand Down Expand Up @@ -47,7 +54,7 @@ changelog:
text: "Resolved issue with subscribe loop where the connection was reinitiated after receiving a 4xx error code from the server"
type: bugfix
date: 14-02-2020
version: "4.2.7"
version: "4.3.0"
-
changes:
-
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##### v4.3.0

- Add `delete` permission for `channel` to Grant.

##### v4.2.7

- Don't suppress runtime errors.
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 (4.2.7)
pubnub (4.3.0)
addressable (>= 2.0.0)
concurrent-ruby (~> 1.1.5)
concurrent-ruby-edge (~> 0.5.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Complete Documentation
Available at https://www.pubnub.com/docs/ruby/pubnub-ruby-sdk-v4 **v4.x**

## PubNub Gem version 4.2.7
## PubNub Gem version 4.3.0

##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
##### http://www.pubnub.com/account
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.7
4.3.0
17 changes: 8 additions & 9 deletions fixtures/vcr_cassettes/examples/grant/1944.yml

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

17 changes: 8 additions & 9 deletions fixtures/vcr_cassettes/examples/grant/1945.yml

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 @@ -146,7 +146,7 @@ def create_variables_from_options(options)
ssl cipher_key secret_key auth_key
publish_key subscribe_key timetoken
open_timeout read_timeout idle_timeout heartbeat
group action read write manage ttl presence start
group action read write delete manage ttl presence start
end count reverse presence_callback store skip_validate
state channel_group channel_groups compressed meta customs include_token
replicate with_presence cipher_key_selector include_meta]
Expand Down
7 changes: 7 additions & 0 deletions lib/pubnub/events/grant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ def parameters(signature = false)
read = [0, '0', false].include?(@read) ? 0 : 1
manage = [0, '0', false].include?(@manage) ? 0 : 1 # unless @group.blank?

if @delete.blank?
delete = nil
else
delete = [0, '0', false].include?(@delete) ? 0 : 1
end

{ timestamp: @timestamp,
w: write,
r: read,
m: manage,
d: delete,
ttl: @ttl }.delete_if { |_k, v| v.nil? }.merge(super(signature))
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 = '4.2.7'.freeze
VERSION = '4.3.0'.freeze
end
36 changes: 36 additions & 0 deletions spec/examples/grant_examples_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35982,4 +35982,40 @@
expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}})
end
end

it "__channel___demo___group__nil___read__true___write__true___manage__nil___delete__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do
VCR.use_cassette("examples/grant/1944", record: :none) do
Pubnub::Grant.any_instance.stub(:current_time).and_return "1601665764"
Pubnub::Grant.any_instance.stub(:signature).and_return "6_P9JKXY2G7gIdjuRsAhAgcHOcp5tgZt1VUiILsyim8="
envelope = @pubnub.grant(channel: :demo, read: true, write: true, delete: true, 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(:grant)
expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1, "d" => 1, "g" => 0, "u" => 0, "j" => 0}}})
end
end

it "__channel___demo___group__nil___read__true___write__true___manage__nil___delete__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do
VCR.use_cassette("examples/grant/1945", record: :none) do
Pubnub::Grant.any_instance.stub(:current_time).and_return "1601667045"
Pubnub::Grant.any_instance.stub(:signature).and_return "sff6s-w30otIKUPo2hOmMs7GHloZ1cfBy1_5GhzW8HM="
envelope = @pubnub.grant(channel: :demo, read: true, write: true, delete: 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(:grant)
expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1, "d" => 0, "g" => 0, "u" => 0, "j" => 0}}})
end
end
end

0 comments on commit d8ee391

Please sign in to comment.