pubnub 4.1.2 → 4.1.5

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 (43) hide show
  1. checksums.yaml +5 -5
  2. data/.pubnub.yml +8 -1
  3. data/.rubocop.yml +3 -1
  4. data/.travis.yml +2 -1
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile.lock +74 -68
  7. data/README.md +1 -1
  8. data/VERSION +1 -2
  9. data/lib/pubnub/events/add_channels_to_push.rb +3 -2
  10. data/lib/pubnub/events/list_push_provisions.rb +2 -2
  11. data/lib/pubnub/events/remove_channels_from_push.rb +3 -2
  12. data/lib/pubnub/events/remove_device_from_push.rb +2 -2
  13. data/lib/pubnub/schemas/envelope_schema.rb +54 -27
  14. data/lib/pubnub/subscribe_event/formatter.rb +2 -2
  15. data/lib/pubnub/validators/push.rb +5 -5
  16. data/lib/pubnub/version.rb +1 -1
  17. data/pubnub.gemspec +6 -5
  18. data/spec/examples/audit_examples_spec.rb +1 -1
  19. data/spec/examples/grant_examples_spec.rb +1 -1
  20. data/spec/examples/publish_with_ttl_spec.rb +2 -2
  21. data/spec/examples/revoke_examples_spec.rb +1 -1
  22. data/spec/lib/custom_retries_examples_spec.rb +1 -1
  23. data/spec/lib/events/audit_spec.rb +7 -7
  24. data/spec/lib/events/channel_registration_spec.rb +3 -3
  25. data/spec/lib/events/delete_messages_spec.rb +2 -2
  26. data/spec/lib/events/grant_spec.rb +6 -6
  27. data/spec/lib/events/heartbeat_spec.rb +2 -2
  28. data/spec/lib/events/here_now_spec.rb +3 -3
  29. data/spec/lib/events/history_spec.rb +3 -3
  30. data/spec/lib/events/leave_spec.rb +2 -2
  31. data/spec/lib/events/presence_spec.rb +5 -5
  32. data/spec/lib/events/publish_spec.rb +2 -2
  33. data/spec/lib/events/revoke_spec.rb +5 -5
  34. data/spec/lib/events/state_spec.rb +3 -3
  35. data/spec/lib/events/subscribe_spec.rb +12 -12
  36. data/spec/lib/events/time_spec.rb +2 -2
  37. data/spec/lib/events/timeout_handling_spec.rb +1 -1
  38. data/spec/lib/events/where_now_spec.rb +3 -3
  39. data/spec/lib/signatures_spec.rb +13 -13
  40. data/spec/lib/ssl_error_spec.rb +1 -1
  41. data/spec/lib/super_admin_spec.rb +1 -1
  42. data/spec/spec_expectations.rb +12 -1
  43. metadata +14 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dc7c6dd7f233dd372e76fe0917b38906ec040295
4
- data.tar.gz: a4066619d242cc01a496c201c260be44d6500041
2
+ SHA256:
3
+ metadata.gz: 242c68a87d13a592b515cb79a777a446dd116c1c695572ff380f6cf4dad7cfa3
4
+ data.tar.gz: bced3ce328f2d1f5c19c99c07046d55805a9d2518b812c42a77b629e6094eb61
5
5
  SHA512:
6
- metadata.gz: 0538ad194245dc17b4a1e68860f30fa0d773e7ce74bd2b9de1b5d242a04f2612015e43db893e229b42cf98b31f4a297e2b80b24547a1dd419a5b13c4f7684ab3
7
- data.tar.gz: c8512b8ebd757605b2037921f2832cd2891eaf9a3d034a2ca82903e5d9d986aa2182594e39eae0e6ec472a46d03bccb6ccb278b677b12711055c2e077dcae22e
6
+ metadata.gz: c99236e15a94867504dd45f3992d1cc5fb7dacd8bba2a81ec69c8cb5cec15b6a62c14a0116e439ce25a840f624299fdde1a41ab999547493fd12bfb9312d284a
7
+ data.tar.gz: 71d4d5f51af2032fa75a93e0541bc4dc3e17cf60309c54ec49f852d7dd61166988888e68948e06b2aef5500902dfd260d05bbbd2219d25d6845c5c83cb8b9842
@@ -1,6 +1,13 @@
1
1
  ---
2
- version: "4.1.2"
2
+ version: "4.1.5"
3
3
  changelog:
4
+ -
5
+ changes:
6
+ -
7
+ text: "Updated dependencies"
8
+ type: improvement
9
+ date: 29-7-2019
10
+ version: "4.1.5"
4
11
  -
5
12
  changes:
