pubnub 4.3.0 → 4.4.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.

Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.pubnub.yml +32 -24
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/fixtures/vcr_cassettes/examples/grant/1913.yml +1 -1
  8. data/fixtures/vcr_cassettes/examples/grant/1945.yml +355 -4
  9. data/fixtures/vcr_cassettes/lib/events/get_all_channels_metadata.yml +39 -0
  10. data/fixtures/vcr_cassettes/lib/events/get_all_uuid_metadata.yml +76 -0
  11. data/fixtures/vcr_cassettes/lib/events/{get_space_memberships.yml → get_channel_members.yml} +5 -6
  12. data/fixtures/vcr_cassettes/lib/events/get_channel_metadata.yml +37 -0
  13. data/fixtures/vcr_cassettes/lib/events/{get_members.yml → get_memberships.yml} +10 -11
  14. data/fixtures/vcr_cassettes/lib/events/get_uuid_metadata.yml +76 -0
  15. data/fixtures/vcr_cassettes/lib/events/grant-error.yml +2 -2
  16. data/fixtures/vcr_cassettes/lib/events/grant.yml +10 -11
  17. data/fixtures/vcr_cassettes/lib/events/remove_channel_members.yml +78 -0
  18. data/fixtures/vcr_cassettes/lib/events/{delete_space.yml → remove_channel_metadata.yml} +5 -6
  19. data/fixtures/vcr_cassettes/lib/events/{manage_memberships_remove.yml → remove_memberships.yml} +8 -9
  20. data/fixtures/vcr_cassettes/lib/events/remove_uuid_metadata.yml +76 -0
  21. data/fixtures/vcr_cassettes/lib/events/set_channel_members.yml +39 -0
  22. data/fixtures/vcr_cassettes/lib/events/set_channel_metadata.yml +39 -0
  23. data/fixtures/vcr_cassettes/lib/events/{manage_members_add.yml → set_memberships.yml} +8 -9
  24. data/fixtures/vcr_cassettes/lib/events/set_uuid_metadata.yml +78 -0
  25. data/fixtures/vcr_cassettes/lib/events/{subscribe-space-delete-async.yml → subscribe-channel-metadata-remove-sync.yml} +12 -14
  26. data/fixtures/vcr_cassettes/lib/events/subscribe-channel-metadata-set-async.yml +75 -0
  27. data/fixtures/vcr_cassettes/lib/events/{subscribe-member-remove-async.yml → subscribe-member-remove-sync.yml} +12 -14
  28. data/fixtures/vcr_cassettes/lib/events/subscribe-member-set-async.yml +75 -0
  29. data/fixtures/vcr_cassettes/lib/events/subscribe-membership-remove-async.yml +12 -14
  30. data/fixtures/vcr_cassettes/lib/events/{subscribe-user-update-async.yml → subscribe-membership-set-async.yml} +12 -14
  31. data/fixtures/vcr_cassettes/lib/events/{subscribe-user-delete-async.yml → subscribe-uuid-metadata-remove-sync.yml} +12 -14
  32. data/fixtures/vcr_cassettes/lib/events/subscribe-uuid-metadata-set-async.yml +75 -0
  33. data/lib/pubnub/client.rb +14 -14
  34. data/lib/pubnub/client/events.rb +4 -2
  35. data/lib/pubnub/constants.rb +19 -18
  36. data/lib/pubnub/event.rb +29 -15
  37. data/lib/pubnub/event/signature.rb +22 -7
  38. data/lib/pubnub/events/get_all_channels_metadata.rb +92 -0
  39. data/lib/pubnub/events/get_all_uuid_metadata.rb +92 -0
  40. data/lib/pubnub/events/get_channel_members.rb +100 -0
  41. data/lib/pubnub/events/{get_user.rb → get_channel_metadata.rb} +22 -15
  42. data/lib/pubnub/events/get_memberships.rb +100 -0
  43. data/lib/pubnub/events/{get_space.rb → get_uuid_metadata.rb} +22 -15
  44. data/lib/pubnub/events/grant.rb +9 -7
  45. data/lib/pubnub/events/remove_channel_members.rb +117 -0
  46. data/lib/pubnub/events/{delete_space.rb → remove_channel_metadata.rb} +12 -12
  47. data/lib/pubnub/events/remove_memberships.rb +117 -0
  48. data/lib/pubnub/events/{delete_user.rb → remove_uuid_metadata.rb} +12 -12
  49. data/lib/pubnub/events/set_channel_members.rb +120 -0
  50. data/lib/pubnub/events/{create_space.rb → set_channel_metadata.rb} +26 -16
  51. data/lib/pubnub/events/set_memberships.rb +120 -0
  52. data/lib/pubnub/events/{update_space.rb → set_uuid_metadata.rb} +27 -18
  53. data/lib/pubnub/pam.rb +2 -11
  54. data/lib/pubnub/subscribe_callback.rb +1 -3
  55. data/lib/pubnub/subscribe_event/formatter.rb +21 -17
  56. data/lib/pubnub/subscriber.rb +5 -6
  57. data/lib/pubnub/validators/get_all_channels_metadata.rb +29 -0
  58. data/lib/pubnub/validators/get_all_uuid_metadata.rb +29 -0
  59. data/lib/pubnub/validators/get_channel_members.rb +39 -0
  60. data/lib/pubnub/validators/get_channel_metadata.rb +39 -0
  61. data/lib/pubnub/validators/get_memberships.rb +39 -0
  62. data/lib/pubnub/validators/get_uuid_metadata.rb +39 -0
  63. data/lib/pubnub/validators/grant.rb +37 -2
  64. data/lib/pubnub/validators/remove_channel_members.rb +52 -0
  65. data/lib/pubnub/validators/remove_channel_metadata.rb +39 -0
  66. data/lib/pubnub/validators/remove_memberships.rb +52 -0
  67. data/lib/pubnub/validators/remove_uuid_metadata.rb +39 -0
  68. data/lib/pubnub/validators/set_channel_members.rb +78 -0
  69. data/lib/pubnub/validators/set_channel_metadata.rb +62 -0
  70. data/lib/pubnub/validators/set_memberships.rb +78 -0
  71. data/lib/pubnub/validators/set_uuid_metadata.rb +62 -0
  72. data/lib/pubnub/version.rb +1 -1
  73. data/spec/examples/grant_examples_spec.rb +2 -2
  74. data/spec/lib/events/channel_metadata_spec.rb +58 -0
  75. data/spec/lib/events/grant_spec.rb +3 -2
  76. data/spec/lib/events/membership_spec.rb +25 -22
  77. data/spec/lib/events/subscribe_spec.rb +58 -45
  78. data/spec/lib/events/uuid_metadata_spec.rb +56 -0
  79. data/spec/spec_helper.rb +1 -1
  80. metadata +55 -57
  81. data/fixtures/vcr_cassettes/lib/events/create_space.yml +0 -40
  82. data/fixtures/vcr_cassettes/lib/events/create_user.yml +0 -40
  83. data/fixtures/vcr_cassettes/lib/events/delete_user.yml +0 -38
  84. data/fixtures/vcr_cassettes/lib/events/get_space.yml +0 -38
  85. data/fixtures/vcr_cassettes/lib/events/get_spaces.yml +0 -40
  86. data/fixtures/vcr_cassettes/lib/events/get_user.yml +0 -38
  87. data/fixtures/vcr_cassettes/lib/events/get_users.yml +0 -40
  88. data/fixtures/vcr_cassettes/lib/events/manage_members_remove.yml +0 -83
  89. data/fixtures/vcr_cassettes/lib/events/manage_memberships_add.yml +0 -40
  90. data/fixtures/vcr_cassettes/lib/events/subscribe-member-add-async.yml +0 -77
  91. data/fixtures/vcr_cassettes/lib/events/subscribe-membership-add-async.yml +0 -77
  92. data/fixtures/vcr_cassettes/lib/events/subscribe-space-update-async.yml +0 -77
  93. data/fixtures/vcr_cassettes/lib/events/update_space.yml +0 -40
  94. data/fixtures/vcr_cassettes/lib/events/update_user.yml +0 -40
  95. data/lib/pubnub/events/create_user.rb +0 -84
  96. data/lib/pubnub/events/get_members.rb +0 -93
  97. data/lib/pubnub/events/get_space_memberships.rb +0 -93
  98. data/lib/pubnub/events/get_spaces.rb +0 -90
  99. data/lib/pubnub/events/get_users.rb +0 -90
  100. data/lib/pubnub/events/manage_members.rb +0 -105
  101. data/lib/pubnub/events/manage_memberships.rb +0 -105
  102. data/lib/pubnub/events/update_user.rb +0 -86
  103. data/lib/pubnub/validators/create_space.rb +0 -44
  104. data/lib/pubnub/validators/create_user.rb +0 -44
  105. data/lib/pubnub/validators/delete_space.rb +0 -32
  106. data/lib/pubnub/validators/delete_user.rb +0 -32
  107. data/lib/pubnub/validators/get_members.rb +0 -32
  108. data/lib/pubnub/validators/get_space.rb +0 -32
  109. data/lib/pubnub/validators/get_space_memberships.rb +0 -32
  110. data/lib/pubnub/validators/get_spaces.rb +0 -16
  111. data/lib/pubnub/validators/get_user.rb +0 -32
  112. data/lib/pubnub/validators/get_users.rb +0 -16
  113. data/lib/pubnub/validators/manage_members.rb +0 -45
  114. data/lib/pubnub/validators/manage_memberships.rb +0 -45
  115. data/lib/pubnub/validators/update_space.rb +0 -45
  116. data/lib/pubnub/validators/update_user.rb +0 -45
  117. data/spec/lib/events/space_spec.rb +0 -75
  118. data/spec/lib/events/user_spec.rb +0 -75
