pubnub 5.4.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29d9b1bf2b58050bd99d049ea2416ff1cfe3cd92ee813e335a54b3ca2e9ee7ac
4
- data.tar.gz: 274b127f964ad0059b3edbf152397e761c4437206b08f98a8b61b95081e96a16
3
+ metadata.gz: fc4c6cc7d070726bb7046638c4cb142a9f902b21b0da50ae924d450f39e6e8a7
4
+ data.tar.gz: 27cb6f7c2e3ec634654b4d6e78984ea51b2ee8338f5cc58b0b08cf136bf1b15f
5
5
  SHA512:
6
- metadata.gz: 043f1102de6fa623327a91ba08a4d69a794b5e192970ee8607651f17c20cd0526d6e3dec0aa6cf299c3c6742c3af576e3e89e2664ca0461e8c60cb8d0e79f0cb
7
- data.tar.gz: d8ad79fedee8ff7dc4bdeac2a044dafa91f8d5c6e67d35827e0e8657b1082cb4996c271feb4e4663497c8b408ade109674034956c522c7ac6663d8837f58ab29
6
+ metadata.gz: 401aa81c9dcafdd86d3d9626c18c321d3758f5a8278be2dca699e8210a2c20412cef22f7001f33fbde630c75c61fb88735deba59657df4e5f0c7e05a0582c672
7
+ data.tar.gz: 6d6715e518fe654f37d795b4d4ab283b22aab1e29c93d71f1c2df85964a8b52530cdc4f011ec128c053f472668a6f1dd7a4fee09aa0c6b726c3d1583b0b672c7
data/.pubnub.yml CHANGED
@@ -1,6 +1,13 @@
1
1
  ---
2
- version: "5.4.0"
2
+ version: "5.5.0"
3
3
  changelog:
4
+ - date: 2025-01-28
5
+ version: v5.5.0
6
+ changes:
7
+ - type: feature
8
+ text: "Add the ability to specify `type` and `status` fields for `channel metadata`, `uuid metadata`, `member`, and `membership`."
9
+ - type: feature
10
+ text: "Add missing `include` options for App Context APIs: `custom`, `status`, `type`, `uuid_status`, `uuid_type`, `channel_status`, and `channel_type`."
4
11
  - date: 2025-01-07
5
12
  version: v5.4.0
6
13
  changes:
@@ -596,7 +603,7 @@ sdks:
596
603
  - x86-64
597
604
  - distribution-type: package
598
605
  distribution-repository: RubyGems
599
- package-name: pubnub-5.4.0.gem
606
+ package-name: pubnub-5.5.0.gem
600
607
  location: https://rubygems.org/gems/pubnub
601
608
  requires:
602
609
  - name: addressable
@@ -701,8 +708,8 @@ sdks:
701
708
  - x86-64
702
709
  - distribution-type: library
703
710
  distribution-repository: GitHub release
704
- package-name: pubnub-5.4.0.gem
705
- location: https://github.com/pubnub/ruby/releases/download/v5.4.0/pubnub-5.4.0.gem
711
+ package-name: pubnub-5.5.0.gem
712
+ location: https://github.com/pubnub/ruby/releases/download/v5.5.0/pubnub-5.5.0.gem
706
713
  requires:
707
714
  - name: addressable
708
715
  min-version: 2.0.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v5.5.0
2
+ January 28 2025
3
+
4
+ #### Added
5
+ - Add the ability to specify `type` and `status` fields for `channel metadata`, `uuid metadata`, `member`, and `membership`.
6
+ - Add missing `include` options for App Context APIs: `custom`, `status`, `type`, `uuid_status`, `uuid_type`, `channel_status`, and `channel_type`.
7
+
1
8
  ## v5.4.0
2
9
  January 07 2025
3
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubnub (5.4.0)
4
+ pubnub (5.5.0)
5
5
  addressable (>= 2.0.0)
6
6
  concurrent-ruby (~> 1.3.4)
7
7
  concurrent-ruby-edge (~> 0.7.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.4.0
1
+ 5.5.0
data/lib/pubnub/event.rb CHANGED
@@ -178,7 +178,7 @@ module Pubnub
178
178
  include_custom_message_type include_message_actions include_message_type
179
179
  replicate with_presence cipher_key_selector include_meta include_uuid join
180
180
  update get add remove push_token push_gateway environment topic
181
- authorized_uuid authorized_user_id token type value]
181
+ authorized_uuid authorized_user_id token type status value]
182
182
 
183
183
  options = options.each_with_object({}) { |option, obj| obj[option.first.to_sym] = option.last }
184
184
 