6
13
  -
@@ -22,4 +22,6 @@ Metrics/PerceivedComplexity:
22
22
  Max: 10
23
23
 
24
24
  Metrics/CyclomaticComplexity:
25
- Enabled: false
25
+ Enabled: false
26
+
27
+ TargetRubyVersion: 2.4
@@ -6,6 +6,7 @@ addons:
6
6
 
7
7
  before_install:
8
8
  # See https://github.com/travis-ci/travis-ci/issues/5861
9
+ - gem update --system
9
10
  - gem install bundler
10
11
  - gem update bundler
11
12
 
@@ -14,9 +15,9 @@ bundler_args: --without development
14
15
  script: bundle exec rspec
15
16
 
16
17
  rvm:
18
+ - 2.6.3
17
19
  - 2.5.1
18
20
  - 2.4.4
19
- - 2.3.7
20
21
 
21
22
  matrix:
22
23
  include:
@@ -1,3 +1,7 @@
1
+ ##### 4.1.5
2
+ * Update dependency dry-validation
3
+ * Includes minimum Ruby version requirement of 2.4+
4
+
1
5
  ##### 4.0.28
2
6
  * Added Concurrent-ruby Gem
3
7
  * Removed Celluloid
@@ -1,131 +1,137 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubnub (4.1.2)
5
- concurrent-ruby (~> 1.0.5)
6
- concurrent-ruby-edge (~> 0.3.1)
7
- dry-validation (~> 0.10)
4
+ pubnub (4.1.5)
5
+ concurrent-ruby (~> 1.1.5)
6
+ concurrent-ruby-edge (~> 0.5.0)
7
+ dry-validation (~> 1.0)
8
8
  httpclient (~> 2.8, >= 2.8.3)
9
- json (>= 1.8, < 3)
10
- timers (>= 4.1.1)
9
+ json (>= 2.2.0, < 3)
10
+ timers (>= 4.3.0)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- addressable (2.5.2)
15
+ addressable (2.6.0)
16
16
  public_suffix (>= 2.0.2, < 4.0)
17
17
  ast (2.4.0)
18
18
  awesome_print (1.8.0)
19
19
  binding_of_caller (0.8.0)
20
20
  debug_inspector (>= 0.0.1)
21
- codacy-coverage (1.1.8)
21
+ codacy-coverage (2.1.0)
22
22
  simplecov
23
23
  coderay (1.1.2)
24
- concurrent-ruby (1.0.5)
25
- concurrent-ruby-edge (0.3.1)
26
- concurrent-ruby (= 1.0.5)
24
+ concurrent-ruby (1.1.5)
25
+ concurrent-ruby-edge (0.5.0)
26
+ concurrent-ruby (~> 1.1.5)
27
27
  crack (0.4.3)
28
28
  safe_yaml (~> 1.0.0)
29
29
  debug_inspector (0.0.3)
30
30
  diff-lcs (1.3)
31
- docile (1.3.1)
32
- dry-configurable (0.7.0)
31
+ docile (1.3.2)
32
+ dry-configurable (0.8.3)
33
33
  concurrent-ruby (~> 1.0)
34
- dry-container (0.6.0)
34
+ dry-core (~> 0.4, >= 0.4.7)
35
+ dry-container (0.7.2)
35
36
  concurrent-ruby (~> 1.0)
36
37
  dry-configurable (~> 0.1, >= 0.1.3)
37
- dry-core (0.4.7)
38
+ dry-core (0.4.8)
38
39
  concurrent-ruby (~> 1.0)
39
- dry-equalizer (0.2.1)
40
+ dry-equalizer (0.2.2)
40
41
  dry-inflector (0.1.2)
41
- dry-logic (0.4.2)
42
- dry-container (~> 0.2, >= 0.2.6)
42
+ dry-initializer (3.0.1)
43
+ dry-logic (1.0.2)
44
+ concurrent-ruby (~> 1.0)
43
45
  dry-core (~> 0.2)
44
46
  dry-equalizer (~> 0.2)
45
- dry-types (0.13.2)
47
+ dry-schema (1.3.1)
48
+ concurrent-ruby (~> 1.0)
49
+ dry-configurable (~> 0.8, >= 0.8.3)
50
+ dry-core (~> 0.4)
51
+ dry-equalizer (~> 0.2)
52
+ dry-initializer (~> 3.0)
53
+ dry-logic (~> 1.0)
54
+ dry-types (~> 1.0)
55
+ dry-types (1.1.0)
46
56
  concurrent-ruby (~> 1.0)
47
57
  dry-container (~> 0.3)
48
58
  dry-core (~> 0.4, >= 0.4.4)
