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
@@ -0,0 +1,44 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for CreateSpace event
|
8
|
+
module CreateSpace
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_data!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_data!
|
20
|
+
data = @data
|
21
|
+
|
22
|
+
if data.nil?
|
23
|
+
raise(
|
24
|
+
ArgumentError.new(
|
25
|
+
object: self,
|
26
|
+
message: 'data: No data supplied.'
|
27
|
+
),
|
28
|
+
'data: No data supplied.'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
return unless !data[:id] || !data[:name]
|
33
|
+
|
34
|
+
raise(
|
35
|
+
ArgumentError.new(
|
36
|
+
object: self,
|
37
|
+
message: 'data: Space\'s id or name missing.'
|
38
|
+
),
|
39
|
+
'data: Space\'s id or name missing.'
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for CreateUser event
|
8
|
+
module CreateUser
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_data!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_data!
|
20
|
+
data = @data
|
21
|
+
|
22
|
+
if data.nil?
|
23
|
+
raise(
|
24
|
+
ArgumentError.new(
|
25
|
+
object: self,
|
26
|
+
message: 'data: No data supplied.'
|
27
|
+
),
|
28
|
+
'data: No data supplied.'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
return unless !data[:id] || !data[:name]
|
33
|
+
|
34
|
+
raise(
|
35
|
+
ArgumentError.new(
|
36
|
+
object: self,
|
37
|
+
message: 'data: Space\'s id or name missing.'
|
38
|
+
),
|
39
|
+
'data: Space\'s id or name missing.'
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for DeleteSpace event
|
8
|
+
module DeleteSpace
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_space!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_space!
|
20
|
+
return unless @space_id.nil?
|
21
|
+
|
22
|
+
raise(
|
23
|
+
ArgumentError.new(
|
24
|
+
object: self,
|
25
|
+
message: 'data: Provide space_id.'
|
26
|
+
),
|
27
|
+
'data: Provide space_id.'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for DeleteUser event
|
8
|
+
module DeleteUser
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_user!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_user!
|
20
|
+
return unless @user_id.nil?
|
21
|
+
|
22
|
+
raise(
|
23
|
+
ArgumentError.new(
|
24
|
+
object: self,
|
25
|
+
message: 'data: Provide user_id.'
|
26
|
+
),
|
27
|
+
'data: Provide user_id.'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for GetMembers event
|
8
|
+
module GetMembers
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_space!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_space!
|
20
|
+
return unless @space_id.nil?
|
21
|
+
|
22
|
+
raise(
|
23
|
+
ArgumentError.new(
|
24
|
+
object: self,
|
25
|
+
message: 'data: Provide space_id.'
|
26
|
+
),
|
27
|
+
'data: Provide space_id.'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for GetSpace event
|
8
|
+
module GetSpace
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_space!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_space!
|
20
|
+
return unless @space_id.nil?
|
21
|
+
|
22
|
+
raise(
|
23
|
+
ArgumentError.new(
|
24
|
+
object: self,
|
25
|
+
message: 'data: Provide space_id.'
|
26
|
+
),
|
27
|
+
'data: Provide space_id.'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for GetSpaceMemberships event
|
8
|
+
module GetSpaceMemberships
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_user!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_user!
|
20
|
+
return unless @user_id.nil?
|
21
|
+
|
22
|
+
raise(
|
23
|
+
ArgumentError.new(
|
24
|
+
object: self,
|
25
|
+
message: 'data: Provide user_id.'
|
26
|
+
),
|
27
|
+
'data: Provide user_id.'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for GetSpaces event
|
8
|
+
module GetSpaces
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for GetUser event
|
8
|
+
module GetUser
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_user!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_user!
|
20
|
+
return unless @user_id.nil?
|
21
|
+
|
22
|
+
raise(
|
23
|
+
ArgumentError.new(
|
24
|
+
object: self,
|
25
|
+
message: 'data: Provide user_id.'
|
26
|
+
),
|
27
|
+
'data: Provide user_id.'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for GetUsers event
|
8
|
+
module GetUsers
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for ManageMembers event
|
8
|
+
module ManageMembers
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_space!
|
15
|
+
validate_data!
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def validate_space!
|
21
|
+
return unless @space_id.nil?
|
22
|
+
|
23
|
+
raise(
|
24
|
+
ArgumentError.new(
|
25
|
+
object: self,
|
26
|
+
message: 'data: Provide space_id.'
|
27
|
+
),
|
28
|
+
'data: Provide space_id.'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate_data!
|
33
|
+
return unless @data.nil?
|
34
|
+
|
35
|
+
raise(
|
36
|
+
ArgumentError.new(
|
37
|
+
object: self,
|
38
|
+
message: 'data: No data supplied.'
|
39
|
+
),
|
40
|
+
'data: No data supplied.'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for ManageMemberships event
|
8
|
+
module ManageMemberships
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_user!
|
15
|
+
validate_data!
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def validate_user!
|
21
|
+
return unless @user_id.nil?
|
22
|
+
|
23
|
+
raise(
|
24
|
+
ArgumentError.new(
|
25
|
+
object: self,
|
26
|
+
message: 'data: Provide user_id.'
|
27
|
+
),
|
28
|
+
'data: Provide user_id.'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate_data!
|
33
|
+
return unless @data.nil?
|
34
|
+
|
35
|
+
raise(
|
36
|
+
ArgumentError.new(
|
37
|
+
object: self,
|
38
|
+
message: 'data: No data supplied.'
|
39
|
+
),
|
40
|
+
'data: No data supplied.'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for UpdateSpace event
|
8
|
+
module UpdateSpace
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_space!
|
15
|
+
validate_data!
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def validate_space!
|
21
|
+
return unless @space_id.nil?
|
22
|
+
|
23
|
+
raise(
|
24
|
+
ArgumentError.new(
|
25
|
+
object: self,
|
26
|
+
message: 'data: Provide space_id.'
|
27
|
+
),
|
28
|
+
'data: Provide space_id.'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate_data!
|
33
|
+
return unless @data.nil?
|
34
|
+
|
35
|
+
raise(
|
36
|
+
ArgumentError.new(
|
37
|
+
object: self,
|
38
|
+
message: 'data: No data supplied.'
|
39
|
+
),
|
40
|
+
'data: No data supplied.'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|