pubnub 4.0.17 → 4.0.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a0e79f6ac4faeec09e93fb91f5bbce45ead08bf
4
- data.tar.gz: dccfe30cc0a0de83d632ba4b0de87f85e193b026
3
+ metadata.gz: cd98cbabfdb8253cf9b3b94f2a0e801821af9fc4
4
+ data.tar.gz: 6b43eea77ca8d70700aeb249ddab17093d63eac9
5
5
  SHA512:
6
- metadata.gz: 4ca4e26825a1936c36d84b85b743d1e17383ee58e61f9af206454df9867435b97b9902e2e43d0ad1246b2e98ce49ed4a1d5b10d73324733a1edfe99735605991
7
- data.tar.gz: a573a70edd1d4711ed3d0117210b0dd8c5eba51c938b3246e49c055d8518fec4f8d3d259fb6e40cc43333a5c19a9156207337aafc0f8293891c3e169b2a8faa5
6
+ metadata.gz: 0a8ee98eb6c0ebd498b30a97d98e2ddc16bd65d32e0c6467ca9bcdc0e0576d30d38eb37de990cbd3ca03290910b37a783731a9ff32a8d476653add7cc708dce7
7
+ data.tar.gz: 6c12d9dbfd762df7ec1be0cf7a8d334e7d95a3fc70b097714f225378230d2f5c4e86157d4d295e95070b13678dd24381518c8fb65bc8e3b1f225cff85f201d55
@@ -14,14 +14,14 @@ changelog:
14
14
  changes:
15
15
  -
16
16
  text: "Fixed missing channel group parameter in leave event"
17
- type: bugfix
17
+ type: bug
18
18
  date: ~
19
19
  version: v4.0.16
20
20
  -
21
21
  changes:
22
22
  -
23
23
  text: "Fixed PAM signature when some special characters are present"
24
- type: bugfix
24
+ type: bug
25
25
  date: ~
26
26
  version: v4.0.15
27
27
  -
@@ -13,6 +13,7 @@ script: bundle exec rspec
13
13
 
14
14
  matrix:
15
15
  include:
16
+ - rvm: 2.4.0
16
17
  - rvm: 2.3.1
17
18
  - rvm: 2.2.5
18
19
  - rvm: 2.1.9
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gemspec
5
5
  group :test do
6
6
  gem 'rubocop'
7
7
  gem 'simplecov', '>= 0.12', require: false
8
- gem 'codecov', require: false
8
+ gem 'codacy-coverage', :require => false
9
9
  gem 'rspec'
10
10
  gem 'rspec-wait'
11
11
  gem 'vcr'
@@ -32,47 +32,46 @@ GEM
32
32
  timers (>= 4.1.1)
33
33
  celluloid-supervision (0.20.6)
34
34
  timers (>= 4.1.1)
35
- codecov (0.1.4)
36
- json
35
+ codacy-coverage (1.1.6)
37
36
  simplecov
38
- url
39
37
  coderay (1.1.0)
40
- concurrent-ruby (1.0.2)
38
+ concurrent-ruby (1.0.4)
39
+ concurrent-ruby (1.0.4-java)
41
40
  crack (0.4.2)
42
41
  safe_yaml (~> 1.0.0)
43
42
  diff-lcs (1.2.5)
44
43
  docile (1.1.5)
45
- dry-configurable (0.3.0)
44
+ dry-configurable (0.5.0)
46
45
  concurrent-ruby (~> 1.0)
47
- dry-container (0.5.0)
46
+ dry-container (0.6.0)
48
47
  concurrent-ruby (~> 1.0)
49
48
  dry-configurable (~> 0.1, >= 0.1.3)
50
- dry-core (0.2.0)
49
+ dry-core (0.2.4)
51
50
  concurrent-ruby (~> 1.0)
52
51
  dry-equalizer (0.2.0)
53
- dry-logic (0.4.0)
52
+ dry-logic (0.4.1)
54
53
  dry-container (~> 0.2, >= 0.2.6)
55
- dry-core (~> 0.1)
54
+ dry-core (~> 0.2)
56
55
  dry-equalizer (~> 0.2)
57
- dry-types (0.9.2)
56
+ dry-types (0.9.4)
58
57
  concurrent-ruby (~> 1.0)
