Skip to content

Commit 4414f40

Browse files
authored
Fix default callback and http_sync (#136)
fix(events): fix default `callback` and `http_sync` Fix issue because of which `callback` and `http_sync` provided during client configuration not used when missing in method call.
1 parent f80d58a commit 4414f40

File tree

12 files changed

+57
-17
lines changed

12 files changed

+57
-17
lines changed

.github/workflows/commands-handler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
- name: Checkout release actions
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717
with:
1818
repository: pubnub/client-engineering-deployment-tools
1919
ref: v1

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ jobs:
3333
if: ${{ needs.check-release.outputs.release == 'true' }}
3434
steps:
3535
- name: Checkout repository
36-
uses: actions/checkout@v2
36+
uses: actions/checkout@v3
3737
with:
3838
# This should be the same as the one specified for on.pull_request.branches
3939
ref: master
4040
- name: Checkout actions
41-
uses: actions/checkout@v2
41+
uses: actions/checkout@v3
4242
with:
4343
repository: pubnub/client-engineering-deployment-tools
4444
ref: v1

.github/workflows/run_acceptance_tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout project
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v3
1212
- name: Checkout mock-server action
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
with:
1515
repository: pubnub/client-engineering-deployment-tools
16-
ref: github-actions
16+
ref: v1
1717
token: ${{ secrets.GH_TOKEN }}
1818
path: client-engineering-deployment-tools
1919
- name: Run mock server action
@@ -36,7 +36,7 @@ jobs:
3636
jrm ./main.xml "./main/**/*.xml" &&
3737
jrm ./beta.xml "./beta/**/*.xml"
3838
- name: Expose main report
39-
uses: actions/upload-artifact@v2
39+
uses: actions/upload-artifact@v3
4040
if: always()
4141
with:
4242
name: acceptance-test-reports

.github/workflows/validate-pubnub-yml.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: Validate PubNub yml
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
- name: Use Node.js
1414
uses: actions/setup-node@v1
1515
with:

.pubnub.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
---
2-
version: "5.1.0"
2+
version: "5.1.1"
33
changelog:
4+
- date: 2022-10-26
5+
version: v5.1.1
6+
changes:
7+
- type: bug
8+
text: "Fix issue because of which `callback` and `http_sync` provided during client configuration not used when missing in method call."
49
- date: 2022-07-26
510
version: v5.1.0
611
changes:
@@ -632,7 +637,7 @@ sdks:
632637
- x86-64
633638
- distribution-type: package
634639
distribution-repository: RubyGems
635-
package-name: pubnub-5.1.0.gem
640+
package-name: pubnub-5.1.1.gem
636641
location: https://rubygems.org/gems/pubnub
637642
requires:
638643
- name: addressable
@@ -737,8 +742,8 @@ sdks:
737742
- x86-64
738743
- distribution-type: library
739744
distribution-repository: GitHub release
740-
package-name: pubnub-5.1.0.gem
741-
location: https://github.com/pubnub/ruby/releases/download/v5.1.0/pubnub-5.1.0.gem
745+
package-name: pubnub-5.1.1.gem
746+
location: https://github.com/pubnub/ruby/releases/download/v5.1.1/pubnub-5.1.1.gem
742747
requires:
743748
- name: addressable
744749
min-version: 2.0.0

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 2.7.6

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v5.1.1
2+
October 26 2022
3+
4+
#### Fixed
5+
- Fix issue because of which `callback` and `http_sync` provided during client configuration not used when missing in method call.
6+
17
## v5.1.0
28
July 26 2022
39

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
pubnub (5.1.0)
4+
pubnub (5.1.1)
55
addressable (>= 2.0.0)
66
concurrent-ruby (~> 1.1.5)
77
concurrent-ruby-edge (~> 0.5.0)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.1.0
1+
5.1.1

lib/pubnub/client/events.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ module Events
1515
EVENTS.each do |event_name|
1616
define_method event_name do |options = {}, &block|
1717
options[:callback] = block if options[:callback].nil?
18+
# Use constructor-provided :callback if nothing passed to method call.
19+
options[:callback] = self.env[:callback] if options[:callback].nil?
1820
event = Pubnub.const_get(
1921
Formatter.classify_method(event_name)
2022
).new(options, self)
2123

22-
if options[:http_sync]
24+
if event.sync?
2325
event.fire
2426
elsif event.is_a? SubscribeEvent
2527
@subscriber.add_subscription(event)

0 commit comments

Comments
 (0)