pubnub 4.1.6 → 4.2.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 +40 -6
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/lib/events/get_users.yml +40 -0
- data/lib/pubnub/client.rb +14 -0
- data/lib/pubnub/client/events.rb +3 -1
- data/lib/pubnub/constants.rb +18 -1
- data/lib/pubnub/event.rb +12 -4
- data/lib/pubnub/events/create_space.rb +84 -0
- data/lib/pubnub/events/create_user.rb +84 -0
- data/lib/pubnub/events/delete_space.rb +78 -0
- data/lib/pubnub/events/delete_user.rb +78 -0
- data/lib/pubnub/events/get_members.rb +93 -0
- data/lib/pubnub/events/get_space.rb +74 -0
- data/lib/pubnub/events/get_space_memberships.rb +93 -0
- data/lib/pubnub/events/get_spaces.rb +90 -0
- data/lib/pubnub/events/get_user.rb +74 -0
- data/lib/pubnub/events/get_users.rb +90 -0
- data/lib/pubnub/events/manage_members.rb +105 -0
- data/lib/pubnub/events/manage_memberships.rb +105 -0
- data/lib/pubnub/events/update_space.rb +86 -0
- data/lib/pubnub/events/update_user.rb +86 -0
- data/lib/pubnub/validators/create_space.rb +44 -0
- data/lib/pubnub/validators/create_user.rb +44 -0
- data/lib/pubnub/validators/delete_space.rb +32 -0
- data/lib/pubnub/validators/delete_user.rb +32 -0
- data/lib/pubnub/validators/get_members.rb +32 -0
- data/lib/pubnub/validators/get_space.rb +32 -0
- data/lib/pubnub/validators/get_space_memberships.rb +32 -0
- data/lib/pubnub/validators/get_spaces.rb +16 -0
- data/lib/pubnub/validators/get_user.rb +32 -0
- data/lib/pubnub/validators/get_users.rb +16 -0
- data/lib/pubnub/validators/manage_members.rb +45 -0
- data/lib/pubnub/validators/manage_memberships.rb +45 -0
- data/lib/pubnub/validators/update_space.rb +45 -0
- data/lib/pubnub/validators/update_user.rb +45 -0
- data/lib/pubnub/version.rb +1 -1
- data/spec/lib/events/membership_spec.rb +69 -0
- data/spec/lib/events/space_spec.rb +75 -0
- data/spec/lib/events/user_spec.rb +75 -0
- metadata +37 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c25c64114536e1291cee9e54eda326abe3a57df11045d1a3b8ca366f3a58ae1
|
4
|
+
data.tar.gz: 83eed4a95f664d986b80710f8ad3d48131648f479ffa7d62a1f3a8dc8beca963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2945b9f4c19a4ed2427bd1cab5a983b9968670efa9becba45dd3be6cf8945a55feea753be973dbd141ab253687cd734cab4b522f7993a7f4032d6a8ec7dc1d4a
|
7
|
+
data.tar.gz: c6d198937f88306474e57ff39c2db525db12619d7ea2072d7b1262be4b9922014f66d3dcd8f29a60c5a28c593cfc15906cf0317c27343064f44797a27794910f
|
data/.pubnub.yml
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
---
|
2
|
-
version: "4.
|
2
|
+
version: "4.2.0"
|
3
3
|
changelog:
|
4
|
-
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
-
|
5
|
+
changes:
|
6
|
+
-
|
7
|
+
text: "Added objects feature"
|
8
|
+
type: feature
|
9
|
+
date: 11-10-2019
|
10
|
+
version: "4.2.0"
|
11
|
+
-
|
12
|
+
changes:
|
13
|
+
-
|
14
|
+
text: "Added signal feature"
|
15
|
+
type: feature
|
16
|
+
date: 21-8-2019
|
17
|
+
version: "4.1.6"
|
9
18
|
-
|
10
19
|
changes:
|
11
20
|
-
|
@@ -300,8 +309,33 @@ features:
|
|
300
309
|
- SUBSCRIBE-WITH-TIMETOKEN
|
301
310
|
- SUBSCRIBE-WILDCARD
|
302
311
|
- SUBSCRIBE-FILTER-EXPRESSION
|
312
|
+
- SUBSCRIBE-SIGNAL-LISTENER
|
313
|
+
- SUBSCRIBE-MEMBERSHIP-LISTENER
|
314
|
+
- SUBSCRIBE-SPACE-LISTENER
|
315
|
+
- SUBSCRIBE-USER-LISTENER
|
303
316
|
signal:
|
304
317
|
- SIGNAL-SEND
|
318
|
+
objects:
|
319
|
+
- OBJECTS-GET-USERS
|
320
|
+
- OBJECTS-GET-USER
|
321
|
+
- OBJECTS-CREATE-USER
|
322
|
+
- OBJECTS-UPDATE-USER
|
323
|
+
- OBJECTS-DELETE-USER
|
324
|
+
- OBJECTS-GET-SPACES
|
325
|
+
- OBJECTS-CREATE-SPACE
|
326
|
+
- OBJECTS-GET-SPACE
|
327
|
+
- OBJECTS-UPDATE-SPACE
|
328
|
+
- OBJECTS-DELETE-SPACE
|
329
|
+
- OBJECTS-GET-MEMBERSHIPS
|
330
|
+
- OBJECTS-MANAGE-MEMBERSHIPS
|
331
|
+
- OBJECTS-GET-MEMBERS
|
332
|
+
- OBJECTS-MANAGE-MEMBERS
|
333
|
+
- OBJECTS-JOIN-SPACES
|
334
|
+
- OBJECTS-UPDATE-MEMBERSHIPS
|
335
|
+
- OBJECTS-LEAVE-SPACES
|
336
|
+
- OBJECTS-ADD-MEMBERS
|
337
|
+
- OBJECTS-REMOVE-MEMBERS
|
338
|
+
- OBJECTS-UPDATE-MEMBERS
|
305
339
|
time:
|
306
340
|
- TIME-TIME
|
307
341
|
name: ruby
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.2.0
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://ps.pndsn.com/v1/objects/demo/users?auth=ruby-test-auth&include=custom&limit=5&pnsdk=PubNub-Ruby/4.2.0&uuid=ruby-test-uuid
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- HTTPClient/1.0 (2.8.3, ruby 2.6.3 (2019-04-16))
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
Date:
|
15
|
+
- Mon, 14 Oct 2019 13:26:38 GMT
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Mon, 14 Oct 2019 13:26:39 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/json
|
25
|
+
Content-Length:
|
26
|
+
- '1140'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Vary:
|
30
|
+
- Accept-Encoding
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
Access-Control-Allow-Credentials:
|
34
|
+
- 'true'
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"status":200,"data":[{"id":"UJNPRWCKNI","name":"VBSHVLMPEO","externalId":null,"profileUrl":null,"email":null,"custom":null,"created":"2019-08-16T08:12:02.242563Z","updated":"2019-08-16T08:12:02.242563Z","eTag":"AaeFrJLq79bxMg"},{"id":"YAJNBVKTTY","name":"SZRNRVXLGS","externalId":null,"profileUrl":null,"email":null,"custom":null,"created":"2019-08-16T08:13:26.571666Z","updated":"2019-08-16T08:13:26.571666Z","eTag":"AZG6vojJlPjuvwE"},{"id":"QTIVDQJAOJ","name":"XMRZLEINKB","externalId":null,"profileUrl":null,"email":null,"custom":null,"created":"2019-08-16T08:51:20.763757Z","updated":"2019-08-16T08:51:20.763757Z","eTag":"AcHMvZj9rpTj/wE"},{"id":"SAHHGSCVBO","name":"LRXSBWCRND","externalId":null,"profileUrl":null,"email":null,"custom":{"text":"CGJYKWBJWS","uncd":"=--+=!=="},"created":"2019-08-16T08:55:18.96962Z","updated":"2019-08-16T08:55:18.96962Z","eTag":"AeWkrM7ducOORA"},{"id":"SRMNJAHHNT","name":"XNQAYAJVQE","externalId":null,"profileUrl":null,"email":null,"custom":{"text":"TQONNXSYTR","uncd":"!!++!!-+"},"created":"2019-08-16T08:55:54.795609Z","updated":"2019-08-16T08:55:54.795609Z","eTag":"Af+0/7Gt6oKBNw"}],"next":"NQ"}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 14 Oct 2019 13:26:38 GMT
|
40
|
+
recorded_with: VCR 5.0.0
|
data/lib/pubnub/client.rb
CHANGED
@@ -50,6 +50,20 @@ require 'pubnub/validators/delete'
|
|
50
50
|
require 'pubnub/validators/message_counts'
|
51
51
|
require 'pubnub/validators/push'
|
52
52
|
require 'pubnub/validators/signal'
|
53
|
+
require 'pubnub/validators/create_user'
|
54
|
+
require 'pubnub/validators/create_space'
|
55
|
+
require 'pubnub/validators/delete_user'
|
56
|
+
require 'pubnub/validators/delete_space'
|
57
|
+
require 'pubnub/validators/get_user'
|
58
|
+
require 'pubnub/validators/get_users'
|
59
|
+
require 'pubnub/validators/get_space'
|
60
|
+
require 'pubnub/validators/get_spaces'
|
61
|
+
require 'pubnub/validators/update_user'
|
62
|
+
require 'pubnub/validators/update_space'
|
63
|
+
require 'pubnub/validators/get_members'
|
64
|
+
require 'pubnub/validators/get_space_memberships'
|
65
|
+
require 'pubnub/validators/manage_members'
|
66
|
+
require 'pubnub/validators/manage_memberships'
|
53
67
|
|
54
68
|
Dir[File.join(File.dirname(__dir__), 'pubnub', 'events', '*.rb')].each do |file|
|
55
69
|
require file
|
data/lib/pubnub/client/events.rb
CHANGED
@@ -6,7 +6,9 @@ module Pubnub
|
|
6
6
|
module Events
|
7
7
|
EVENTS = %w[publish subscribe presence leave history here_now audit grant delete_messages
|
8
8
|
revoke time heartbeat where_now set_state state channel_registration message_counts signal
|
9
|
-
add_channels_to_push list_push_provisions remove_channels_from_push remove_device_from_push
|
9
|
+
add_channels_to_push list_push_provisions remove_channels_from_push remove_device_from_push
|
10
|
+
create_user create_space delete_user delete_space get_user get_users get_space get_spaces
|
11
|
+
update_user update_space get_members get_space_memberships manage_members manage_memberships].freeze
|
10
12
|
|
11
13
|
EVENTS.each do |event_name|
|
12
14
|
define_method event_name do |options = {}, &block|
|
data/lib/pubnub/constants.rb
CHANGED
@@ -66,6 +66,20 @@ module Pubnub
|
|
66
66
|
OPERATION_REMOVE_CHANNELS_FROM_PUSH = :remove_channels_from_push
|
67
67
|
OPERATION_REMOVE_DEVICE_FROM_PUSH = :remove_device_from_push
|
68
68
|
OPERATION_SIGNAL = :signal
|
69
|
+
OPERATION_CREATE_USER = :create_user
|
70
|
+
OPERATION_GET_USER = :get_user
|
71
|
+
OPERATION_GET_USERS = :get_users
|
72
|
+
OPERATION_UPDATE_USER = :update_user
|
73
|
+
OPERATION_DELETE_USER = :delete_user
|
74
|
+
OPERATION_CREATE_SPACE = :create_space
|
75
|
+
OPERATION_GET_SPACE = :get_space
|
76
|
+
OPERATION_GET_SPACES = :get_spaces
|
77
|
+
OPERATION_UPDATE_SPACE = :update_space
|
78
|
+
OPERATION_DELETE_SPACE = :delete_space
|
79
|
+
OPERATION_GET_MEMBERS = :get_members
|
80
|
+
OPERATION_MANAGE_MEMBERS = :manage_members
|
81
|
+
OPERATION_GET_SPACE_MEMBERSHIPS = :get_space_memberships
|
82
|
+
OPERATION_MANAGE_MEMBERSHIPS = :manage_memberships
|
69
83
|
|
70
84
|
OPERATIONS = [
|
71
85
|
OPERATION_SUBSCRIBE, OPERATION_HEARTBEAT, OPERATION_PRESENCE, OPERATION_TIME, OPERATION_HISTORY,
|
@@ -73,7 +87,10 @@ module Pubnub
|
|
73
87
|
OPERATION_LIST_ALL_CHANNELS_IN_CHANNEL_GROUP, OPERATION_CHANNEL_GROUP_ADD, OPERATION_CHANNEL_GROUP_REMOVE,
|
74
88
|
OPERATION_AUDIT, OPERATION_GRANT, OPERATION_REVOKE, OPERATION_WHERE_NOW, OPERATION_MESSAGE_COUNTS,
|
75
89
|
OPERATION_ADD_CHANNELS_TO_PUSH, OPERATION_LIST_PUSH_PROVISIONS, OPERATION_REMOVE_CHANNELS_FROM_PUSH,
|
76
|
-
OPERATION_REMOVE_DEVICE_FROM_PUSH, OPERATION_SIGNAL
|
90
|
+
OPERATION_REMOVE_DEVICE_FROM_PUSH, OPERATION_SIGNAL, OPERATION_CREATE_USER, OPERATION_GET_USER,
|
91
|
+
OPERATION_GET_USERS, OPERATION_UPDATE_USER, OPERATION_DELETE_USER, OPERATION_CREATE_SPACE,
|
92
|
+
OPERATION_GET_SPACE, OPERATION_GET_SPACES, OPERATION_UPDATE_SPACE, OPERATION_DELETE_SPACE,
|
93
|
+
OPERATION_GET_MEMBERS, OPERATION_MANAGE_MEMBERS, OPERATION_GET_SPACE_MEMBERSHIPS, OPERATION_MANAGE_MEMBERSHIPS
|
77
94
|
].freeze
|
78
95
|
|
79
96
|
# Announcements
|
data/lib/pubnub/event.rb
CHANGED
@@ -50,12 +50,20 @@ module Pubnub
|
|
50
50
|
Pubnub.logger.debug('Pubnub::Event') { '#send_request got sender' }
|
51
51
|
|
52
52
|
telemetry_time_start = ::Time.now.to_f
|
53
|
-
response =
|
53
|
+
response = case @event
|
54
|
+
when Pubnub::Constants::OPERATION_DELETE, Pubnub::Constants::OPERATION_DELETE_SPACE, Pubnub::Constants::OPERATION_DELETE_USER
|
54
55
|
sender.delete(uri.to_s)
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
when Pubnub::Constants::OPERATION_MANAGE_MEMBERS, Pubnub::Constants::OPERATION_MANAGE_MEMBERSHIPS,
|
57
|
+
Pubnub::Constants::OPERATION_UPDATE_SPACE, Pubnub::Constants::OPERATION_UPDATE_USER
|
58
|
+
sender.patch(uri.to_s, body: compressed_body)
|
59
|
+
when Pubnub::Constants::OPERATION_CREATE_USER, Pubnub::Constants::OPERATION_CREATE_SPACE
|
58
60
|
sender.post(uri.to_s, body: compressed_body)
|
61
|
+
else
|
62
|
+
if compressed_body.empty?
|
63
|
+
sender.get(uri.to_s)
|
64
|
+
else
|
65
|
+
sender.post(uri.to_s, body: compressed_body)
|
66
|
+
end
|
59
67
|
end
|
60
68
|
|
61
69
|
begin
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Holds CreateSpace functionality
|
6
|
+
class CreateSpace < SingleEvent
|
7
|
+
include Concurrent::Async
|
8
|
+
include Pubnub::Validator::CreateSpace
|
9
|
+
|
10
|
+
def initialize(options, app)
|
11
|
+
@event = :create_space
|
12
|
+
@telemetry_name = :l_obj
|
13
|
+
@data = options[:data]
|
14
|
+
@include = options[:include]
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def fire
|
19
|
+
Pubnub.logger.debug('Pubnub::CreateSpace') { "Fired event #{self.class}" }
|
20
|
+
|
21
|
+
body = Formatter.format_message(@data, @cipher_key, false)
|
22
|
+
response = send_request(body)
|
23
|
+
|
24
|
+
envelopes = fire_callbacks(handle(response, uri))
|
25
|
+
finalize_event(envelopes)
|
26
|
+
envelopes
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def current_operation
|
32
|
+
Pubnub::Constants::OPERATION_CREATE_SPACE
|
33
|
+
end
|
34
|
+
|
35
|
+
def parameters(*_args)
|
36
|
+
parameters = super
|
37
|
+
parameters[:include] = @include if @include
|
38
|
+
parameters
|
39
|
+
end
|
40
|
+
|
41
|
+
def path
|
42
|
+
'/' + [
|
43
|
+
'v1',
|
44
|
+
'objects',
|
45
|
+
@subscribe_key,
|
46
|
+
'spaces'
|
47
|
+
].join('/')
|
48
|
+
end
|
49
|
+
|
50
|
+
def valid_envelope(parsed_response, req_res_objects)
|
51
|
+
Pubnub::Envelope.new(
|
52
|
+
event: @event,
|
53
|
+
event_options: @given_options,
|
54
|
+
timetoken: nil,
|
55
|
+
|
56
|
+
result: {
|
57
|
+
code: req_res_objects[:response].code,
|
58
|
+
operation: Pubnub::Constants::OPERATION_CREATE_SPACE,
|
59
|
+
client_request: req_res_objects[:request],
|
60
|
+
server_response: req_res_objects[:response],
|
61
|
+
data: parsed_response
|
62
|
+
},
|
63
|
+
|
64
|
+
status: {
|
65
|
+
code: req_res_objects[:response].code,
|
66
|
+
operation: Pubnub::Constants::OPERATION_CREATE_SPACE,
|
67
|
+
client_request: req_res_objects[:request],
|
68
|
+
server_response: req_res_objects[:response],
|
69
|
+
data: nil,
|
70
|
+
category: Pubnub::Constants::STATUS_ACK,
|
71
|
+
error: false,
|
72
|
+
auto_retried: false,
|
73
|
+
|
74
|
+
current_timetoken: nil,
|
75
|
+
last_timetoken: nil,
|
76
|
+
subscribed_channels: nil,
|
77
|
+
subscribed_channel_groups: nil,
|
78
|
+
|
79
|
+
config: get_config
|
80
|
+
}
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Holds CreateUser functionality
|
6
|
+
class CreateUser < SingleEvent
|
7
|
+
include Concurrent::Async
|
8
|
+
include Pubnub::Validator::CreateUser
|
9
|
+
|
10
|
+
def initialize(options, app)
|
11
|
+
@event = :create_user
|
12
|
+
@telemetry_name = :l_obj
|
13
|
+
@data = options[:data]
|
14
|
+
@include = options[:include]
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def fire
|
19
|
+
Pubnub.logger.debug('Pubnub::CreateUser') { "Fired event #{self.class}" }
|
20
|
+
|
21
|
+
body = Formatter.format_message(@data, @cipher_key, false)
|
22
|
+
response = send_request(body)
|
23
|
+
|
24
|
+
envelopes = fire_callbacks(handle(response, uri))
|
25
|
+
finalize_event(envelopes)
|
26
|
+
envelopes
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def current_operation
|
32
|
+
Pubnub::Constants::OPERATION_CREATE_USER
|
33
|
+
end
|
34
|
+
|
35
|
+
def parameters(*_args)
|
36
|
+
parameters = super
|
37
|
+
parameters[:include] = @include if @include
|
38
|
+
parameters
|
39
|
+
end
|
40
|
+
|
41
|
+
def path
|
42
|
+
'/' + [
|
43
|
+
'v1',
|
44
|
+
'objects',
|
45
|
+
@subscribe_key,
|
46
|
+
'users'
|
47
|
+
].join('/')
|
48
|
+
end
|
49
|
+
|
50
|
+
def valid_envelope(parsed_response, req_res_objects)
|
51
|
+
Pubnub::Envelope.new(
|
52
|
+
event: @event,
|
53
|
+
event_options: @given_options,
|
54
|
+
timetoken: nil,
|
55
|
+
|
56
|
+
result: {
|
57
|
+
code: req_res_objects[:response].code,
|
58
|
+
operation: Pubnub::Constants::OPERATION_CREATE_USER,
|
59
|
+
client_request: req_res_objects[:request],
|
60
|
+
server_response: req_res_objects[:response],
|
61
|
+
data: parsed_response
|
62
|
+
},
|
63
|
+
|
64
|
+
status: {
|
65
|
+
code: req_res_objects[:response].code,
|
66
|
+
operation: Pubnub::Constants::OPERATION_CREATE_USER,
|
67
|
+
client_request: req_res_objects[:request],
|
68
|
+
server_response: req_res_objects[:response],
|
69
|
+
data: nil,
|
70
|
+
category: Pubnub::Constants::STATUS_ACK,
|
71
|
+
error: false,
|
72
|
+
auto_retried: false,
|
73
|
+
|
74
|
+
current_timetoken: nil,
|
75
|
+
last_timetoken: nil,
|
76
|
+
subscribed_channels: nil,
|
77
|
+
subscribed_channel_groups: nil,
|
78
|
+
|
79
|
+
config: get_config
|
80
|
+
}
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Holds DeleteSpace functionality
|
6
|
+
class DeleteSpace < SingleEvent
|
7
|
+
include Concurrent::Async
|
8
|
+
include Pubnub::Validator::DeleteSpace
|
9
|
+
|
10
|
+
def initialize(options, app)
|
11
|
+
@event = :delete_space
|
12
|
+
@telemetry_name = :l_obj
|
13
|
+
@space_id = options[:space_id]
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def fire
|
18
|
+
Pubnub.logger.debug('Pubnub::DeleteSpace') { "Fired event #{self.class}" }
|
19
|
+
|
20
|
+
body = Formatter.format_message(@data, @cipher_key, false)
|
21
|
+
response = send_request(body)
|
22
|
+
|
23
|
+
envelopes = fire_callbacks(handle(response, uri))
|
24
|
+
finalize_event(envelopes)
|
25
|
+
envelopes
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def current_operation
|
31
|
+
Pubnub::Constants::OPERATION_DELETE_SPACE
|
32
|
+
end
|
33
|
+
|
34
|
+
def path
|
35
|
+
'/' + [
|
36
|
+
'v1',
|
37
|
+
'objects',
|
38
|
+
@subscribe_key,
|
39
|
+
'spaces',
|
40
|
+
@space_id
|
41
|
+
].join('/')
|
42
|
+
end
|
43
|
+
|
44
|
+
def valid_envelope(parsed_response, req_res_objects)
|
45
|
+
Pubnub::Envelope.new(
|
46
|
+
event: @event,
|
47
|
+
event_options: @given_options,
|
48
|
+
timetoken: nil,
|
49
|
+
|
50
|
+
result: {
|
51
|
+
code: req_res_objects[:response].code,
|
52
|
+
operation: Pubnub::Constants::OPERATION_DELETE_SPACE,
|
53
|
+
client_request: req_res_objects[:request],
|
54
|
+
server_response: req_res_objects[:response],
|
55
|
+
data: parsed_response
|
56
|
+
},
|
57
|
+
|
58
|
+
status: {
|
59
|
+
code: req_res_objects[:response].code,
|
60
|
+
operation: Pubnub::Constants::OPERATION_DELETE_SPACE,
|
61
|
+
client_request: req_res_objects[:request],
|
62
|
+
server_response: req_res_objects[:response],
|
63
|
+
data: nil,
|
64
|
+
category: Pubnub::Constants::STATUS_ACK,
|
65
|
+
error: false,
|
66
|
+
auto_retried: false,
|
67
|
+
|
68
|
+
current_timetoken: nil,
|
69
|
+
last_timetoken: nil,
|
70
|
+
subscribed_channels: nil,
|
71
|
+
subscribed_channel_groups: nil,
|
72
|
+
|
73
|
+
config: get_config
|
74
|
+
}
|
75
|
+
)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|