59
58
  dry-configurable (~> 0.1)
60
59
  dry-container (~> 0.3)
61
- dry-core (~> 0.2)
60
+ dry-core (~> 0.2, >= 0.2.1)
62
61
  dry-equalizer (~> 0.2)
63
62
  dry-logic (~> 0.4, >= 0.4.0)
64
63
  inflecto (~> 0.0.0, >= 0.0.2)
65
- dry-validation (0.10.3)
64
+ dry-validation (0.10.5)
66
65
  concurrent-ruby (~> 1.0)
67
66
  dry-configurable (~> 0.1, >= 0.1.3)
68
- dry-container (~> 0.2, >= 0.2.8)
69
- dry-core (~> 0.1)
67
+ dry-core (~> 0.2, >= 0.2.1)
70
68
  dry-equalizer (~> 0.2)
71
69
  dry-logic (~> 0.4, >= 0.4.0)
72
70
  dry-types (~> 0.9, >= 0.9.0)
73
71
  ffi (1.9.10-java)
74
72
  hitimes (1.2.4)
75
- httpclient (2.8.2.4)
73
+ hitimes (1.2.4-java)
74
+ httpclient (2.8.3)
76
75
  inflecto (0.0.2)
77
76
  json (2.0.2)
78
77
  json (2.0.2-java)
@@ -122,9 +121,8 @@ GEM
122
121
  slop (3.6.0)
123
122
  spoon (0.0.4)
124
123
  ffi
125
- timers (4.1.1)
124
+ timers (4.1.2)
126
125
  hitimes
127
- url (0.3.2)
128
126
  vcr (3.0.1)
129
127
  webmock (1.21.0)
130
128
  addressable (>= 2.3.6)
@@ -137,7 +135,7 @@ PLATFORMS
137
135
  DEPENDENCIES
138
136
  awesome_print
139
137
  bundler (~> 1.7)
140
- codecov
138
+ codacy-coverage
141
139
  pry
142
140
  pubnub!
143
141
  rr
@@ -149,4 +147,4 @@ DEPENDENCIES
149
147
  webmock
150
148
 
151
149
  BUNDLED WITH
152
- 1.13.6
150
+ 1.14.4
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  # Complete Documentation
7
7
  Available at https://www.pubnub.com/docs/ruby/pubnub-ruby-sdk-v4 **v4.x**
8
8
 
9
- ## PubNub Gem version 4.0.17
9
+ ## PubNub Gem version 4.0.18
10
10
 
11
11
  ##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
12
12
  ##### http://www.pubnub.com/account
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.17
1
+ 4.0.18
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://pubsub.pubnub.com/publish/pub-c-9bb9ae77-a60c-4788-96ab-75cbe5d5dd11/sub-c-f9f24520-9c56-11e6-a681-02ee2ddab7fe/0/demo/0/%22demo%22?ortt=%7B%22t%22:14803435605315392%7D&pnsdk=PubNub-Ruby/4.0.16&seqn=1&signature=w6a0brZPuamCk5CKFft527nPqGL7ikXocnW2eGdXhfc=&timestamp=1480343560&uuid=ruby-test
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.2.4, ruby 2.3.2 (2016-11-15))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Mon, 28 Nov 2016 14:32:40 GMT
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Mon, 28 Nov 2016 14:32:40 GMT
23
+ Content-Type:
24
+ - text/javascript; charset="UTF-8"
25
+ Content-Length:
26
+ - '30'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - GET
35
+ body:
36
+ encoding: UTF-8
37
+ string: '[1,"Sent","14803435607606028"]'
38
+ http_version:
39
+ recorded_at: Mon, 28 Nov 2016 14:32:40 GMT
40
+ recorded_with: VCR 3.0.1
@@ -26,13 +26,14 @@ module Pubnub
26
26
  STATUS_TIMEOUT = :timeout
27
27
  STATUS_NON_JSON_RESPONSE = :non_json_response
28
28
  STATUS_ERROR = :error
29
+ SSL_ERROR = :ssl_error
29
30
  STATUS_API_KEY_ERROR = :api_key_error
30
31
  STATUS_REQUEST_MESSAGE_COUNT_EXCEEDED = :request_message_count_exceeded