@@ -0,0 +1,52 @@
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 RemoveChannelMembers event
8
+ module RemoveChannelMembers
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_channel!
16
+ validate_members!
17
+ end
18
+
19
+ private
20
+
21
+ def validate_subscribe_key!
22
+ return unless @subscribe_key.nil?
23
+
24
+ raise(
25
+ ArgumentError.new(object: self, message: ':subscribe_key is required for remove channel members event.'),
26
+ ':subscribe_key is required for remove channel members event.'
27
+ )
28
+ end
29
+
30
+ def validate_channel!
31
+ return unless @channel.nil? || @channel.empty?
32
+
33
+ raise(
34
+ ArgumentError.new(object: self, message: ':channel is required for remove channel members event.'),
35
+ ':channel is required for remove channel members event.'
36
+ )
37
+ end
38
+
39
+ def validate_members!
40
+ raise(
41
+ ArgumentError.new(object: self, message: ':uuids is required for remove channel members event.'),
42
+ ':uuids is required for remove channel members event.'
43
+ ) if @uuids.nil? || @uuids.empty?
44
+
45
+ raise(
46
+ ArgumentError.new(object: self, message: ':uuids parameter for remove channel members must be Array.'),
47
+ ':uuids parameter for remove channel members must be Array.'
48
+ ) if @uuids.class != Array
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,39 @@
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 RemoveChannelMetadata event
8
+ module RemoveChannelMetadata
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_channel!
16
+ end
17
+
18
+ private
19
+
20
+ def validate_subscribe_key!
21
+ return unless @subscribe_key.nil?
22
+
23
+ raise(
24
+ ArgumentError.new(object: self, message: ':subscribe_key is required for remove channel metadata event.'),
25
+ ':subscribe_key is required for remove channel metadata event.'
26
+ )
27
+ end
28
+
29
+ def validate_channel!
30
+ return unless @channel.nil? || @channel.empty?
31
+
32
+ raise(
33
+ ArgumentError.new(object: self, message: ':channel is required for remove channel metadata event.'),
34
+ ':channel is required for remove channel metadata event.'
35
+ )
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,52 @@
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 RemoveMemberships event
8
+ module RemoveMemberships
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_uuid!
16
+ validate_memberships!
17
+ end
18
+
19
+ private
20
+
21
+ def validate_subscribe_key!
22
+ return unless @subscribe_key.nil?
23
+
24
+ raise(
25
+ ArgumentError.new(object: self, message: ':subscribe_key is required for remove memberships event.'),
26
+ ':subscribe_key is required for remove memberships event.'
27
+ )
28
+ end
29
+
30
+ def validate_uuid!
31
+ return unless @uuid.nil? || @uuid.empty?
32
+
33
+ raise(
34
+ ArgumentError.new(object: self, message: ':uuid is required for remove memberships event.'),
35
+ ':uuid is required for remove memberships event.'
36
+ )
37
+ end
38
+
39
+ def validate_memberships!
40
+ raise(
41
+ ArgumentError.new(object: self, message: ':channels is required for remove memberships event.'),
42
+ ':channels is required for remove memberships event.'
43
+ ) if @channels.nil? || @channels.empty?
44
+
45
+ raise(
46
+ ArgumentError.new(object: self, message: ':channels parameter for remove memberships must be Array.'),
47
+ ':channels parameter for remove memberships must be Array.'
48
+ ) if @channels.class != Array
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,39 @@
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 RemoveUuidMetadata event
8
+ module RemoveUuidMetadata
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_uuid!
16
+ end
17
+
18
+ private
19
+
20
+ def validate_subscribe_key!
21
+ return unless @subscribe_key.nil?
22
+
23
+ raise(
24
+ ArgumentError.new(object: self, message: ':subscribe_key is required for remove uuid metadata event.'),
25
+ ':subscribe_key is required for remove uuid metadata event.'
26
+ )
27
+ end
28
+
29
+ def validate_uuid!
30
+ return unless @uuid.nil? || @uuid.empty?
31
+
32
+ raise(
33
+ ArgumentError.new(object: self, message: ':uuid is required for remove uuid metadata event.'),
34
+ ':uuid is required for remove uuid metadata event.'
35
+ )
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,78 @@
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 SetChannelMembers event
8
+ module SetChannelMembers
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_channel!
16
+ validate_members!
17
+ end
18
+
19
+ private
20
+
21
+ def validate_subscribe_key!
22
+ return unless @subscribe_key.nil?
23
+
24
+ raise(
25
+ ArgumentError.new(object: self, message: ':subscribe_key is required for set channel members event.'),
26
+ ':subscribe_key is required for set channel members event.'
27
+ )
28
+ end
29
+
30
+ def validate_channel!
31
+ return unless @channel.nil? || @channel.empty?
32
+
33
+ raise(
34
+ ArgumentError.new(object: self, message: ':channel is required for set channel members event.'),
35
+ ':channel is required for set channel members event.'
36
+ )
37
+ end
38
+
39
+ def validate_members!
40
+ raise(
41
+ ArgumentError.new(object: self, message: ':uuids is required for set channel members event.'),
42
+ ':uuids is required for set channel members event.'
43
+ ) if @uuids.nil? || @uuids.empty?
44
+
45
+ raise(
46
+ ArgumentError.new(object: self, message: ':uuids parameter for set channel members must be Array.'),
47
+ ':uuids parameter for set channel members must be Array.'
48
+ ) if @uuids.class != Array
49
+
50
+ acceptable_values = %w[String Symbol Float Integer TrueClass FalseClass]
51
+
52
+ @uuids.each do |member|
53
+ raise(
54
+ ArgumentError.new(object: self, message: ':uuid is required for set channel members event.'),
55
+ ':uuid is required for set channel members event.'
56
+ ) if member[:uuid].nil? || member[:uuid].empty?
57
+
58
+ next if member[:custom].nil?
59
+
60
+ raise(
61
+ ArgumentError.new(object: self, message: ':custom parameter of channel member must be Hash.'),
62
+ ':custom parameter of channel member must be Hash.'
63
+ ) if member[:custom].class != Hash
64
+
65
+ # Verify that all values in member custom has expected data type.
66
+ member[:custom].each do |key, value|
67
+ unless acceptable_values.include?(value.class.to_s)
68
+ message = "Value for '#{key}' has unacceptable type (#{value.class.to_s})." \
69
+ "Only following data types allowed: #{acceptable_values.join(", ")}"
70
+
71
+ raise(ArgumentError.new(object: self, message: message), message)
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,62 @@
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 SetChannelMetadata event
8
+ module SetChannelMetadata
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_channel!
16
+ validate_metadata!
17
+ end
18
+
19
+ private
20
+
21
+ def validate_subscribe_key!
22
+ return unless @subscribe_key.nil?
23
+
24
+ raise(
25
+ ArgumentError.new(object: self, message: ':subscribe_key is required for set channel metadata event.'),
26
+ ':subscribe_key is required for set channel metadata event.'
27
+ )
28
+ end
29
+
30
+ def validate_channel!
31
+ return unless @channel.nil? || @channel.empty?
32
+
33
+ raise(
34
+ ArgumentError.new(object: self, message: ':channel is required for set channel metadata event.'),
35
+ ':channel is required for set channel metadata event.'
36
+ )
37
+ end
38
+
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?
44
+
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
49
+
50
+ known_channel_metadata_fields = %w[name description custom updated eTag]
51
+
52
+ @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(", ")}"
55
+
56
+ raise(ArgumentError.new(object: self, message: message), message)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,78 @@
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 SetMemberships event
8
+ module SetMemberships
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_uuid!
16
+ validate_memberships!
17
+ end
18
+
19
+ private
20
+
21
+ def validate_subscribe_key!
22
+ return unless @subscribe_key.nil?
23
+
24
+ raise(
25
+ ArgumentError.new(object: self, message: ':subscribe_key is required for set memberships event.'),
26
+ ':subscribe_key is required for set memberships event.'
27
+ )
28
+ end
29
+
30
+ def validate_uuid!
31
+ return unless @uuid.nil? || @uuid.empty?
32
+
33
+ raise(
34
+ ArgumentError.new(object: self, message: ':uuid is required for set memberships event.'),
35
+ ':uuid is required for set memberships event.'
36
+ )
37
+ end
38
+
39
+ def validate_memberships!
40
+ raise(
41
+ ArgumentError.new(object: self, message: ':channels is required for set memberships event.'),
42
+ ':channels is required for set memberships event.'
43
+ ) if @channels.nil? || @channels.empty?
44
+
45
+ raise(
46
+ ArgumentError.new(object: self, message: ':channels parameter for set memberships must be Array.'),
47
+ ':channels parameter for set memberships must be Array.'
48
+ ) if @channels.class != Array
49
+
50
+ acceptable_values = %w[String Symbol Float Integer TrueClass FalseClass]
51
+
52
+ @channels.each do |membership|
53
+ raise(
54
+ ArgumentError.new(object: self, message: ':channel is required for set memberships event.'),
55
+ ':channel is required for set memberships event.'
56
+ ) if membership[:channel].nil? || membership[:channel].empty?
57
+
58
+ next if membership[:custom].nil?
59
+
60
+ raise(
61
+ ArgumentError.new(object: self, message: ':custom parameter of membership must be Hash.'),
62
+ ':custom parameter of membership must be Hash.'
63
+ ) if membership[:custom].class != Hash
64
+
65
+ # Verify that all values in membership 'custom' has expected data type.
66
+ membership[:custom].each do |key, value|
67
+ unless acceptable_values.include?(value.class.to_s)
68
+ message = "Value for '#{key}' has unacceptable type (#{value.class.to_s})." \
69
+ "Only following data types allowed: #{acceptable_values.join(", ")}"
70
+
71
+ raise(ArgumentError.new(object: self, message: message), message)
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,62 @@
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 SetUuidMetadata event
8
+ module SetUuidMetadata
9
+ include CommonValidator
10
+
11
+ def validate!
12
+ return if @skip_validate
13
+
14
+ validate_subscribe_key!
15
+ validate_uuid!
16
+ validate_metadata!
17
+ end
18
+
19
+ private
20
+
21
+ def validate_subscribe_key!
22
+ return unless @subscribe_key.nil?
23
+
24
+ raise(
25
+ ArgumentError.new(object: self, message: ':subscribe_key is required for set uuid metadata event.'),
26
+ ':subscribe_key is required for set uuid metadata event.'
27
+ )
28
+ end
29
+
30
+ def validate_uuid!
31
+ return unless @uuid.nil? || @uuid.empty?
32
+
33
+ raise(
34
+ ArgumentError.new(object: self, message: ':uuid is required for set uuid metadata event.'),
35
+ ':uuid is required for set uuid metadata event.'
36
+ )
37
+ end
38
+
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?
44
+
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
49
+
50
+ known_uuid_metadata_fields = %w[name email externalId profileUrl custom updated eTag]
51
+
52
+ @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(", ")}"
55
+
56
+ raise(ArgumentError.new(object: self, message: message), message)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end