pubnub 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pubnub might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.pubnub.yml +18 -2
- data/.travis.yml +4 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +10 -1
- data/README.md +56 -17
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/001.yml +45 -0
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/003.yml +45 -0
- data/fixtures/vcr_cassettes/examples/add_channels_to_push/004.yml +45 -0
- data/fixtures/vcr_cassettes/examples/grant/1946.yml +8 -9
- data/fixtures/vcr_cassettes/examples/grant/1947.yml +8 -9
- data/fixtures/vcr_cassettes/examples/grant/1948.yml +8 -9
- data/fixtures/vcr_cassettes/examples/list_push_provisions/001.yml +46 -0
- data/fixtures/vcr_cassettes/examples/list_push_provisions/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/list_push_provisions/003.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_channels_from_push/001.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_channels_from_push/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_channels_from_push/003.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_device_from_push/001.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_device_from_push/002.yml +45 -0
- data/fixtures/vcr_cassettes/examples/remove_device_from_push/003.yml +45 -0
- data/fixtures/vcr_cassettes/lib/events/get_all_channels_metadata.yml +1 -1
- data/fixtures/vcr_cassettes/lib/events/get_channel_members.yml +1 -1
- data/fixtures/vcr_cassettes/lib/events/{get_memberships.yml → get_memberships1.yml} +1 -1
- data/fixtures/vcr_cassettes/lib/events/get_memberships2.yml +37 -0
- data/fixtures/vcr_cassettes/lib/events/{get_uuid_metadata.yml → get_uuid_metadata1.yml} +0 -0
- data/fixtures/vcr_cassettes/lib/events/get_uuid_metadata2.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/remove_channel_members.yml +1 -1
- data/fixtures/vcr_cassettes/lib/events/{remove_memberships.yml → remove_memberships1.yml} +0 -0
- data/fixtures/vcr_cassettes/lib/events/remove_memberships2.yml +39 -0
- data/fixtures/vcr_cassettes/lib/events/{remove_uuid_metadata.yml → remove_uuid_metadata1.yml} +0 -0
- data/fixtures/vcr_cassettes/lib/events/remove_uuid_metadata2.yml +76 -0
- data/fixtures/vcr_cassettes/lib/events/{set_memberships.yml → set_memberships1.yml} +0 -0
- data/fixtures/vcr_cassettes/lib/events/set_memberships2.yml +39 -0
- data/fixtures/vcr_cassettes/lib/events/{set_uuid_metadata.yml → set_uuid_metadata1.yml} +0 -0
- data/fixtures/vcr_cassettes/lib/events/set_uuid_metadata2.yml +78 -0
- data/lib/pubnub/client.rb +4 -1
- data/lib/pubnub/event.rb +3 -1
- data/lib/pubnub/events/add_channels_to_push.rb +29 -13
- data/lib/pubnub/events/get_all_channels_metadata.rb +13 -1
- data/lib/pubnub/events/get_all_uuid_metadata.rb +13 -1
- data/lib/pubnub/events/get_channel_members.rb +21 -1
- data/lib/pubnub/events/get_channel_metadata.rb +6 -1
- data/lib/pubnub/events/get_memberships.rb +22 -2
- data/lib/pubnub/events/get_uuid_metadata.rb +7 -2
- data/lib/pubnub/events/grant.rb +1 -1
- data/lib/pubnub/events/list_push_provisions.rb +29 -12
- data/lib/pubnub/events/remove_channel_members.rb +22 -2
- data/lib/pubnub/events/remove_channels_from_push.rb +29 -13
- data/lib/pubnub/events/remove_device_from_push.rb +30 -14
- data/lib/pubnub/events/remove_memberships.rb +23 -3
- data/lib/pubnub/events/remove_uuid_metadata.rb +1 -1
- data/lib/pubnub/events/set_channel_members.rb +21 -1
- data/lib/pubnub/events/set_channel_metadata.rb +6 -1
- data/lib/pubnub/events/set_memberships.rb +22 -2
- data/lib/pubnub/events/set_uuid_metadata.rb +7 -2
- data/lib/pubnub/formatter.rb +28 -1
- data/lib/pubnub/validators/add_channels_to_push.rb +52 -0
- data/lib/pubnub/validators/grant.rb +1 -1
- data/lib/pubnub/validators/list_push_provisions.rb +43 -0
- data/lib/pubnub/validators/remove_channels_from_push.rb +52 -0
- data/lib/pubnub/validators/remove_device_from_push.rb +43 -0
- data/lib/pubnub/version.rb +1 -1
- data/spec/examples/add_channels_to_push_spec.rb +178 -0
- data/spec/examples/{grant_examples_spec.rb → grant_examples_1_spec.rb} +0 -9009
- data/spec/examples/grant_examples_2_spec.rb +9107 -0
- data/spec/examples/list_push_provisions_spec.rb +164 -0
- data/spec/examples/presence_examples_spec.rb +222 -186
- data/spec/examples/remove_channels_from_push_spec.rb +164 -0
- data/spec/examples/remove_device_from_push_spec.rb +164 -0
- data/spec/examples/revoke_examples_1_spec.rb +27013 -0
- data/spec/examples/revoke_examples_2_spec.rb +27012 -0
- data/spec/examples/revoke_examples_3_spec.rb +17967 -0
- data/spec/examples/status_request_message_count_exceeded_spec.rb +4 -1
- data/spec/examples/subscribe_examples_1_spec.rb +26972 -0
- data/spec/examples/subscribe_examples_2_spec.rb +19575 -0
- data/spec/lib/connection_callback_spec.rb +4 -3
- data/spec/lib/events/membership_spec.rb +38 -11
- data/spec/lib/events/presence_delta_spec.rb +9 -6
- data/spec/lib/events/presence_spec.rb +13 -7
- data/spec/lib/events/subscribe_spec.rb +56 -32
- data/spec/lib/events/uuid_metadata_spec.rb +36 -6
- data/spec/lib/super_admin_spec.rb +8 -4
- data/spec/spec_helper.rb +23 -7
- metadata +53 -15
- data/lib/pubnub/validators/push.rb +0 -43
- data/spec/examples/revoke_examples_spec.rb +0 -71950
- data/spec/examples/subscribe_examples_spec.rb +0 -45184
data/lib/pubnub/event.rb
CHANGED
@@ -163,7 +163,9 @@ module Pubnub
|
|
163
163
|
group action read write delete manage ttl presence start
|
164
164
|
end count limit reverse presence_callback store skip_validate
|
165
165
|
state channel_group channel_groups compressed meta customs include_token
|
166
|
-
replicate with_presence cipher_key_selector include_meta join update get
|
166
|
+
replicate with_presence cipher_key_selector include_meta join update get
|
167
|
+
add remove push_token push_gateway environment topic
|
168
|
+
]
|
167
169
|
|
168
170
|
options = options.each_with_object({}) { |option, obj| obj[option.first.to_sym] = option.last }
|
169
171
|
|
@@ -3,13 +3,14 @@ module Pubnub
|
|
3
3
|
# Push related event
|
4
4
|
class AddChannelsToPush < SingleEvent
|
5
5
|
include Concurrent::Async
|
6
|
-
include Pubnub::Validator::
|
6
|
+
include Pubnub::Validator::AddChannelsToPush
|
7
7
|
|
8
8
|
def initialize(options, app)
|
9
|
-
super
|
10
9
|
@event = current_operation
|
11
|
-
@
|
12
|
-
|
10
|
+
@telemetry_name = :l_push
|
11
|
+
super
|
12
|
+
# `environment` should
|
13
|
+
@environment ||= 'development' if @push_gateway.eql? 'apns2'
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
@@ -25,19 +26,33 @@ module Pubnub
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def path
|
28
|
-
'
|
29
|
-
'
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
if @push_gateway.eql? 'apns2'
|
30
|
+
'/' + [
|
31
|
+
'v2',
|
32
|
+
'push',
|
33
|
+
'sub-key',
|
34
|
+
@subscribe_key,
|
35
|
+
'devices-apns2',
|
36
|
+
@push_token
|
37
|
+
].join('/')
|
38
|
+
else
|
39
|
+
'/' + [
|
40
|
+
'v1',
|
41
|
+
'push',
|
42
|
+
'sub-key',
|
43
|
+
@subscribe_key,
|
44
|
+
'devices',
|
45
|
+
@push_token
|
46
|
+
].join('/')
|
47
|
+
end
|
36
48
|
end
|
37
49
|
|
38
50
|
def parameters(*_args)
|
39
51
|
params = super
|
40
|
-
params.
|
52
|
+
params[:add] = Formatter.channels_for_url(@channel, false)
|
53
|
+
params[:type] = @push_gateway unless @push_gateway.eql? 'apns2'
|
54
|
+
params[:environment] = @environment if @push_gateway.eql? 'apns2'
|
55
|
+
params[:topic] = @topic if @push_gateway.eql? 'apns2'
|
41
56
|
params
|
42
57
|
end
|
43
58
|
|
@@ -48,6 +63,7 @@ module Pubnub
|
|
48
63
|
timetoken: nil,
|
49
64
|
status: {
|
50
65
|
code: req_res_objects[:response].code,
|
66
|
+
operation: current_operation,
|
51
67
|
client_request: req_res_objects[:request],
|
52
68
|
server_response: req_res_objects[:response],
|
53
69
|
|
@@ -56,6 +56,13 @@ module Pubnub
|
|
56
56
|
end
|
57
57
|
|
58
58
|
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 }
|
62
|
+
metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
|
63
|
+
metadata
|
64
|
+
}
|
65
|
+
|
59
66
|
Pubnub::Envelope.new(
|
60
67
|
event: @event,
|
61
68
|
event_options: @given_options,
|
@@ -66,7 +73,12 @@ module Pubnub
|
|
66
73
|
operation: current_operation,
|
67
74
|
client_request: req_res_objects[:request],
|
68
75
|
server_response: req_res_objects[:response],
|
69
|
-
data:
|
76
|
+
data: {
|
77
|
+
metadata: channels_metadata,
|
78
|
+
totalCount: parsed_response['totalCount'],
|
79
|
+
next: parsed_response['next'],
|
80
|
+
prev: parsed_response['prev']
|
81
|
+
}
|
70
82
|
},
|
71
83
|
|
72
84
|
status: {
|
@@ -56,6 +56,13 @@ module Pubnub
|
|
56
56
|
end
|
57
57
|
|
58
58
|
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 }
|
62
|
+
metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
|
63
|
+
metadata
|
64
|
+
}
|
65
|
+
|
59
66
|
Pubnub::Envelope.new(
|
60
67
|
event: @event,
|
61
68
|
event_options: @given_options,
|
@@ -66,7 +73,12 @@ module Pubnub
|
|
66
73
|
operation: current_operation,
|
67
74
|
client_request: req_res_objects[:request],
|
68
75
|
server_response: req_res_objects[:response],
|
69
|
-
data:
|
76
|
+
data: {
|
77
|
+
metadata: uuids_metadata,
|
78
|
+
totalCount: parsed_response['totalCount'],
|
79
|
+
next: parsed_response['next'],
|
80
|
+
prev: parsed_response['prev']
|
81
|
+
}
|
70
82
|
},
|
71
83
|
|
72
84
|
status: {
|
@@ -64,6 +64,21 @@ module Pubnub
|
|
64
64
|
end
|
65
65
|
|
66
66
|
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
|
+
|
71
|
+
unless member[:uuid].nil?
|
72
|
+
uuid_metadata = Hash.new
|
73
|
+
member[:uuid].each{ |k,v| uuid_metadata[k.to_sym] = v }
|
74
|
+
uuid_metadata[:updated] = Date._parse(uuid_metadata[:updated]) unless uuid_metadata[:updated].nil?
|
75
|
+
member[:uuid] = uuid_metadata
|
76
|
+
end
|
77
|
+
member[:updated] = Date._parse(member[:updated]) unless member[:updated].nil?
|
78
|
+
|
79
|
+
member
|
80
|
+
}
|
81
|
+
|
67
82
|
Pubnub::Envelope.new(
|
68
83
|
event: @event,
|
69
84
|
event_options: @given_options,
|
@@ -74,7 +89,12 @@ module Pubnub
|
|
74
89
|
operation: current_operation,
|
75
90
|
client_request: req_res_objects[:request],
|
76
91
|
server_response: req_res_objects[:response],
|
77
|
-
data:
|
92
|
+
data: {
|
93
|
+
members: members,
|
94
|
+
totalCount: parsed_response['totalCount'],
|
95
|
+
next: parsed_response['next'],
|
96
|
+
prev: parsed_response['prev']
|
97
|
+
}
|
78
98
|
},
|
79
99
|
|
80
100
|
status: {
|
@@ -45,6 +45,11 @@ module Pubnub
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def valid_envelope(parsed_response, req_res_objects)
|
48
|
+
data = parsed_response['data']
|
49
|
+
metadata = Hash.new
|
50
|
+
data.each{ |k,v| metadata[k.to_sym] = v }
|
51
|
+
metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
|
52
|
+
|
48
53
|
Pubnub::Envelope.new(
|
49
54
|
event: @event,
|
50
55
|
event_options: @given_options,
|
@@ -55,7 +60,7 @@ module Pubnub
|
|
55
60
|
operation: current_operation,
|
56
61
|
client_request: req_res_objects[:request],
|
57
62
|
server_response: req_res_objects[:response],
|
58
|
-
data:
|
63
|
+
data: metadata
|
59
64
|
},
|
60
65
|
|
61
66
|
status: {
|
@@ -10,7 +10,7 @@ module Pubnub
|
|
10
10
|
def initialize(options, app)
|
11
11
|
@event = current_operation
|
12
12
|
@telemetry_name = :l_obj
|
13
|
-
@uuid = options[:uuid]
|
13
|
+
@uuid = options[:uuid].nil? ? app.env[:uuid] : options[:uuid]
|
14
14
|
@limit = [options[:limit], 100].min unless options[:limit].nil?
|
15
15
|
@sort = options[:sort].join(",") if options[:sort] && !options[:sort].empty?
|
16
16
|
@filter = options[:filter] if options[:filter] && !options[:filter].empty?
|
@@ -64,6 +64,21 @@ module Pubnub
|
|
64
64
|
end
|
65
65
|
|
66
66
|
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
|
+
|
71
|
+
unless membership[:channel].nil?
|
72
|
+
channel_metadata = Hash.new
|
73
|
+
membership[:channel].each{ |k,v| channel_metadata[k.to_sym] = v }
|
74
|
+
channel_metadata[:updated] = Date._parse(channel_metadata[:updated]) unless channel_metadata[:updated].nil?
|
75
|
+
membership[:channel] = channel_metadata
|
76
|
+
end
|
77
|
+
membership[:updated] = Date._parse(membership[:updated]) unless membership[:updated].nil?
|
78
|
+
|
79
|
+
membership
|
80
|
+
}
|
81
|
+
|
67
82
|
Pubnub::Envelope.new(
|
68
83
|
event: @event,
|
69
84
|
event_options: @given_options,
|
@@ -74,7 +89,12 @@ module Pubnub
|
|
74
89
|
operation: current_operation,
|
75
90
|
client_request: req_res_objects[:request],
|
76
91
|
server_response: req_res_objects[:response],
|
77
|
-
data:
|
92
|
+
data: {
|
93
|
+
memberships: memberships,
|
94
|
+
totalCount: parsed_response['totalCount'],
|
95
|
+
next: parsed_response['next'],
|
96
|
+
prev: parsed_response['prev']
|
97
|
+
}
|
78
98
|
},
|
79
99
|
|
80
100
|
status: {
|
@@ -10,7 +10,7 @@ module Pubnub
|
|
10
10
|
def initialize(options, app)
|
11
11
|
@event = current_operation
|
12
12
|
@telemetry_name = :l_obj
|
13
|
-
@uuid = options[:uuid]
|
13
|
+
@uuid = options[:uuid].nil? ? app.env[:uuid] : options[:uuid]
|
14
14
|
|
15
15
|
if options[:include]
|
16
16
|
@include = "custom" unless [0, '0', false].include?(options[:include][:custom])
|
@@ -45,6 +45,11 @@ module Pubnub
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def valid_envelope(parsed_response, req_res_objects)
|
48
|
+
data = parsed_response['data']
|
49
|
+
metadata = Hash.new
|
50
|
+
data.each{ |k,v| metadata[k.to_sym] = v }
|
51
|
+
metadata[:updated] = Date._parse(metadata[:updated]) unless metadata[:updated].nil?
|
52
|
+
|
48
53
|
Pubnub::Envelope.new(
|
49
54
|
event: @event,
|
50
55
|
event_options: @given_options,
|
@@ -55,7 +60,7 @@ module Pubnub
|
|
55
60
|
operation: current_operation,
|
56
61
|
client_request: req_res_objects[:request],
|
57
62
|
server_response: req_res_objects[:response],
|
58
|
-
data:
|
63
|
+
data: metadata
|
59
64
|
},
|
60
65
|
|
61
66
|
status: {
|
data/lib/pubnub/events/grant.rb
CHANGED
@@ -8,7 +8,7 @@ module Pubnub
|
|
8
8
|
def initialize(options, app)
|
9
9
|
@event = current_operation
|
10
10
|
super
|
11
|
-
@uuids = options[:uuids] unless options[:uuids].nil?
|
11
|
+
@uuids = Formatter::format_uuid(options[:uuids]) unless options[:uuids].nil?
|
12
12
|
@ttl ||= Pubnub::Constants::DEFAULT_TTL
|
13
13
|
end
|
14
14
|
|
@@ -3,12 +3,14 @@ module Pubnub
|
|
3
3
|
# Push related event
|
4
4
|
class ListPushProvisions < SingleEvent
|
5
5
|
include Concurrent::Async
|
6
|
-
include Pubnub::Validator::
|
6
|
+
include Pubnub::Validator::ListPushProvisions
|
7
7
|
|
8
8
|
def initialize(options, app)
|
9
|
-
super
|
10
9
|
@event = current_operation
|
11
|
-
@
|
10
|
+
@telemetry_name = :l_push
|
11
|
+
super
|
12
|
+
# `environment` should
|
13
|
+
@environment ||= 'development' if @push_gateway.eql? 'apns2'
|
12
14
|
end
|
13
15
|
|
14
16
|
private
|
@@ -24,19 +26,33 @@ module Pubnub
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def path
|
27
|
-
'
|
28
|
-
'
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
if @push_gateway.eql? 'apns2'
|
30
|
+
'/' + [
|
31
|
+
'v2',
|
32
|
+
'push',
|
33
|
+
'sub-key',
|
34
|
+
@subscribe_key,
|
35
|
+
'devices-apns2',
|
36
|
+
@push_token
|
37
|
+
].join('/')
|
38
|
+
else
|
39
|
+
'/' + [
|
40
|
+
'v1',
|
41
|
+
'push',
|
42
|
+
'sub-key',
|
43
|
+
@subscribe_key,
|
44
|
+
'devices',
|
45
|
+
@push_token
|
46
|
+
].join('/')
|
47
|
+
end
|
35
48
|
end
|
36
49
|
|
37
50
|
def parameters(*_args)
|
38
51
|
params = super
|
39
|
-
|
52
|
+
# Only include `type` if gateway is other than apns2
|
53
|
+
params[:type] = @push_gateway unless @push_gateway.eql? 'apns2'
|
54
|
+
params[:environment] = @environment if @push_gateway.eql? 'apns2'
|
55
|
+
params[:topic] = @topic if @push_gateway.eql? 'apns2'
|
40
56
|
params
|
41
57
|
end
|
42
58
|
|
@@ -47,6 +63,7 @@ module Pubnub
|
|
47
63
|
timetoken: nil,
|
48
64
|
status: {
|
49
65
|
code: req_res_objects[:response].code,
|
66
|
+
operation: current_operation,
|
50
67
|
client_request: req_res_objects[:request],
|
51
68
|
server_response: req_res_objects[:response],
|
52
69
|
|
@@ -39,7 +39,7 @@ module Pubnub
|
|
39
39
|
Pubnub.logger.debug('Pubnub::RemoveChannelMembers') { "Fired event #{self.class}" }
|
40
40
|
|
41
41
|
members = @uuids.map do |member|
|
42
|
-
{ uuid: { id: member
|
42
|
+
{ uuid: { id: member } }
|
43
43
|
end
|
44
44
|
|
45
45
|
body = Formatter.format_message({ delete: members }, @cipher_key, false)
|
@@ -81,6 +81,21 @@ module Pubnub
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def valid_envelope(parsed_response, req_res_objects)
|
84
|
+
members = parsed_response['data'].map { |channel_member|
|
85
|
+
member = Hash.new
|
86
|
+
channel_member.each{ |k,v| member[k.to_sym] = v }
|
87
|
+
|
88
|
+
unless member[:uuid].nil?
|
89
|
+
uuid_metadata = Hash.new
|
90
|
+
member[:uuid].each{ |k,v| uuid_metadata[k.to_sym] = v }
|
91
|
+
uuid_metadata[:updated] = Date._parse(uuid_metadata[:updated]) unless uuid_metadata[:updated].nil?
|
92
|
+
member[:uuid] = uuid_metadata
|
93
|
+
end
|
94
|
+
member[:updated] = Date._parse(member[:updated]) unless member[:updated].nil?
|
95
|
+
|
96
|
+
member
|
97
|
+
}
|
98
|
+
|
84
99
|
Pubnub::Envelope.new(
|
85
100
|
event: @event,
|
86
101
|
event_options: @given_options,
|
@@ -91,7 +106,12 @@ module Pubnub
|
|
91
106
|
operation: current_operation,
|
92
107
|
client_request: req_res_objects[:request],
|
93
108
|
server_response: req_res_objects[:response],
|
94
|
-
data:
|
109
|
+
data: {
|
110
|
+
members: members,
|
111
|
+
totalCount: parsed_response['totalCount'],
|
112
|
+
next: parsed_response['next'],
|
113
|
+
prev: parsed_response['prev']
|
114
|
+
}
|
95
115
|
},
|
96
116
|
|
97
117
|
status: {
|
@@ -3,13 +3,14 @@ module Pubnub
|
|
3
3
|
# Push related event
|
4
4
|
class RemoveChannelsFromPush < SingleEvent
|
5
5
|
include Concurrent::Async
|
6
|
-
include Pubnub::Validator::
|
6
|
+
include Pubnub::Validator::RemoveChannelsFromPush
|
7
7
|
|
8
8
|
def initialize(options, app)
|
9
|
-
super
|
10
9
|
@event = current_operation
|
11
|
-
@
|
12
|
-
|
10
|
+
@telemetry_name = :l_push
|
11
|
+
super
|
12
|
+
# `environment` should
|
13
|
+
@environment ||= 'development' if @push_gateway.eql? 'apns2'
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
@@ -25,19 +26,33 @@ module Pubnub
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def path
|
28
|
-
'
|
29
|
-
'
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
if @push_gateway.eql? 'apns2'
|
30
|
+
'/' + [
|
31
|
+
'v2',
|
32
|
+
'push',
|
33
|
+
'sub-key',
|
34
|
+
@subscribe_key,
|
35
|
+
'devices-apns2',
|
36
|
+
@push_token
|
37
|
+
].join('/')
|
38
|
+
else
|
39
|
+
'/' + [
|
40
|
+
'v1',
|
41
|
+
'push',
|
42
|
+
'sub-key',
|
43
|
+
@subscribe_key,
|
44
|
+
'devices',
|
45
|
+
@push_token
|
46
|
+
].join('/')
|
47
|
+
end
|
36
48
|
end
|
37
49
|
|
38
50
|
def parameters(*_args)
|
39
51
|
params = super
|
40
|
-
params.
|
52
|
+
params[:remove] = Formatter.channels_for_url(@channel, false)
|
53
|
+
params[:type] = @push_gateway unless @push_gateway.eql? 'apns2'
|
54
|
+
params[:environment] = @environment if @push_gateway.eql? 'apns2'
|
55
|
+
params[:topic] = @topic if @push_gateway.eql? 'apns2'
|
41
56
|
params
|
42
57
|
end
|
43
58
|
|
@@ -48,6 +63,7 @@ module Pubnub
|
|
48
63
|
timetoken: nil,
|
49
64
|
status: {
|
50
65
|
code: req_res_objects[:response].code,
|
66
|
+
operation: current_operation,
|
51
67
|
client_request: req_res_objects[:request],
|
52
68
|
server_response: req_res_objects[:response],
|
53
69
|
|