31
32
 
32
33
  # Successes
33
34
  STATUS_ACK = :ack
34
35
 
35
- STATUS_CATEGORY_ERRORS = [STATUS_ACCESS_DENIED, STATUS_TIMEOUT, STATUS_NON_JSON_RESPONSE, STATUS_API_KEY_ERROR]
36
+ STATUS_CATEGORY_ERRORS = [STATUS_ACCESS_DENIED, STATUS_TIMEOUT, STATUS_NON_JSON_RESPONSE, STATUS_API_KEY_ERROR, SSL_ERROR]
36
37
  STATUS_CATEGORY_SUCCESSES = [STATUS_ACK]
37
38
 
38
39
  # Operations
@@ -149,6 +149,8 @@ module Pubnub
149
149
  def format_envelopes(response, request)
150
150
  if response.is_a? HTTPClient::ReceiveTimeoutError
151
151
  return error_envelope(nil, response, request: request, response: response)
152
+ elsif response.is_a? OpenSSL::SSL::SSLError
153
+ return error_envelope(nil, response, request: request, response: response)
152
154
  else
153
155
  parsed_response, error = Formatter.parse_json(response.body)
154
156
  end
@@ -231,6 +233,9 @@ module Pubnub
231
233
  when HTTPClient::ReceiveTimeoutError
232
234
  error_category = Pubnub::Constants::STATUS_TIMEOUT
233
235
  code = 408
236
+ when OpenSSL::SSL::SSLError
237
+ error_category = Pubnub::Constants::SSL_ERROR
238
+ code = nil
234
239
  else
235
240
  error_category = Pubnub::Constants::STATUS_ERROR
236
241
  code = req_res_objects[:response].code
@@ -84,15 +84,27 @@ module Pubnub
84
84
  end
85
85
 
86
86
  def error_envelope(parsed_response, error, req_res_objects)
