pubnub 4.1.2 → 4.1.6
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 +5 -5
- data/.pubnub.yml +23 -11
- data/.rubocop.yml +3 -1
- data/.travis.yml +3 -2
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +74 -68
- data/README.md +1 -1
- data/VERSION +1 -2
- data/fixtures/vcr_cassettes/lib/events/signal-error.yml +40 -0
- data/fixtures/vcr_cassettes/lib/events/signal.yml +40 -0
- data/lib/pubnub/client/events.rb +1 -1
- data/lib/pubnub/client.rb +1 -0
- data/lib/pubnub/constants.rb +2 -1
- data/lib/pubnub/events/add_channels_to_push.rb +3 -2
- data/lib/pubnub/events/list_push_provisions.rb +2 -2
- data/lib/pubnub/events/remove_channels_from_push.rb +3 -2
- data/lib/pubnub/events/remove_device_from_push.rb +2 -2
- data/lib/pubnub/events/signal.rb +87 -0
- data/lib/pubnub/schemas/envelope_schema.rb +54 -27
- data/lib/pubnub/subscribe_callback.rb +2 -1
- data/lib/pubnub/subscribe_event/formatter.rb +5 -2
- data/lib/pubnub/subscriber.rb +2 -0
- data/lib/pubnub/validators/push.rb +5 -5
- data/lib/pubnub/validators/signal.rb +49 -0
- data/lib/pubnub/version.rb +1 -1
- data/pubnub.gemspec +6 -5
- data/spec/examples/audit_examples_spec.rb +1 -1
- data/spec/examples/grant_examples_spec.rb +1 -1
- data/spec/examples/presence_examples_spec.rb +12 -12
- data/spec/examples/publish_with_ttl_spec.rb +2 -2
- data/spec/examples/revoke_examples_spec.rb +1 -1
- data/spec/examples/subscribe_examples_spec.rb +1988 -1988
- data/spec/lib/custom_retries_examples_spec.rb +1 -1
- data/spec/lib/events/audit_spec.rb +7 -7
- data/spec/lib/events/channel_registration_spec.rb +3 -3
- data/spec/lib/events/delete_messages_spec.rb +2 -2
- data/spec/lib/events/grant_spec.rb +6 -6
- data/spec/lib/events/heartbeat_spec.rb +2 -2
- data/spec/lib/events/here_now_spec.rb +3 -3
- data/spec/lib/events/history_spec.rb +3 -3
- data/spec/lib/events/leave_spec.rb +2 -2
- data/spec/lib/events/presence_spec.rb +5 -5
- data/spec/lib/events/publish_spec.rb +2 -2
- data/spec/lib/events/revoke_spec.rb +5 -5
- data/spec/lib/events/signal_spec.rb +39 -0
- data/spec/lib/events/state_spec.rb +3 -3
- data/spec/lib/events/subscribe_spec.rb +12 -12
- data/spec/lib/events/time_spec.rb +2 -2
- data/spec/lib/events/timeout_handling_spec.rb +1 -1
- data/spec/lib/events/where_now_spec.rb +3 -3
- data/spec/lib/signatures_spec.rb +13 -13
- data/spec/lib/ssl_error_spec.rb +1 -1
- data/spec/lib/super_admin_spec.rb +1 -1
- data/spec/spec_expectations.rb +12 -1
- metadata +20 -15
@@ -1,57 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Pubnub
|
2
4
|
module Schemas
|
3
5
|
module Envelope
|
4
|
-
DataSchema = Dry::
|
6
|
+
DataSchema = Dry::Schema.Params do
|
5
7
|
required(:message)
|
6
8
|
required(:subscribed_channel).filled(:str?)
|
7
9
|
required(:actual_channel).filled(:str?)
|
8
10
|
optional(:publish_time_object).maybe(:hash?)
|
9
11
|
optional(:message_meta_data).maybe(:hash?)
|
10
12
|
optional(:presence_event).maybe(:str?)
|
11
|
-
optional(:presence).maybe
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
optional(:presence).maybe do
|
14
|
+
hash do
|
15
|
+
optional(:uuid).filled(:str?)
|
16
|
+
optional(:timestamp).filled(:int?)
|
17
|
+
optional(:state).maybe(:hash?)
|
18
|
+
optional(:occupancy).filled(:int?)
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
19
|
-
|
23
|
+
PresenceSchema = Dry::Schema.Params do
|
24
|
+
required(:channels).maybe(:array?)
|
25
|
+
end
|
26
|
+
|
27
|
+
ConfigSchema = Dry::Schema.Params do
|
20
28
|
required(:tls).filled(:bool?)
|
21
29
|
required(:uuid).filled(:str?)
|
22
30
|
optional(:auth_key).maybe(:str?)
|
23
31
|
required(:origin).filled(:str?)
|
24
32
|
end
|
25
33
|
|
26
|
-
|
27
|
-
required(:code).filled(:int?)
|
28
|
-
required(:client_request).filled
|
29
|
-
required(:server_response).filled
|
30
|
-
optional(:data).maybe
|
34
|
+
CategorySchema = Dry::Schema.Params do
|
31
35
|
required(:category).filled
|
32
36
|
required(:error).filled(:bool?)
|
33
|
-
|
37
|
+
end
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
# The schema for status response on subscribe listener
|
40
|
+
class StatusSchema < Dry::Validation::Contract
|
41
|
+
params do
|
42
|
+
required(:code).filled(:int?)
|
43
|
+
required(:category).filled
|
44
|
+
required(:error).filled(:bool?)
|
45
|
+
required(:client_request).filled
|
46
|
+
required(:server_response).filled
|
47
|
+
required(:auto_retried).filled(:bool?)
|
39
48
|
|
40
|
-
|
49
|
+
optional(:data).maybe(:hash?)
|
50
|
+
optional(:current_timetoken).maybe(:int?)
|
51
|
+
optional(:last_timetoken).maybe(:int?)
|
52
|
+
optional(:subscribed_channels).maybe(:array?)
|
53
|
+
optional(:subscribed_channel_groups).maybe(:array?)
|
41
54
|
|
42
|
-
|
43
|
-
|
44
|
-
|
55
|
+
required(:config).hash(ConfigSchema)
|
56
|
+
end
|
57
|
+
|
58
|
+
rule(:category, :error) do
|
59
|
+
key.failure('Invalid error category') if values[:error] && Pubnub::Constants::STATUS_CATEGORY_ERRORS.include?(values[:category].to_s)
|
60
|
+
key.failure('Invalid success category') if !values[:error] && Pubnub::Constants::STATUS_CATEGORY_SUCCESSES.include?(values[:category].to_s)
|
45
61
|
end
|
46
62
|
end
|
47
63
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
64
|
+
# The schema for the publish result on a subscribe listener
|
65
|
+
class ResultSchema < Dry::Validation::Contract
|
66
|
+
params do
|
67
|
+
required(:code).filled(:int?)
|
68
|
+
required(:operation) { included_in?(Pubnub::Constants::OPERATIONS) }
|
69
|
+
required(:client_request).filled
|
70
|
+
required(:server_response).filled
|
71
|
+
|
72
|
+
optional(:data).maybe(:hash?)
|
73
|
+
end
|
53
74
|
|
54
|
-
|
75
|
+
rule(:operation, :data) do
|
76
|
+
if values[:operation] == Pubnub::Constants::OPERATION_PRESENCE
|
77
|
+
PresenceSchema.call(values[:data])
|
78
|
+
else
|
79
|
+
DataSchema.call(values[:data])
|
80
|
+
end
|
81
|
+
end
|
55
82
|
end
|
56
83
|
end
|
57
84
|
end
|
@@ -134,11 +134,11 @@ module Pubnub
|
|
134
134
|
# return if envelopes.size == 1 && envelopes.first.timetoken_update?
|
135
135
|
|
136
136
|
results_validation = envelopes.map(&:result).map do |result|
|
137
|
-
Pubnub::Schemas::Envelope::ResultSchema.call result
|
137
|
+
Pubnub::Schemas::Envelope::ResultSchema.new.call result
|
138
138
|
end
|
139
139
|
|
140
140
|
statuses_validation = envelopes.map(&:status).map do |status|
|
141
|
-
Pubnub::Schemas::Envelope::StatusSchema.call status
|
141
|
+
Pubnub::Schemas::Envelope::StatusSchema.new.call status
|
142
142
|
end
|
143
143
|
|
144
144
|
if (results_validation + statuses_validation).map(&:failure?).index(true)
|
@@ -164,6 +164,8 @@ module Pubnub
|
|
164
164
|
Pubnub::Constants::OPERATION_TIME
|
165
165
|
elsif message[:channel].to_s.index(/pnpres\z/)
|
166
166
|
Pubnub::Constants::OPERATION_PRESENCE
|
167
|
+
elsif message[:type] == 1
|
168
|
+
Pubnub::Constants::OPERATION_SIGNAL
|
167
169
|
else
|
168
170
|
Pubnub::Constants::OPERATION_SUBSCRIBE
|
169
171
|
end
|
@@ -193,6 +195,7 @@ module Pubnub
|
|
193
195
|
channel: m['c'],
|
194
196
|
subscription_match: m['b'],
|
195
197
|
payload: m['d'],
|
198
|
+
type: m['e'],
|
196
199
|
flags: m['f'],
|
197
200
|
issuing_client_id: m['i'],
|
198
201
|
subscribe_key: m['k'],
|
data/lib/pubnub/subscriber.rb
CHANGED
@@ -71,6 +71,8 @@ module Pubnub
|
|
71
71
|
case envelope.result[:operation]
|
72
72
|
when Pubnub::Constants::OPERATION_SUBSCRIBE
|
73
73
|
secure_call callbacks.callbacks[:message], envelope
|
74
|
+
when Pubnub::Constants::OPERATION_SIGNAL
|
75
|
+
secure_call callbacks.callbacks[:signal], envelope
|
74
76
|
when Pubnub::Constants::OPERATION_PRESENCE
|
75
77
|
secure_call callbacks.callbacks[:presence], envelope
|
76
78
|
else
|
@@ -6,12 +6,12 @@ module Pubnub
|
|
6
6
|
# Push related events validator
|
7
7
|
module Push
|
8
8
|
include CommonValidator
|
9
|
-
BASIC_PARAMS = %i[push_token type
|
9
|
+
BASIC_PARAMS = %i[push_token type].freeze
|
10
10
|
PARAMS_MAP = {
|
11
|
-
Pubnub::Constants::OPERATION_ADD_CHANNELS_TO_PUSH => BASIC_PARAMS + %i[add
|
11
|
+
Pubnub::Constants::OPERATION_ADD_CHANNELS_TO_PUSH => BASIC_PARAMS + %i[add],
|
12
12
|
Pubnub::Constants::OPERATION_LIST_PUSH_PROVISIONS => BASIC_PARAMS,
|
13
|
-
Pubnub::Constants::OPERATION_REMOVE_CHANNELS_FROM_PUSH => BASIC_PARAMS + %i[remove
|
14
|
-
Pubnub::Constants::OPERATION_REMOVE_DEVICE_FROM_PUSH => BASIC_PARAMS
|
13
|
+
Pubnub::Constants::OPERATION_REMOVE_CHANNELS_FROM_PUSH => BASIC_PARAMS + %i[remove],
|
14
|
+
Pubnub::Constants::OPERATION_REMOVE_DEVICE_FROM_PUSH => BASIC_PARAMS
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
def validate!
|
@@ -23,7 +23,7 @@ module Pubnub
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def validate_channel!
|
26
|
-
missing_params = required_params - @
|
26
|
+
missing_params = required_params - @given_options.keys
|
27
27
|
return if missing_params.empty?
|
28
28
|
|
29
29
|
raise(
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Toplevel Pubnub module.
|
4
|
+
module Pubnub
|
5
|
+
# Validator module that holds all validators modules
|
6
|
+
module Validator
|
7
|
+
# Validator for Signal event
|
8
|
+
module Signal
|
9
|
+
include CommonValidator
|
10
|
+
|
11
|
+
def validate!
|
12
|
+
return if @skip_validate
|
13
|
+
|
14
|
+
validate_publish_key!
|
15
|
+
validate_channel!
|
16
|
+
validate_message!
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def validate_publish_key!
|
22
|
+
return unless @publish_key.nil?
|
23
|
+
|
24
|
+
raise(
|
25
|
+
ArgumentError.new,
|
26
|
+
':publish_key is required for publish event.'
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate_channel!
|
31
|
+
return unless @channel.nil? || @channel.empty?
|
32
|
+
|
33
|
+
raise(
|
34
|
+
ArgumentError.new,
|
35
|
+
':channel is required for publish event.'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def validate_message!
|
40
|
+
return unless @message.nil?
|
41
|
+
|
42
|
+
raise(
|
43
|
+
ArgumentError.new,
|
44
|
+
':message is required for publish event.'
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/pubnub/version.rb
CHANGED
data/pubnub.gemspec
CHANGED
@@ -16,12 +16,13 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
|
18
18
|
spec.require_paths = ['lib']
|
19
|
+
spec.required_ruby_version = '>= 2.4'
|
19
20
|
|
20
|
-
spec.add_dependency 'concurrent-ruby', '~> 1.
|
21
|
-
spec.add_dependency 'concurrent-ruby-edge', '~> 0.
|
22
|
-
spec.add_dependency 'dry-validation', '~> 0
|
21
|
+
spec.add_dependency 'concurrent-ruby', '~> 1.1.5'
|
22
|
+
spec.add_dependency 'concurrent-ruby-edge', '~> 0.5.0'
|
23
|
+
spec.add_dependency 'dry-validation', '~> 1.0'
|
23
24
|
spec.add_dependency 'httpclient', '~> 2.8', '>= 2.8.3'
|
24
|
-
spec.add_dependency 'json', '>=
|
25
|
-
spec.add_dependency 'timers', '>= 4.
|
25
|
+
spec.add_dependency 'json', '>= 2.2.0', '< 3'
|
26
|
+
spec.add_dependency 'timers', '>= 4.3.0'
|
26
27
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
27
28
|
end
|
@@ -11,7 +11,7 @@ describe Pubnub::Audit do
|
|
11
11
|
@pubnub = Pubnub.new(
|
12
12
|
publish_key: "pub-a-mock-key",
|
13
13
|
subscribe_key: "sub-a-mock-key",
|
14
|
-
secret_key: "sec-
|
14
|
+
secret_key: "sec-a-mock-key",
|
15
15
|
uuid: "ruby-test-uuid-client-one",
|
16
16
|
auth_key: "ruby-test-auth-client-one",
|
17
17
|
)
|
@@ -11,7 +11,7 @@ describe Pubnub::Grant do
|
|
11
11
|
@pubnub = Pubnub.new(
|
12
12
|
publish_key: "pub-a-mock-key",
|
13
13
|
subscribe_key: "sub-a-mock-key",
|
14
|
-
secret_key: "sec-
|
14
|
+
secret_key: "sec-a-mock-key",
|
15
15
|
uuid: "ruby-test-uuid-client-one",
|
16
16
|
auth_key: "ruby-test-auth-client-one",
|
17
17
|
)
|
@@ -29,7 +29,7 @@ describe Pubnub::Presence do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
expect(envelopes[0].status[:code]).to eq(200)
|
32
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403696, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036961172863", :region_code => 1}})
|
32
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403696, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036961172863", :region_code => 1}})
|
33
33
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
34
34
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
35
35
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654036961931472)
|
@@ -54,7 +54,7 @@ describe Pubnub::Presence do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
expect(envelopes[0].status[:code]).to eq(200)
|
57
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "leave", "timestamp" => 1465403696, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036965065315", :region_code => 2}})
|
57
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "leave", "timestamp" => 1465403696, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036965065315", :region_code => 2}})
|
58
58
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
59
59
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
60
60
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654036965469160)
|
@@ -79,7 +79,7 @@ describe Pubnub::Presence do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
expect(envelopes[0].status[:code]).to eq(200)
|
82
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403698, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036986516448", :region_code => 2}})
|
82
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403698, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036986516448", :region_code => 2}})
|
83
83
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
84
84
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
85
85
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654036986900265)
|
@@ -203,7 +203,7 @@ describe Pubnub::Presence do
|
|
203
203
|
end
|
204
204
|
|
205
205
|
expect(envelopes[0].status[:code]).to eq(200)
|
206
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403699, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036996668692", :region_code => 1}})
|
206
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403699, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654036996668692", :region_code => 1}})
|
207
207
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
208
208
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
209
209
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654036997432530)
|
@@ -228,7 +228,7 @@ describe Pubnub::Presence do
|
|
228
228
|
end
|
229
229
|
|
230
230
|
expect(envelopes[0].status[:code]).to eq(200)
|
231
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => nil, :payload => {"action" => "leave", "timestamp" => 1465403700, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654037002398263", :region_code => 1}})
|
231
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => nil, :payload => {"action" => "leave", "timestamp" => 1465403700, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654037002398263", :region_code => 1}})
|
232
232
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
233
233
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
234
234
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654037003110327)
|
@@ -253,7 +253,7 @@ describe Pubnub::Presence do
|
|
253
253
|
end
|
254
254
|
|
255
255
|
expect(envelopes[0].status[:code]).to eq(200)
|
256
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403702, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654037023404890", :region_code => 1}})
|
256
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403702, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654037023404890", :region_code => 1}})
|
257
257
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
258
258
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
259
259
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654037024165554)
|
@@ -377,7 +377,7 @@ describe Pubnub::Presence do
|
|
377
377
|
end
|
378
378
|
|
379
379
|
expect(envelopes[0].status[:code]).to eq(200)
|
380
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "leave", "timestamp" => 1465403703, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654037039766378", :region_code => 2}})
|
380
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "leave", "timestamp" => 1465403703, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654037039766378", :region_code => 2}})
|
381
381
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
382
382
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
383
383
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654037040157428)
|
@@ -402,7 +402,7 @@ describe Pubnub::Presence do
|
|
402
402
|
end
|
403
403
|
|
404
404
|
expect(envelopes[0].status[:code]).to eq(200)
|
405
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465405069, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654050693824272", :region_code => 1}})
|
405
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465405069, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654050693824272", :region_code => 1}})
|
406
406
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
407
407
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
408
408
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654050694555754)
|
@@ -427,7 +427,7 @@ describe Pubnub::Presence do
|
|
427
427
|
end
|
428
428
|
|
429
429
|
expect(envelopes[0].status[:code]).to eq(200)
|
430
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403890, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038904558577", :region_code => 2}})
|
430
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => nil, :payload => {"action" => "join", "timestamp" => 1465403890, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038904558577", :region_code => 2}})
|
431
431
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
432
432
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
433
433
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654038904954461)
|
@@ -551,7 +551,7 @@ describe Pubnub::Presence do
|
|
551
551
|
end
|
552
552
|
|
553
553
|
expect(envelopes[0].status[:code]).to eq(200)
|
554
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => "demo-pnpres", :payload => {"action" => "leave", "timestamp" => 1465403891, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038913084722", :region_code => 1}})
|
554
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => "demo-pnpres", :payload => {"action" => "leave", "timestamp" => 1465403891, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038913084722", :region_code => 1}})
|
555
555
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
556
556
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
557
557
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654038913920232)
|
@@ -576,7 +576,7 @@ describe Pubnub::Presence do
|
|
576
576
|
end
|
577
577
|
|
578
578
|
expect(envelopes[0].status[:code]).to eq(200)
|
579
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => "demo.*-pnpres", :payload => {"action" => "leave", "timestamp" => 1465403892, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038929920942", :region_code => 1}})
|
579
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo.*-pnpres", :subscription_match => "demo.*-pnpres", :payload => {"action" => "leave", "timestamp" => 1465403892, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 0}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038929920942", :region_code => 1}})
|
580
580
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
581
581
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
582
582
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654038931856126)
|
@@ -601,7 +601,7 @@ describe Pubnub::Presence do
|
|
601
601
|
end
|
602
602
|
|
603
603
|
expect(envelopes[0].status[:code]).to eq(200)
|
604
|
-
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => "demo-pnpres", :payload => {"action" => "join", "timestamp" => 1465403893, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038934962157", :region_code => 2}})
|
604
|
+
expect(envelopes[0].status[:data]).to eq({:shard => "5", :channel => "demo-pnpres", :subscription_match => "demo-pnpres", :payload => {"action" => "join", "timestamp" => 1465403893, "uuid" => "ruby-test-uuid-client-two", "occupancy" => 1}, :flags => 0, :issuing_client_id => nil, :subscribe_key => "sub-a-mock-key", :sequence_number => nil, :user_meta_data => nil, :replication_map => nil, :eat_after_reading => nil, :type => nil, :waypoint_list => nil, :origination_time_token => nil, :publish_timetoken => {:timetoken => "14654038934962157", :region_code => 2}})
|
605
605
|
expect(envelopes[0].status[:category]).to eq(:ack)
|
606
606
|
expect(envelopes[0].status[:auto_retried]).to eq(true)
|
607
607
|
expect(envelopes[0].status[:current_timetoken]).to eq(14654038935342617)
|
@@ -18,7 +18,7 @@ describe Pubnub::Publish do
|
|
18
18
|
envelope = @pubnub.publish(channel: :demo, message: :whatever, ttl: 10, http_sync: true)
|
19
19
|
|
20
20
|
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
21
|
-
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
21
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -27,7 +27,7 @@ describe Pubnub::Publish do
|
|
27
27
|
envelope = @pubnub.publish(channel: :demo, message: :whatever, ttl: 10, store: false, http_sync: true)
|
28
28
|
|
29
29
|
expect(envelope.is_a?(Pubnub::Envelope)).to eq true
|
30
|
-
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
|
30
|
+
expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -11,7 +11,7 @@ describe Pubnub::Revoke do
|
|
11
11
|
@pubnub = Pubnub.new(
|
12
12
|
publish_key: "pub-a-mock-key",
|
13
13
|
subscribe_key: "sub-a-mock-key",
|
14
|
-
secret_key: "sec-
|
14
|
+
secret_key: "sec-a-mock-key",
|
15
15
|
uuid: "ruby-test-uuid-client-one",
|
16
16
|
auth_key: "ruby-test-auth-client-one",
|
17
17
|
)
|