pubnub 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.pubnub.yml +11 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/pubnub/event.rb +1 -1
- data/lib/pubnub/events/get_all_channels_metadata.rb +13 -9
- data/lib/pubnub/events/get_all_uuid_metadata.rb +13 -9
- data/lib/pubnub/events/get_channel_members.rb +18 -15
- data/lib/pubnub/events/get_channel_metadata.rb +9 -5
- data/lib/pubnub/events/get_memberships.rb +18 -15
- data/lib/pubnub/events/get_uuid_metadata.rb +9 -5
- data/lib/pubnub/events/set_channel_members.rb +18 -13
- data/lib/pubnub/events/set_channel_metadata.rb +8 -4
- data/lib/pubnub/events/set_memberships.rb +18 -13
- data/lib/pubnub/events/set_uuid_metadata.rb +8 -4
- data/lib/pubnub/validators/set_channel_metadata.rb +17 -13
- data/lib/pubnub/validators/set_uuid_metadata.rb +17 -13
- data/lib/pubnub/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc4c6cc7d070726bb7046638c4cb142a9f902b21b0da50ae924d450f39e6e8a7
|
4
|
+
data.tar.gz: 27cb6f7c2e3ec634654b4d6e78984ea51b2ee8338f5cc58b0b08cf136bf1b15f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 401aa81c9dcafdd86d3d9626c18c321d3758f5a8278be2dca699e8210a2c20412cef22f7001f33fbde630c75c61fb88735deba59657df4e5f0c7e05a0582c672
|
7
|
+
data.tar.gz: 6d6715e518fe654f37d795b4d4ab283b22aab1e29c93d71f1c2df85964a8b52530cdc4f011ec128c053f472668a6f1dd7a4fee09aa0c6b726c3d1583b0b672c7
|
data/.pubnub.yml
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
---
|
2
|
-
version: "5.
|
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.
|
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.
|
705
|
-
location: https://github.com/pubnub/ruby/releases/download/v5.
|
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
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
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(
|
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
|
-
|
21
|
-
@include
|
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 =
|
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.
|
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
|
60
|
-
metadata =
|
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(
|
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
|
-
|
21
|
-
@include
|
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 =
|
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.
|
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
|
60
|
-
metadata =
|
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(
|
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
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
|
27
|
-
@include
|
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 =
|
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(
|
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
|
68
|
-
member =
|
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 =
|
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
|
-
|
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 =
|
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 =
|
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(
|
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
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
|
27
|
-
@include
|
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 =
|
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(
|
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
|
68
|
-
membership =
|
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 =
|
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
|
-
|
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 =
|
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 =
|
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(
|
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
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
|
27
|
-
@include
|
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 =
|
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(
|
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
|
88
|
-
member =
|
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 =
|
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
|
-
|
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 =
|
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 =
|
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(
|
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
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
|
27
|
-
@include
|
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 =
|
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(
|
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
|
88
|
-
membership =
|
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 =
|
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
|
-
|
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 =
|
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 =
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
54
|
+
known_channel_metadata_fields = %w[name description type status custom]
|
51
55
|
|
52
56
|
@metadata.each_key do |field_name|
|
53
|
-
|
54
|
-
|
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
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
54
|
+
known_uuid_metadata_fields = %w[name email externalId profileUrl type status custom]
|
51
55
|
|
52
56
|
@metadata.each_key do |field_name|
|
53
|
-
|
54
|
-
|
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
|
-
|
57
|
-
end
|
61
|
+
raise(ArgumentError.new(object: self, message: message), message)
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
data/lib/pubnub/version.rb
CHANGED
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
|
+
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-
|
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.
|
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:
|