87
+ case error
88
+ when JSON::ParserError
89
+ error_category = Pubnub::Constants::STATUS_NON_JSON_RESPONSE
90
+ code = req_res_objects[:response].code
91
+ when HTTPClient::ReceiveTimeoutError
92
+ error_category = Pubnub::Constants::STATUS_TIMEOUT
93
+ code = 408
94
+ else
95
+ error_category = Pubnub::Constants::STATUS_ERROR
96
+ code = req_res_objects[:response].code
97
+ end
98
+
87
99
  ErrorEnvelope.new(
88
100
  event: @event,
89
101
  event_options: @given_options,
90
102
  timetoken: nil,
91
103
  status: {
92
- code: req_res_objects[:response].code,
104
+ code: code,
93
105
  client_request: req_res_objects[:request],
94
106
  server_response: req_res_objects[:response],
95
- category: (error ? Pubnub::Constants::STATUS_NON_JSON_RESPONSE : Pubnub::Constants::ERROR),
107
+ category: error_category,
96
108
  error: true,
97
109
  auto_retried: false,
98
110
 
@@ -106,7 +118,7 @@ module Pubnub
106
118
  config: get_config
107
119
  },
108
120
  result: {
109
- code: req_res_objects[:response].code,
121
+ code: code,
110
122
  operation: current_operation,
111
123
  client_request: req_res_objects[:request],
112
124
  server_response: req_res_objects[:response],
@@ -1,4 +1,4 @@
1
1
  # Toplevel Pubnub module.
2
2
  module Pubnub
3
- VERSION = '4.0.17'
3
+ VERSION = '4.0.18'
4
4
  end
@@ -45,6 +45,19 @@ describe Pubnub::Grant do
45
45
  expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
46
46
  end
47
47
  end
48
+
49
+ it 'forms valid ErrorEnvelope on timeout error' do
50
+ HTTPClient.any_instance.stub(get: HTTPClient::ReceiveTimeoutError.new)
51
+
52
+ envelope = @pubnub.grant(
53
+ channel: :demo
54
+ ).value
55
+
56
+ expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
57
+ expect(envelope.status[:code]).to eq 408
58
+ expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
59
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
60
+ end
48
61
  end
49
62
 
50
- end
63
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Super admin mode' do
4
+
5
+ around :each do |example|
6
+ Celluloid.boot
7
+ example.run
8
+ Celluloid.shutdown
9
+ end
10
+
11
+ before(:each) do
12
+ Pubnub::Client.any_instance.stub(:sdk_version).and_return('PubNub-Ruby/4.0.16')
13
+
14
+ @pubnub = Pubnub.new(
15
+ subscribe_key: 'sub-c-f9f24520-9c56-11e6-a681-02ee2ddab7fe',
16
+ publish_key: 'pub-c-9bb9ae77-a60c-4788-96ab-75cbe5d5dd11',
17
+ secret_key: 'sec-c-MjZkYmQyMDUtYmRhZi00ZDY3LThjZGQtNjU2NmNjNmJkODM3',
18
+ uuid: 'ruby-test',
19
+ reconnect_interval: 0,
20
+ ssl: true
21
+ )
22
+ end
23
+
24
+ describe 'OpenSSL error' do
25
+ it 'is caught' do
26
+ Pubnub::Publish.any_instance.stub(:current_time).and_return(1480343560)
27
+ Pubnub::Publish.any_instance.stub(:send_request).and_return(OpenSSL::SSL::SSLError.new)
28
+ Pubnub::Client.any_instance.stub(:generate_ortt).and_return(14803435605315392)
29
+
30
+ VCR.use_cassette('lib/ssl-error', record: :once) do
31
+ pub = @pubnub.publish(channel: :demo, message: :demo)
32
+ expect(pub.value.status[:category]).to eq Pubnub::Constants::SSL_ERROR
33
+ end
34
+ end
35
+ end
36
+
37
+ end
@@ -17,8 +17,8 @@ end
17
17
  require 'pubnub'
18
18
 
19
19
  if ENV['CI'] == 'true'
20
- require 'codecov'
21
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
20
+ require 'codacy-coverage'
21
+ Codacy::Reporter.start
22
22
  end
23
23
 
24
24
  Celluloid.task_class = Celluloid::Task::Threaded
@@ -69,6 +69,8 @@ end
69
69
  VCR.configure do |c|
70
70
  c.cassette_library_dir = 'fixtures/vcr_cassettes'
71
71
  c.hook_into :webmock
72
+ c.allow_http_connections_when_no_cassette = false
73
+ c.ignore_hosts 'api.codacy.com'
72
74
  c.default_cassette_options = {
73
75
  match_requests_on: [:method,
74
76
  VCR.request_matchers.uri_without_param(:pnsdk, :uuid, :ortt, :seqn)]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.17
4
+ version: 4.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - PubNub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-21 00:00:00.000000000 Z
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -10473,6 +10473,7 @@ files:
10473
10473
  - fixtures/vcr_cassettes/lib/events/time.yml
10474
10474
  - fixtures/vcr_cassettes/lib/events/where-now-error.yml
10475
10475
  - fixtures/vcr_cassettes/lib/events/where-now.yml
10476
+ - fixtures/vcr_cassettes/lib/ssl-error.yml
10476
10477
  - fixtures/vcr_cassettes/lib/super_admin/cg.yml
10477
10478
  - fixtures/vcr_cassettes/lib/super_admin/here_now.yml
10478
10479
  - fixtures/vcr_cassettes/lib/super_admin/history.yml
@@ -10583,6 +10584,7 @@ files:
10583
10584
  - spec/lib/events/timeout_handling_spec.rb
10584
10585
  - spec/lib/events/where_now_spec.rb
10585
10586
  - spec/lib/pubnub_spec.rb
10587
+ - spec/lib/ssl_error_spec.rb
10586
10588
  - spec/lib/super_admin_spec.rb
10587
10589
  - spec/lib/uuid_spec.rb
10588
10590
  - spec/spec_expectations.rb
@@ -10652,6 +10654,7 @@ test_files:
10652
10654
  - spec/lib/events/timeout_handling_spec.rb
10653
10655
  - spec/lib/events/where_now_spec.rb
10654
10656
  - spec/lib/pubnub_spec.rb
10657
+ - spec/lib/ssl_error_spec.rb
10655
10658
  - spec/lib/super_admin_spec.rb
10656
10659
  - spec/lib/uuid_spec.rb
10657
10660
  - spec/spec_expectations.rb