49
- dry-equalizer (~> 0.2)
59
+ dry-equalizer (~> 0.2, >= 0.2.2)
50
60
  dry-inflector (~> 0.1, >= 0.1.2)
51
- dry-logic (~> 0.4, >= 0.4.2)
52
- dry-validation (0.12.1)
61
+ dry-logic (~> 1.0, >= 1.0.2)
62
+ dry-validation (1.2.1)
53
63
  concurrent-ruby (~> 1.0)
54
- dry-configurable (~> 0.1, >= 0.1.3)
55
- dry-core (~> 0.2, >= 0.2.1)
64
+ dry-container (~> 0.7, >= 0.7.1)
65
+ dry-core (~> 0.4)
56
66
  dry-equalizer (~> 0.2)
57
- dry-logic (~> 0.4, >= 0.4.0)
58
- dry-types (~> 0.13.1)
59
- ffi (1.9.25-java)
60
- hashdiff (0.3.7)
61
- hitimes (1.3.0)
67
+ dry-initializer (~> 3.0)
68
+ dry-schema (~> 1.0, >= 1.3.1)
69
+ ffi (1.11.1-java)
70
+ hashdiff (1.0.0)
62
71
  httpclient (2.8.3)
63
72
  interception (0.5)
64
- jaro_winkler (1.5.1)
65
- jaro_winkler (1.5.1-java)
66
- json (2.1.0)
67
- json (2.1.0-java)
68
- method_source (0.9.0)
69
- parallel (1.12.1)
70
- parser (2.5.1.0)
73
+ jaro_winkler (1.5.3)
74
+ jaro_winkler (1.5.3-java)
75
+ json (2.2.0)
76
+ json (2.2.0-java)
77
+ method_source (0.9.2)
78
+ parallel (1.17.0)
79
+ parser (2.6.3.0)
71
80
  ast (~> 2.4.0)
72
- powerpack (0.1.2)
73
- pry (0.11.3)
81
+ pry (0.12.2)
74
82
  coderay (~> 1.1.0)
75
83
  method_source (~> 0.9.0)
76
- pry (0.11.3-java)
84
+ pry (0.12.2-java)
77
85
  coderay (~> 1.1.0)
78
86
  method_source (~> 0.9.0)
79
87
  spoon (~> 0.0)
80
- pry-rescue (1.4.5)
88
+ pry-rescue (1.5.0)
81
89
  interception (>= 0.5)
82
- pry
83
- pry-stack_explorer (0.4.9.2)
90
+ pry (>= 0.12.0)
91
+ pry-stack_explorer (0.4.9.3)
84
92
  binding_of_caller (>= 0.7)
85
93
  pry (>= 0.9.11)
86
- public_suffix (3.0.2)
94
+ public_suffix (3.1.1)
87
95
  rainbow (3.0.0)
88
96
  rr (1.2.1)
89
- rspec (3.7.0)
90
- rspec-core (~> 3.7.0)
91
- rspec-expectations (~> 3.7.0)
92
- rspec-mocks (~> 3.7.0)
93
- rspec-core (3.7.1)
94
- rspec-support (~> 3.7.0)
95
- rspec-expectations (3.7.0)
97
+ rspec (3.8.0)
98
+ rspec-core (~> 3.8.0)
99
+ rspec-expectations (~> 3.8.0)
100
+ rspec-mocks (~> 3.8.0)
101
+ rspec-core (3.8.2)
102
+ rspec-support (~> 3.8.0)
103
+ rspec-expectations (3.8.4)
96
104
  diff-lcs (>= 1.2.0, < 2.0)
97
- rspec-support (~> 3.7.0)
98
- rspec-mocks (3.7.0)
105
+ rspec-support (~> 3.8.0)
106
+ rspec-mocks (3.8.1)
99
107
  diff-lcs (>= 1.2.0, < 2.0)
100
- rspec-support (~> 3.7.0)
108
+ rspec-support (~> 3.8.0)
101
109
  rspec-retry (0.6.1)
102
110
  rspec-core (> 3.3)
103
- rspec-support (3.7.1)
104
- rubocop (0.57.2)
111
+ rspec-support (3.8.2)
112
+ rubocop (0.73.0)
105
113
  jaro_winkler (~> 1.5.1)
106
114
  parallel (~> 1.10)
107
- parser (>= 2.5)
108
- powerpack (~> 0.1)
115
+ parser (>= 2.6)
109
116
  rainbow (>= 2.2.2, < 4.0)
110
117
  ruby-progressbar (~> 1.7)
