pubnub 3.7.0 → 3.7.1

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.txt +3 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +7 -3
  5. data/README.md +3 -3
  6. data/lib/pubnub.rb +2 -0
  7. data/lib/pubnub/client.rb +32 -32
  8. data/lib/pubnub/crypto.rb +5 -5
  9. data/lib/pubnub/event.rb +70 -60
  10. data/lib/pubnub/events/here_now.rb +1 -1
  11. data/lib/pubnub/events/leave.rb +4 -4
  12. data/lib/pubnub/events/publish.rb +2 -2
  13. data/lib/pubnub/exceptions.rb +2 -2
  14. data/lib/pubnub/version.rb +1 -1
  15. data/spec/lib/channel_presence_concat_pam_spec.rb +2 -2
  16. data/spec/lib/eof_error_spec.rb +2 -2
  17. data/spec/lib/integration/audit_dpc_spec.rb +2 -2
  18. data/spec/lib/integration/audit_spec.rb +2 -2
  19. data/spec/lib/integration/global_here_now_dpc_spec.rb +2 -2
  20. data/spec/lib/integration/global_here_now_spec.rb +2 -2
  21. data/spec/lib/integration/grant_dpc_spec.rb +2 -2
  22. data/spec/lib/integration/grant_spec.rb +2 -2
  23. data/spec/lib/integration/here_now_dpc_spec.rb +2 -2
  24. data/spec/lib/integration/here_now_spec.rb +2 -2
  25. data/spec/lib/integration/history_dpc_spec.rb +2 -2
  26. data/spec/lib/integration/history_spec.rb +2 -2
  27. data/spec/lib/integration/leave_dpc_spec.rb +2 -2
  28. data/spec/lib/integration/leave_spec.rb +2 -2
  29. data/spec/lib/integration/presence_dpc_spec.rb +2 -2
  30. data/spec/lib/integration/presence_spec.rb +2 -2
  31. data/spec/lib/integration/publish_spec_old.rb +2 -2
  32. data/spec/lib/integration/revoke_dpc_spec.rb +2 -2
  33. data/spec/lib/integration/revoke_spec.rb +2 -2
  34. data/spec/lib/integration/state_spec.rb +2 -2
  35. data/spec/lib/integration/subscribe_dpc_spec.rb +2 -2
  36. data/spec/lib/integration/subscribe_spec.rb +2 -2
  37. data/spec/lib/integration/time_dpc_spec.rb +2 -2
  38. data/spec/lib/integration/time_spec.rb +2 -2
  39. data/spec/lib/integration/v3_presence_dpc_spec.rb +2 -2
  40. data/spec/lib/integration/v3_presence_spec.rb +2 -2
  41. data/spec/lib/integration/where_now_spec.rb +2 -2
  42. metadata +2 -2
@@ -40,7 +40,7 @@ module Pubnub
40
40
  @channel
41
41
  ].join('/')
42
42
  else