@@ -11,18 +11,22 @@ module Pubnub
11
11
  @event = current_operation
12
12
  @telemetry_name = :l_obj
13
13
  @limit = [options[:limit], 100].min unless options[:limit].nil?
14
- @sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
14
+ @sort = options[:sort].join(',') if options[:sort] && !options[:sort].empty?
15
15
  @filter = options[:filter] if options[:filter] && !options[:filter].empty?
16
16
  @start = options[:start] if options[:start] && !options[:start].empty?
17
17
  @end = options[:end] if options[:start] && !options[:end].empty?
18
18
 
19
+ @include = []
19
20
  if options[:include]
20
- @include_count = [0, '0', false].include?(options[:include][:count]) ? "0" : "1" unless options[:include][:count].nil?
21
- @include = "custom" unless [0, '0', false].include?(options[:include][:custom])
21
+ include = options[:include]
22
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
23
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
24
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
25
+ @include_count = [0, '0', false].include?(include[:count]) ? '0' : '1' unless include[:count].nil?
22
26
  end
23
27
 
24
28
  # Collections by default return number of available entries.
25
- @include_count = "1" if @include_count.nil?
29
+ @include_count = '1' if @include_count.nil?
26
30
 
27
31
  super
28
32
  end
@@ -41,7 +45,7 @@ module Pubnub
41
45
  parameters[:start] = @start unless @start.nil?
42
46
  parameters[:end] = @end if @end && !@start
43
47
  parameters[:count] = @include_count unless @include_count.nil?
44
- parameters[:include] = @include unless @include.to_s.empty?
48
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
45
49
 
46
50
  parameters
47
51
  end
@@ -56,12 +60,12 @@ module Pubnub
56
60
  end
57
61
 
58
62
  def valid_envelope(parsed_response, req_res_objects)
59
- channels_metadata = parsed_response['data'].map { |uuid_metadata|
60
- metadata = Hash.new
61
- uuid_metadata.each{ |k,v| metadata[k.to_sym] = v }
63
+ channels_metadata = parsed_response['data'].map do |uuid_metadata|
64
+ metadata = {}
65
+ uuid_metadata.each { |k, v| metadata[k.to_sym] = v }
62
66
  metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
63
67
  metadata
64
- }
68
+ end
65
69
 