111
- unicode-display_width (~> 1.0, >= 1.0.1)
112
- ruby-progressbar (1.9.0)
113
- safe_yaml (1.0.4)
114
- simplecov (0.16.1)
118
+ unicode-display_width (>= 1.4.0, < 1.7)
119
+ ruby-progressbar (1.10.1)
120
+ safe_yaml (1.0.5)
121
+ simplecov (0.17.0)
115
122
  docile (~> 1.1)
116
123
  json (>= 1.8, < 3)
117
124
  simplecov-html (~> 0.10.0)
118
125
  simplecov-html (0.10.2)
119
126
  spoon (0.0.6)
120
127
  ffi
121
- timers (4.1.2)
122
- hitimes
123
- unicode-display_width (1.4.0)
124
- vcr (4.0.0)
125
- webmock (3.4.2)
128
+ timers (4.3.0)
129
+ unicode-display_width (1.6.0)
130
+ vcr (5.0.0)
131
+ webmock (3.6.0)
126
132
  addressable (>= 2.3.6)
127
133
  crack (>= 0.3.2)
128
- hashdiff
134
+ hashdiff (>= 0.4.0, < 2.0.0)
129
135
 
130
136
  PLATFORMS
131
137
  java
@@ -149,4 +155,4 @@ DEPENDENCIES
149
155
  webmock
150
156
 
151
157
  BUNDLED WITH
152
- 1.16.2
158
+ 1.17.2
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  # Complete Documentation
8
8
  Available at https://www.pubnub.com/docs/ruby/pubnub-ruby-sdk-v4 **v4.x**
9
9
 
10
- ## PubNub Gem version 4.1.0
10
+ ## PubNub Gem version 4.1.5
11
11
 
12
12
  ##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
13
13
  ##### http://www.pubnub.com/account
data/VERSION CHANGED
@@ -1,2 +1 @@
1
- 4.1.2
2
-
1
+ 4.1.5
@@ -6,9 +6,10 @@ module Pubnub
6
6
  include Pubnub::Validator::Push
7
7
 
8
8
  def initialize(options, app)
9
- @event = current_operation
10
- @params = options
11
9
  super
10
+ @event = current_operation
11
+ @auth_key = options[:auth_key]
12
+ @params = @given_options
12
13
  end
13
14
 
14
15
  private
@@ -6,9 +6,9 @@ module Pubnub
6
6
  include Pubnub::Validator::Push
7
7
 
8
8
  def initialize(options, app)
9
- @event = current_operation
10
- @params = options
11
9
  super
10
+ @event = current_operation
11
+ @params = @given_options
12
12
  end
13
13
 
14
14
  private
@@ -6,9 +6,10 @@ module Pubnub
6
6
  include Pubnub::Validator::Push
7
7
 
8
8
  def initialize(options, app)
9
- @event = current_operation
10
- @params = options
11
9
  super
10
+ @event = current_operation
11
+ @params = @given_options
12
+ @auth_key = options[:auth_key]
12
13
  end
13
14
 
14
15
  private
@@ -6,9 +6,9 @@ module Pubnub
6
6
  include Pubnub::Validator::Push
7
7
 
8
8
  def initialize(options, app)
9
- @event = current_operation
10
- @params = options
11
9
  super
10
+ @event = current_operation
11
+ @params = @given_options
12
12
  end
13
13
 
14
14
  private
@@ -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::Validation.Schema do
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.schema do
12
- optional(:uuid).filled(:str?)
13
- optional(:timestamp).filled(:int?)
14
- optional(:state).maybe(:hash?)
15
- optional(:occupancy).filled(:int?)
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
- ConfigSchema = Dry::Validation.Schema do
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
- StatusSchema = Dry::Validation.Schema do
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
- required(:auto_retried).filled(:bool?)
37
+ end
34
38
 
35
- optional(:current_timetoken).maybe(:int?)
36
- optional(:last_timetoken).maybe(:int?)
37
- optional(:subscribed_channels).maybe(:array?)
38
- optional(:subscribed_channel_groups).maybe(:array?)
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
- required(:config).schema(ConfigSchema)
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
- rule(category_value: %i[error category]) do |error, category|
43
- error.true?.then(category.included_in?(Pubnub::Constants::STATUS_CATEGORY_ERRORS))
44
- error.false?.then(category.included_in?(Pubnub::Constants::STATUS_CATEGORY_SUCCESSES))
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
- ResultSchema = Dry::Validation.Schema do
49
- required(:code).filled(:int?)
50
- required(:operation) { included_in?(Pubnub::Constants::OPERATIONS) }
51
- required(:client_request).filled
52
- required(:server_response).filled
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
- required(:data).maybe.schema(DataSchema)
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