43
- $logger.debug('Pubnub'){'Global here_now'}
43
+ Pubnub.logger.debug(:pubnub){'Global here_now'}
44
44
  '/' + [
45
45
  'v2',
46
46
  'presence',
@@ -24,20 +24,20 @@ module Pubnub
24
24
  end
25
25
 
26
26
  def fire(app)
27
- $logger.debug('Pubnub'){"Pubnub::Leave#fire"}
27
+ Pubnub.logger.debug(:pubnub){"Pubnub::Leave#fire"}
28
28
  unless @left
29
29
  app.update_timetoken(0)
30
30
  if app.env[:subscriptions][@origin].nil?
31
- $logger.error('Pubnub'){'There\'s no subscription for that origin'}
31
+ Pubnub.logger.error(:pubnub){'There\'s no subscription for that origin'}
32
32
  raise ArgumentError.new(:object => self, :message => 'You cannot leave channel that is not subscribed')
33
33
  else
34
34
  @channel.each do |channel|
35
- $logger.debug('Pubnub'){"#{app.env[:subscriptions][@origin].get_channels.to_s}.include? #{channel}"}
35
+ Pubnub.logger.debug(:pubnub){"#{app.env[:subscriptions][@origin].get_channels.to_s}.include? #{channel}"}
36
36
  raise ArgumentError.new(:object => self, :message => 'You cannot leave channel that is not subscribed') unless app.env[:subscriptions][@origin].get_channels.include?(channel)
37
37
  end
38
38
 
39
39
  @channel_group.each do |channel_group|
40
- $logger.debug('Pubnub'){"#{app.env[:subscriptions][@origin].get_channel_groups.to_s}.include? #{channel_group}"}
40
+ Pubnub.logger.debug(:pubnub){"#{app.env[:subscriptions][@origin].get_channel_groups.to_s}.include? #{channel_group}"}
41
41
  raise ArgumentError.new(:object => self, :message => 'You cannot leave channel group that is not subscribed') unless app.env[:subscriptions][@origin].get_channel_groups.include?(channel_group)
42
42
  end
43
43
  end unless @force
@@ -12,8 +12,8 @@ module Pubnub
12
12
  @event = 'publish'
13
13
  @allow_multiple_channels = false
14
14
 
15
- $logger.info('Pubnub'){ "Bytesize: #{uri(app).to_s.bytesize}" }
16
- $logger.info('Pubnub'){ "Lenght: #{uri(app).to_s.length}" }
15
+ Pubnub.logger.info(:pubnub){ "Bytesize: #{uri(app).to_s.bytesize}" }
16
+ Pubnub.logger.info(:pubnub){ "Length: #{uri(app).to_s.length}" }
17
17
 
18
18
  # raise ArgumentError.new(:object => self, :message => ':message argument is too big, encoded uri would excess 32k size limit') if uri(app).to_s.bytesize > 32000
19
19
  end
@@ -32,10 +32,10 @@ module Pubnub
32
32
  error_message << "ERROR MESSAGE: #{@message}\n"
33
33
  error_message << "ERROR BACKTRACE: #{self.backtrace}"
34
34
 
35
- if $logger.blank?
35
+ if Pubnub.logger.blank?
36
36
  puts error_message
37
37
  else
38
- $logger.error('Pubnub'){error_message}
38
+ Pubnub.logger.error(:pubnub){error_message}
39
39
  end
40
40
  end
41
41
 
@@ -1,3 +1,3 @@
1
1
  module Pubnub
2
- VERSION = '3.7.0'
2
+ VERSION = '3.7.1'
3
3
  end
@@ -11,14 +11,14 @@ describe "#grant" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe 'quick eof error test' do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#audit" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#audit" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#here_now" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#here_now" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#grant" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#grant" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#here_now" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#here_now" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#history" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#history" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#leave" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#leave" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#presence" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#presence" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#publish" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#revoke" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#revoke" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -6,14 +6,14 @@ describe 'state metadata in subscribe requests' do
6
6
  @message_output = StringIO.new
7
7
 
8
8
  @callback = lambda { |envelope|
9
- $logger.debug 'FIRING CALLBACK FROM TEST'
9
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
10
10
  @response_output.write envelope.response
11
11
  @message_output.write envelope.msg
12
12
  @after_callback = true
13
13
  }
14
14
 
15
15
  @error_callback = lambda { |envelope|
16
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
16
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
17
17
  @response_output.write envelope.response
18
18
  @message_output.write envelope.msg
19
19
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#subscribe" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true
@@ -11,14 +11,14 @@ describe "#subscribe" do
11
11
  @message_output = StringIO.new
12
12
 
13
13
  @callback = lambda { |envelope|
14
- $logger.debug 'FIRING CALLBACK FROM TEST'
14
+ Pubnub.logger.debug 'FIRING CALLBACK FROM TEST'
15
15
  @response_output.write envelope.response
16
16
  @message_output.write envelope.msg
17
17
  @after_callback = true
18
18
  }
19
19
 
20
20
  @error_callback = lambda { |envelope|
21
- $logger.debug 'FIRING ERROR CALLBACK FROM TEST'
21
+ Pubnub.logger.debug 'FIRING ERROR CALLBACK FROM TEST'
22
22
  @response_output.write envelope.response
23
23
  @message_output.write envelope.msg
24
24
  @after_error_callback = true