66
70
  Pubnub::Envelope.new(
67
71
  event: @event,
@@ -11,18 +11,22 @@ module Pubnub
11
11
  @event = current_operation
12
12
  @telemetry_name = :l_obj
13
13
  @limit = [options[:limit], 100].min unless options[:limit].nil?
14
- @sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
14
+ @sort = options[:sort].join(',') if options[:sort] && !options[:sort].empty?
15
15
  @filter = options[:filter] if options[:filter] && !options[:filter].empty?
16
16
  @start = options[:start] if options[:start] && !options[:start].empty?
17
17
  @end = options[:end] if options[:start] && !options[:end].empty?
18
18
 
19
+ @include = []
19
20
  if options[:include]
20
- @include_count = [0, '0', false].include?(options[:include][:count]) ? "0" : "1" unless options[:include][:count].nil?
21
- @include = "custom" unless [0, '0', false].include?(options[:include][:custom])
21
+ include = options[:include]
22
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
23
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
24
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
25
+ @include_count = [0, '0', false].include?(include[:count]) ? '0' : '1' unless include[:count].nil?
22
26
  end
23
27
 
24
28
  # Collections by default return number of available entries.
25
- @include_count = "1" if @include_count.nil?
29
+ @include_count = '1' if @include_count.nil?
26
30
 
27
31
  super
28
32
  end
@@ -41,7 +45,7 @@ module Pubnub
41
45
  parameters[:start] = @start unless @start.nil?
42
46
  parameters[:end] = @end if @end && !@start
43
47
  parameters[:count] = @include_count unless @include_count.nil?
44
- parameters[:include] = @include unless @include.to_s.empty?
48
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
45
49
 
46
50
  parameters
47
51
  end
@@ -56,12 +60,12 @@ module Pubnub
56
60
  end
57
61
 
58
62
  def valid_envelope(parsed_response, req_res_objects)
59
- uuids_metadata = parsed_response['data'].map { |uuid_metadata|
60
- metadata = Hash.new
61
- uuid_metadata.each{ |k,v| metadata[k.to_sym] = v }
63
+ uuids_metadata = parsed_response['data'].map do |uuid_metadata|
64
+ metadata = {}
65
+ uuid_metadata.each { |k, v| metadata[k.to_sym] = v }
62
66
  metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
63
67
  metadata
64
- }
68
+ end
65
69
 
66
70
  Pubnub::Envelope.new(
67
71
  event: @event,
@@ -12,23 +12,26 @@ module Pubnub
12
12
  @telemetry_name = :l_obj
13
13
  @channel = options[:channel]
14
14
  @limit = [options[:limit], 100].min unless options[:limit].nil?
15
- @sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
15
+ @sort = options[:sort].join(',') if options[:sort] && !options[:sort].empty?
16
16
  @filter = options[:filter] if options[:filter] && !options[:filter].empty?
17
17
  @start = options[:start] if options[:start] && !options[:start].empty?
18
18
  @end = options[:end] if options[:start] && !options[:end].empty?
19
19
 
20
+ @include = []
20
21
  if options[:include]
21
22
  include = options[:include]
22
- @include_count = [0, '0', false].include?(include[:count]) ? "0" : "1" unless include[:count].nil?
23
- @include_custom = "custom" if !include[:custom].nil? && ![0, '0', false].include?(include[:custom])
24
- @include_uuid_metadata = "uuid" if !include[:uuid_metadata].nil? && ![0, '0', false].include?(include[:uuid_metadata])
25
- @include_uuid_custom = "uuid.custom" if !include[:uuid_custom].nil? && ![0, '0', false].include?(include[:uuid_custom])
26
-
27
- @include = [@include_custom, @include_uuid_metadata, @include_uuid_custom].reject { |flag| flag.to_s.empty? }
23
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
24
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
25
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
26
+ @include.push('uuid') unless include[:uuid_metadata].nil? || [0, '0', false].include?(include[:uuid_metadata])
27
+ @include.push('uuid.type') unless include[:uuid_type].nil? || [0, '0', false].include?(include[:uuid_type])
28
+ @include.push('uuid.status') unless include[:uuid_status].nil? || [0, '0', false].include?(include[:uuid_status])
29
+ @include.push('uuid.custom') unless include[:uuid_custom].nil? || [0, '0', false].include?(include[:uuid_custom])
30
+ @include_count = [0, '0', false].include?(include[:count]) ? '0' : '1' unless include[:count].nil?
28
31
  end
29
32
 
30
33
  # Collections by default return number of available entries.
31
- @include_count = "1" if @include_count.nil?
34
+ @include_count = '1' if @include_count.nil?
32
35
 
33
36
  super
34
37
  end
@@ -47,7 +50,7 @@ module Pubnub
47
50
  parameters[:start] = @start unless @start.nil?
48
51
  parameters[:end] = @end if @end && !@start
49
52
  parameters[:count] = @include_count unless @include_count.nil?
50
- parameters[:include] = @include.sort.join(",") if @include && !@include.empty?
53
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
51
54
 
52
55
  parameters
53
56
  end
@@ -64,20 +67,20 @@ module Pubnub
64
67
  end
65
68
 
66
69
  def valid_envelope(parsed_response, req_res_objects)
67
- members = parsed_response['data'].map { |channel_member|
68
- member = Hash.new
69
- channel_member.each{ |k,v| member[k.to_sym] = v }
70
+ members = parsed_response['data'].map do |channel_member|
71
+ member = {}
72
+ channel_member.each { |k, v| member[k.to_sym] = v }
70
73
 
71
74
  unless member[:uuid].nil?
72
- uuid_metadata = Hash.new
73
- member[:uuid].each{ |k,v| uuid_metadata[k.to_sym] = v }
75
+ uuid_metadata = {}
76
+ member[:uuid].each { |k, v| uuid_metadata[k.to_sym] = v }
74
77
  uuid_metadata[:updated] = Date._parse(uuid_metadata[:updated]) unless uuid_metadata[:updated].nil?
75
78
  member[:uuid] = uuid_metadata
76
79
  end
77
80
  member[:updated] = Date._parse(member[:updated]) unless member[:updated].nil?
78
81
 
79
82
  member
80
- }
83
+ end
81
84
 
82
85
  Pubnub::Envelope.new(
83
86
  event: @event,
@@ -12,12 +12,16 @@ module Pubnub
12
12
  @telemetry_name = :l_obj
13
13
  @channel = options[:channel]
14
14
 
15
+ @include = []
15
16
  if options[:include]
16
- @include = "custom" unless [0, '0', false].include?(options[:include][:custom])
17
+ include = options[:include]
18
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
19
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
20
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
17
21
  end
18
22
 
19
23
  # Single entity creation should return it's 'custom' field by default.
20
- @include = "custom" if @include.nil?
24
+ @include = ['custom'] if @include.empty?
21
25
  super
22
26
  end
23
27
 
@@ -29,7 +33,7 @@ module Pubnub
29
33
 
30
34
  def parameters(signature = false)
31
35
  parameters = super(signature)
32
- parameters[:include] = @include
36
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
33
37
 
34
38
  parameters
35
39
  end
@@ -46,8 +50,8 @@ module Pubnub
46
50
 
47
51
  def valid_envelope(parsed_response, req_res_objects)
48
52
  data = parsed_response['data']
49
- metadata = Hash.new
50
- data.each{ |k,v| metadata[k.to_sym] = v }
53
+ metadata = {}
54
+ data.each { |k, v| metadata[k.to_sym] = v }
51
55
  metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
52
56
 
53
57
  Pubnub::Envelope.new(
@@ -12,23 +12,26 @@ module Pubnub
12
12
  @telemetry_name = :l_obj
13
13
  @uuid = options[:uuid].nil? ? app.user_id : options[:uuid]
14
14
  @limit = [options[:limit], 100].min unless options[:limit].nil?
15
- @sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
15
+ @sort = options[:sort].join(',') if options[:sort] && !options[:sort].empty?
16
16
  @filter = options[:filter] if options[:filter] && !options[:filter].empty?
17
17
  @start = options[:start] if options[:start] && !options[:start].empty?
18
18
  @end = options[:end] if options[:start] && !options[:end].empty?
19
19
 
20
+ @include = []
20
21
  if options[:include]
21
22
  include = options[:include]
22
- @include_count = [0, '0', false].include?(include[:count]) ? "0" : "1" unless include[:count].nil?
23
- @include_custom = "custom" if !include[:custom].nil? && ![0, '0', false].include?(include[:custom])
24
- @include_channel_metadata = "channel" if !include[:channel_metadata].nil? && ![0, '0', false].include?(include[:channel_metadata])
25
- @include_channel_custom = "channel.custom" if !include[:channel_custom].nil? && ![0, '0', false].include?(include[:channel_custom])
26
-
27
- @include = [@include_custom, @include_channel_metadata, @include_channel_custom].reject { |flag| flag.to_s.empty? }
23
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
24
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
25
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
26
+ @include.push('channel') unless include[:channel_metadata].nil? || [0, '0', false].include?(include[:channel_metadata])
27
+ @include.push('channel.type') unless include[:channel_type].nil? || [0, '0', false].include?(include[:channel_type])
28
+ @include.push('channel.status') unless include[:channel_status].nil? || [0, '0', false].include?(include[:channel_status])
29
+ @include.push('channel.custom') unless include[:channel_custom].nil? || [0, '0', false].include?(include[:channel_custom])
30
+ @include_count = [0, '0', false].include?(include[:count]) ? '0' : '1' unless include[:count].nil?
28
31
  end
29
32
 
30
33
  # Collections by default return number of available entries.
31
- @include_count = "1" if @include_count.nil?
34
+ @include_count = '1' if @include_count.nil?
32
35
 
33
36
  super
34
37
  end
@@ -47,7 +50,7 @@ module Pubnub
47
50
  parameters[:start] = @start unless @start.nil?
48
51
  parameters[:end] = @end if @end && !@start
49
52
  parameters[:count] = @include_count unless @include_count.nil?
50
- parameters[:include] = @include.sort.join(",") if @include && !@include.empty?
53
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
51
54
 
52
55
  parameters
53
56
  end
@@ -64,20 +67,20 @@ module Pubnub
64
67
  end
65
68
 
66
69
  def valid_envelope(parsed_response, req_res_objects)
67
- memberships = parsed_response['data'].map { |uuid_membership|
68
- membership = Hash.new
69
- uuid_membership.each{ |k,v| membership[k.to_sym] = v }
70
+ memberships = parsed_response['data'].map do |uuid_membership|
71
+ membership = {}
72
+ uuid_membership.each { |k, v| membership[k.to_sym] = v }
70
73
 
71
74
  unless membership[:channel].nil?
72
- channel_metadata = Hash.new
73
- membership[:channel].each{ |k,v| channel_metadata[k.to_sym] = v }
75
+ channel_metadata = {}
76
+ membership[:channel].each { |k, v| channel_metadata[k.to_sym] = v }
74
77
  channel_metadata[:updated] = Date._parse(channel_metadata[:updated]) unless channel_metadata[:updated].nil?
75
78
  membership[:channel] = channel_metadata
76
79
  end
77
80
  membership[:updated] = Date._parse(membership[:updated]) unless membership[:updated].nil?
78
81
 
79
82
  membership
80
- }
83
+ end
81
84
 
82
85
  Pubnub::Envelope.new(
83
86
  event: @event,
@@ -12,12 +12,16 @@ module Pubnub
12
12
  @telemetry_name = :l_obj
13
13
  @uuid = options[:uuid].nil? ? app.user_id : options[:uuid]
14
14
 
15
+ @include = []
15
16
  if options[:include]
16
- @include = "custom" unless [0, '0', false].include?(options[:include][:custom])
17
+ include = options[:include]
18
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
19
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
20
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
17
21
  end
18
22
 
19
23
  # Single entity creation should return it's 'custom' field by default.
20
- @include = "custom" if @include.nil?
24
+ @include = ['custom'] if @include.empty?
21
25
  super
22
26
  end
23
27
 
@@ -29,7 +33,7 @@ module Pubnub
29
33
 
30
34
  def parameters(signature = false)
31
35
  parameters = super(signature)
32
- parameters[:include] = @include
36
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
33
37
 
34
38
  parameters
35
39
  end
@@ -46,8 +50,8 @@ module Pubnub
46
50
 
47
51
  def valid_envelope(parsed_response, req_res_objects)
48
52
  data = parsed_response['data']
49
- metadata = Hash.new
50
- data.each{ |k,v| metadata[k.to_sym] = v }
53
+ metadata = {}
54
+ data.each { |k, v| metadata[k.to_sym] = v }
51
55
  metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
52
56
 
53
57
  Pubnub::Envelope.new(
@@ -12,25 +12,28 @@ module Pubnub
12
12
  @telemetry_name = :l_obj
13
13
  @channel = options[:channel]
14
14
  @limit = [options[:limit], 100].min unless options[:limit].nil?
15
- @sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
15
+ @sort = options[:sort].join(',') if options[:sort] && !options[:sort].empty?
16
16
  @filter = options[:filter] if options[:filter] && !options[:filter].empty?
17
17
  @start = options[:start] if options[:start] && !options[:start].empty?
18
18
  @end = options[:end] if options[:start] && !options[:end].empty?
19
19
 
20
+ @include = []
20
21
  if options[:include]
21
22
  include = options[:include]
22
- @include_count = [0, '0', false].include?(include[:count]) ? "0" : "1" unless include[:count].nil?
23
- @include_custom = "custom" if !include[:custom].nil? && ![0, '0', false].include?(include[:custom])
24
- @include_uuid_metadata = "uuid" if !include[:uuid_metadata].nil? && ![0, '0', false].include?(include[:uuid_metadata])
25
- @include_uuid_custom = "uuid.custom" if !include[:uuid_custom].nil? && ![0, '0', false].include?(include[:uuid_custom])
26
-
27
- @include = [@include_custom, @include_uuid_metadata, @include_uuid_custom].reject { |flag| flag.to_s.empty? }
23
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
24
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
25
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
26
+ @include.push('uuid') unless include[:uuid_metadata].nil? || [0, '0', false].include?(include[:uuid_metadata])
27
+ @include.push('uuid.type') unless include[:uuid_type].nil? || [0, '0', false].include?(include[:uuid_type])
28
+ @include.push('uuid.status') unless include[:uuid_status].nil? || [0, '0', false].include?(include[:uuid_status])
29
+ @include.push('uuid.custom') unless include[:uuid_custom].nil? || [0, '0', false].include?(include[:uuid_custom])
30
+ @include_count = [0, '0', false].include?(include[:count]) ? '0' : '1' unless include[:count].nil?
28
31
  end
29
32
 
30
33
  @uuids = options[:uuids] if options[:uuids] && !options[:uuids].empty?
31
34
 
32
35
  # Collections by default return number of available entries.
33
- @include_count = "1" if @include_count.nil?
36
+ @include_count = '1' if @include_count.nil?
34
37
 
35
38
  super
36
39
  end
@@ -41,6 +44,8 @@ module Pubnub
41
44
  members = @uuids.map do |member|
42
45
  member_object = { uuid: { id: member[:uuid] } }
43
46
  member_object[:custom] = member[:custom] if member[:custom] && !member[:custom].empty?
47
+ member_object[:type] = member[:type] if member[:type] && !member[:type].empty?
48
+ member_object[:status] = member[:status] if member[:status] && !member[:status].empty?
44
49
 
45
50
  member_object
46
51
  end
@@ -67,7 +72,7 @@ module Pubnub
67
72
  parameters[:start] = @start unless @start.nil?
68
73
  parameters[:end] = @end if @end && !@start
69
74
  parameters[:count] = @include_count unless @include_count.nil?
70
- parameters[:include] = @include.sort.join(",") if @include && !@include.empty?
75
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
71
76
 
72
77
  parameters
73
78
  end
@@ -84,12 +89,12 @@ module Pubnub
84
89
  end
85
90
 
86
91
  def valid_envelope(parsed_response, req_res_objects)
87
- members = parsed_response['data'].map { |channel_member|
88
- member = Hash.new
92
+ members = parsed_response['data'].map do |channel_member|
93
+ member = {}
89
94
  channel_member.each { |k, v| member[k.to_sym] = v }
90
95
 
91
96
  unless member[:uuid].nil?
92
- uuid_metadata = Hash.new
97
+ uuid_metadata = {}
93
98
  member[:uuid].each { |k, v| uuid_metadata[k.to_sym] = v }
94
99
  uuid_metadata[:updated] = Date._parse(uuid_metadata[:updated]) unless uuid_metadata[:updated].nil?
95
100
  member[:uuid] = uuid_metadata
@@ -97,7 +102,7 @@ module Pubnub
97
102
  member[:updated] = Date._parse(member[:updated]) unless member[:updated].nil?
98
103
 
99
104
  member
100
- }
105
+ end
101
106
 
102
107
  Pubnub::Envelope.new(
103
108
  event: @event,
@@ -15,12 +15,16 @@ module Pubnub
15
15
  # Clean up user-provided metadata object from nils.
16
16
  @metadata = options[:metadata].delete_if { |_k, v| v.blank? } unless options[:metadata].nil?
17
17
 
18
+ @include = []
18
19
  if options[:include]
19
- @include = [0, '0', false].include?(options[:include][:custom]) ? "0" : "1" unless options[:include][:custom].nil?
20
+ include = options[:include]
21
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
22
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
23
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
20
24
  end
21
25
 
22
26
  # Single entity creation should return it's 'custom' field by default.
23
- @include = "custom" if @include.nil?
27
+ @include = ['custom'] if @include.empty?
24
28
  super
25
29
  end
26
30
 
@@ -43,7 +47,7 @@ module Pubnub
43
47
 
44
48
  def parameters(signature = false)
45
49
  parameters = super(signature)
46
- parameters[:include] = @include
50
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
47
51
  parameters
48
52
  end
49
53
 
@@ -59,7 +63,7 @@ module Pubnub
59
63
 
60
64
  def valid_envelope(parsed_response, req_res_objects)
61
65
  data = parsed_response['data']
62
- metadata = Hash.new
66
+ metadata = {}
63
67
  data.each { |k, v| metadata[k.to_sym] = v }
64
68
  metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
65
69
 
@@ -12,25 +12,28 @@ module Pubnub
12
12
  @telemetry_name = :l_obj
13
13
  @uuid = options[:uuid].nil? ? app.user_id : options[:uuid]
14
14
  @limit = [options[:limit], 100].min unless options[:limit].nil?
15
- @sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
15
+ @sort = options[:sort].join(',') if options[:sort] && !options[:sort].empty?
16
16
  @filter = options[:filter] if options[:filter] && !options[:filter].empty?
17
17
  @start = options[:start] if options[:start] && !options[:start].empty?
18
18
  @end = options[:end] if options[:start] && !options[:end].empty?
19
19
 
20
+ @include = []
20
21
  if options[:include]
21
22
  include = options[:include]
22
- @include_count = [0, '0', false].include?(include[:count]) ? "0" : "1" unless include[:count].nil?
23
- @include_custom = "custom" if !include[:custom].nil? && ![0, '0', false].include?(include[:custom])
24
- @include_channel_metadata = "channel" if !include[:channel_metadata].nil? && ![0, '0', false].include?(include[:channel_metadata])
25
- @include_channel_custom = "channel.custom" if !include[:channel_custom].nil? && ![0, '0', false].include?(include[:channel_custom])
26
-
27
- @include = [@include_custom, @include_channel_metadata, @include_channel_custom].reject { |flag| flag.to_s.empty? }
23
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
24
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
25
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
26
+ @include.push('channel') unless include[:channel_metadata].nil? || [0, '0', false].include?(include[:channel_metadata])
27
+ @include.push('channel.type') unless include[:channel_type].nil? || [0, '0', false].include?(include[:channel_type])
28
+ @include.push('channel.status') unless include[:channel_status].nil? || [0, '0', false].include?(include[:channel_status])
29
+ @include.push('channel.custom') unless include[:channel_custom].nil? || [0, '0', false].include?(include[:channel_custom])
30
+ @include_count = [0, '0', false].include?(include[:count]) ? '0' : '1' unless include[:count].nil?
28
31
  end
29
32
 
30
33
  @channels = options[:channels] if options[:channels] && !options[:channels].empty?
31
34
 
32
35
  # Collections by default return number of available entries.
33
- @include_count = "1" if @include_count.nil?
36
+ @include_count = '1' if @include_count.nil?
34
37
 
35
38
  super
36
39
  end
@@ -41,6 +44,8 @@ module Pubnub
41
44
  memberships = @channels.map do |membership|
42
45
  membership_object = { channel: { id: membership[:channel] } }
43
46
  membership_object[:custom] = membership[:custom] if membership[:custom] && !membership[:custom].empty?
47
+ membership_object[:type] = membership[:type] if membership[:type] && !membership[:type].empty?
48
+ membership_object[:status] = membership[:status] if membership[:status] && !membership[:status].empty?
44
49
 
45
50
  membership_object
46
51
  end
@@ -67,7 +72,7 @@ module Pubnub
67
72
  parameters[:start] = @start unless @start.nil?
68
73
  parameters[:end] = @end if @end && !@start
69
74
  parameters[:count] = @include_count unless @include_count.nil?
70
- parameters[:include] = @include.sort.join(",") if @include && !@include.empty?
75
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
71
76
 
72
77
  parameters
73
78
  end
@@ -84,12 +89,12 @@ module Pubnub
84
89
  end
85
90
 
86
91
  def valid_envelope(parsed_response, req_res_objects)
87
- memberships = parsed_response['data'].map { |uuid_membership|
88
- membership = Hash.new
92
+ memberships = parsed_response['data'].map do |uuid_membership|
93
+ membership = {}
89
94
  uuid_membership.each { |k, v| membership[k.to_sym] = v }
90
95
 
91
96
  unless membership[:channel].nil?
92
- channel_metadata = Hash.new
97
+ channel_metadata = {}
93
98
  membership[:channel].each { |k, v| channel_metadata[k.to_sym] = v }
94
99
  channel_metadata[:updated] = Date._parse(channel_metadata[:updated]) unless channel_metadata[:updated].nil?
95
100
  membership[:channel] = channel_metadata
@@ -97,7 +102,7 @@ module Pubnub
97
102
  membership[:updated] = Date._parse(membership[:updated]) unless membership[:updated].nil?
98
103
 
99
104
  membership
100
- }
105
+ end
101
106
 
102
107
  Pubnub::Envelope.new(
103
108
  event: @event,
@@ -15,12 +15,16 @@ module Pubnub
15
15
  # Clean up user-provided metadata object from nils.
16
16
  @metadata = options[:metadata].delete_if { |_k, v| v.blank? } unless options[:metadata].nil?
17
17
 
18
+ @include = []
18
19
  if options[:include]
19
- @include = [0, '0', false].include?(options[:include][:custom]) ? "0" : "1" unless options[:include][:custom].nil?
20
+ include = options[:include]
21
+ @include.push('type') unless include[:type].nil? || [0, '0', false].include?(include[:type])
22
+ @include.push('status') unless include[:status].nil? || [0, '0', false].include?(include[:status])
23
+ @include.push('custom') unless include[:custom].nil? || [0, '0', false].include?(include[:custom])
20
24
  end
21
25
 
22
26
  # Single entity creation should return it's 'custom' field by default.
23
- @include = "custom" if @include.nil?
27
+ @include = ['custom'] if @include.empty?
24
28
 
25
29
  super
26
30
  end
@@ -44,7 +48,7 @@ module Pubnub
44
48
 
45
49
  def parameters(signature = false)
46
50
  parameters = super(signature)
47
- parameters[:include] = @include
51
+ parameters[:include] = @include.sort.join(',') unless @include.empty?
48
52
  parameters
49
53
  end
50
54
 
@@ -60,7 +64,7 @@ module Pubnub
60
64
 
61
65
  def valid_envelope(parsed_response, req_res_objects)
62
66
  data = parsed_response['data']
63
- metadata = Hash.new
67
+ metadata = {}
64
68
  data.each { |k, v| metadata[k.to_sym] = v }
65
69
  metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
66
70
 
@@ -37,24 +37,28 @@ module Pubnub
37
37
  end
38
38
 
39
39
  def validate_metadata!
40
- raise(
41
- ArgumentError.new(object: self, message: ':metadata is required for set channel metadata event.'),
42
- ':metadata is required for set channel metadata event.'
43
- ) if @metadata.nil? || @metadata.empty?
40
+ if @metadata.nil? || @metadata.empty?
41
+ raise(
42
+ ArgumentError.new(object: self, message: ':metadata is required for set channel metadata event.'),
43
+ ':metadata is required for set channel metadata event.'
44
+ )
45
+ end
44
46
 
45
- raise(
46
- ArgumentError.new(object: self, message: ':metadata parameter for set channel metadata must be Hash.'),
47
- ':metadata parameter for set channel metadata must be Hash.'
48
- ) if @metadata.class != Hash
47
+ if @metadata.class != Hash
48
+ raise(
49
+ ArgumentError.new(object: self, message: ':metadata parameter for set channel metadata must be Hash.'),
50
+ ':metadata parameter for set channel metadata must be Hash.'
51
+ )
52
+ end
49
53
 
50
- known_channel_metadata_fields = %w[name description custom updated eTag]
54
+ known_channel_metadata_fields = %w[name description type status custom]
51
55
 
52
56
  @metadata.each_key do |field_name|
53
- unless known_channel_metadata_fields.include?(field_name.to_s)
54
- message = "Unknown channel metadata key: '#{field_name}'. Only following keys allowed: #{known_channel_metadata_fields.join(", ")}"
57
+ next if known_channel_metadata_fields.include?(field_name.to_s)
58
+
59
+ message = "Unknown channel metadata key: '#{field_name}'. Only following keys allowed: #{known_channel_metadata_fields.join(', ')}"
55
60
 
56
- raise(ArgumentError.new(object: self, message: message), message)
57
- end
61
+ raise(ArgumentError.new(object: self, message: message), message)
58
62
  end
59
63
  end
60
64
  end
@@ -37,24 +37,28 @@ module Pubnub
37
37
  end
38
38
 
39
39
  def validate_metadata!
40
- raise(
41
- ArgumentError.new(object: self, message: ':metadata is required for set uuid metadata event.'),
42
- ':metadata is required for set uuid metadata event.'
43
- ) if @metadata.nil? || @metadata.empty?
40
+ if @metadata.nil? || @metadata.empty?
41
+ raise(
42
+ ArgumentError.new(object: self, message: ':metadata is required for set uuid metadata event.'),
43
+ ':metadata is required for set uuid metadata event.'
44
+ )
45
+ end
44
46
 
45
- raise(
46
- ArgumentError.new(object: self, message: ':metadata parameter for set uuid metadata must be Hash.'),
47
- ':metadata parameter for set uuid metadata must be Hash.'
48
- ) if @metadata.class != Hash
47
+ if @metadata.class != Hash
48
+ raise(
49
+ ArgumentError.new(object: self, message: ':metadata parameter for set uuid metadata must be Hash.'),
50
+ ':metadata parameter for set uuid metadata must be Hash.'
51
+ )
52
+ end
49
53
 
50
- known_uuid_metadata_fields = %w[name email externalId profileUrl custom updated eTag]
54
+ known_uuid_metadata_fields = %w[name email externalId profileUrl type status custom]
51
55
 
52
56
  @metadata.each_key do |field_name|
53
- unless known_uuid_metadata_fields.include?(field_name.to_s)
54
- message = "Unknown uuid metadata key: '#{field_name}'. Only following keys allowed: #{known_uuid_metadata_fields.join(", ")}"
57
+ next if known_uuid_metadata_fields.include?(field_name.to_s)
58
+
59
+ message = "Unknown uuid metadata key: '#{field_name}'. Only following keys allowed: #{known_uuid_metadata_fields.join(', ')}"
55
60
 
56
- raise(ArgumentError.new(object: self, message: message), message)
57
- end
61
+ raise(ArgumentError.new(object: self, message: message), message)
58
62
  end
59
63
  end
60
64
  end
@@ -1,4 +1,4 @@
1
1
  # Toplevel Pubnub module.
2
2
  module Pubnub
3
- VERSION = '5.4.0'.freeze
3
+ VERSION = '5.5.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PubNub
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-07 00:00:00.000000000 Z
11
+ date: 2025-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -295,7 +295,7 @@ homepage: https://github.com/pubnub/ruby
295
295
  licenses:
296
296
  - LicenseRef-LICENSE.txt
297
297
  metadata: {}
298
- post_install_message:
298
+ post_install_message:
299
299
  rdoc_options: []
300
300
  require_paths:
301
301
  - lib
@@ -310,8 +310,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
310
  - !ruby/object:Gem::Version
311
311
  version: '0'
312
312
  requirements: []
313
- rubygems_version: 3.3.5
314
- signing_key:
313
+ rubygems_version: 3.4.20
314
+ signing_key:
315
315
  specification_version: 4
316
316
  summary: PubNub Official Ruby gem.
317
317
  test_files: