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.

Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.pubnub.yml +23 -11
  3. data/.rubocop.yml +3 -1
  4. data/.travis.yml +3 -2
  5. data/CHANGELOG.md +7 -0
  6. data/Gemfile.lock +74 -68
  7. data/README.md +1 -1
  8. data/VERSION +1 -2
  9. data/fixtures/vcr_cassettes/lib/events/signal-error.yml +40 -0
  10. data/fixtures/vcr_cassettes/lib/events/signal.yml +40 -0
  11. data/lib/pubnub/client/events.rb +1 -1
  12. data/lib/pubnub/client.rb +1 -0
  13. data/lib/pubnub/constants.rb +2 -1
  14. data/lib/pubnub/events/add_channels_to_push.rb +3 -2
  15. data/lib/pubnub/events/list_push_provisions.rb +2 -2
  16. data/lib/pubnub/events/remove_channels_from_push.rb +3 -2
  17. data/lib/pubnub/events/remove_device_from_push.rb +2 -2
  18. data/lib/pubnub/events/signal.rb +87 -0
  19. data/lib/pubnub/schemas/envelope_schema.rb +54 -27
  20. data/lib/pubnub/subscribe_callback.rb +2 -1
  21. data/lib/pubnub/subscribe_event/formatter.rb +5 -2
  22. data/lib/pubnub/subscriber.rb +2 -0
  23. data/lib/pubnub/validators/push.rb +5 -5
  24. data/lib/pubnub/validators/signal.rb +49 -0
  25. data/lib/pubnub/version.rb +1 -1
  26. data/pubnub.gemspec +6 -5
  27. data/spec/examples/audit_examples_spec.rb +1 -1
  28. data/spec/examples/grant_examples_spec.rb +1 -1
  29. data/spec/examples/presence_examples_spec.rb +12 -12
  30. data/spec/examples/publish_with_ttl_spec.rb +2 -2
  31. data/spec/examples/revoke_examples_spec.rb +1 -1
  32. data/spec/examples/subscribe_examples_spec.rb +1988 -1988
  33. data/spec/lib/custom_retries_examples_spec.rb +1 -1
  34. data/spec/lib/events/audit_spec.rb +7 -7
  35. data/spec/lib/events/channel_registration_spec.rb +3 -3
  36. data/spec/lib/events/delete_messages_spec.rb +2 -2
  37. data/spec/lib/events/grant_spec.rb +6 -6
  38. data/spec/lib/events/heartbeat_spec.rb +2 -2
  39. data/spec/lib/events/here_now_spec.rb +3 -3
  40. data/spec/lib/events/history_spec.rb +3 -3
  41. data/spec/lib/events/leave_spec.rb +2 -2
  42. data/spec/lib/events/presence_spec.rb +5 -5
  43. data/spec/lib/events/publish_spec.rb +2 -2
  44. data/spec/lib/events/revoke_spec.rb +5 -5
  45. data/spec/lib/events/signal_spec.rb +39 -0
  46. data/spec/lib/events/state_spec.rb +3 -3
  47. data/spec/lib/events/subscribe_spec.rb +12 -12
  48. data/spec/lib/events/time_spec.rb +2 -2
  49. data/spec/lib/events/timeout_handling_spec.rb +1 -1
  50. data/spec/lib/events/where_now_spec.rb +3 -3
  51. data/spec/lib/signatures_spec.rb +13 -13
  52. data/spec/lib/ssl_error_spec.rb +1 -1
  53. data/spec/lib/super_admin_spec.rb +1 -1
  54. data/spec/spec_expectations.rb +12 -1
  55. metadata +20 -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: 04517d5210c2213931c074c40ecbeeb804179cf8ce28c4f21350321e560b5560
4
+ data.tar.gz: 8a8b59f386f3d62e747707762856d517e936f0983a3ee393a39e7b97d515bd5b
5
5
  SHA512:
6
- metadata.gz: 0538ad194245dc17b4a1e68860f30fa0d773e7ce74bd2b9de1b5d242a04f2612015e43db893e229b42cf98b31f4a297e2b80b24547a1dd419a5b13c4f7684ab3
7
- data.tar.gz: c8512b8ebd757605b2037921f2832cd2891eaf9a3d034a2ca82903e5d9d986aa2182594e39eae0e6ec472a46d03bccb6ccb278b677b12711055c2e077dcae22e
6
+ metadata.gz: f294ccd614f20cc7d2ec694ecc9cf493d65c2460833638ec316d793b628e225d7d36c2827491ce4ca77eaf24d1f2daab6e2ede0bcd082123f9bc0aadbf8a266f
7
+ data.tar.gz: ffb4e0e6977f9efc895abf1fb20e4235fca9fe78a0ed8d8a3d52e2eac9f4bfe8d4d79f5161994df95592996a8925bb2a9c2d48ec0806f5467eee44eac3c1c0a0
data/.pubnub.yml CHANGED
@@ -1,6 +1,18 @@
1
1
  ---
2
- version: "4.1.2"
2
+ version: "4.1.6"
3
3
  changelog:
4
+ - changes:
5
+ - text: "Added signal feature"
6
+ type: feature
7
+ date: 21-8-2019
8
+ version: "4.1.6"
9
+ -
10
+ changes:
11
+ -
12
+ text: "Updated dependencies"
13
+ type: improvement
14
+ date: 29-7-2019
15
+ version: "4.1.5"
4
16
  -
5
17
  changes:
6
18
  -
@@ -288,6 +300,8 @@ features:
288
300
  - SUBSCRIBE-WITH-TIMETOKEN
289
301
  - SUBSCRIBE-WILDCARD
290
302
  - SUBSCRIBE-FILTER-EXPRESSION
303
+ signal:
304
+ - SIGNAL-SEND
291
305
  time:
292
306
  - TIME-TIME
293
307
  name: ruby
@@ -296,15 +310,13 @@ scm: github.com/pubnub/ruby
296
310
  supported-platforms:
297
311
  -
298
312
  editors:
299
- - "ruby 2.4.0"
300
- - "ruby 2.3.3"
301
- - "ruby 2.2.6"
302
- - "ruby 2.1.10"
303
- - jruby-9.1.8.0
313
+ - "ruby 2.6"
314
+ - "ruby 2.5"
315
+ - "ruby 2.4"
304
316
  platforms:
305
- - "FreeBSD 8-STABLE or later, amd64, 386."
306
- - "Linux 2.6 or later, amd64, 386."
307
- - "Mac OS X 10.8 or later, amd64"
308
- - "Windows 7 or later, amd64, 386, use rubyinstaller and dev pack."
309
- - "Apart from the above, PubNub Ruby SDK works on mostly all platforms where the supported Ruby versions work. To use ssl connection, Ruby should be compiled with openssl support."
317
+ - "FreeBSD 8-STABLE or later, amd64, 386"
318
+ - "Linux 2.6 or later, amd64, 386"
319
+ - "macOS 10.8 or later, amd64"
320
+ - "Windows 7 or later, amd64, 386, use rubyinstaller and dev pack"
321
+ - "Apart from the above, the PubNub Ruby SDK works on almost every platform where the supported Ruby versions work. To use an SSL connection, Ruby should be compiled with OpenSSL support."
310
322
  version: "PubNub Ruby SDK"
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.4
2
3
  Exclude:
3
4
  - 'spec/**/*'
4
5
  - 'examples/**/*'
@@ -22,4 +23,5 @@ Metrics/PerceivedComplexity:
22
23
  Max: 10
23
24
 
24
25
  Metrics/CyclomaticComplexity:
25
- Enabled: false
26
+ Enabled: false
27
+
data/.travis.yml CHANGED
@@ -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,13 +15,13 @@ 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:
23
24
  - rvm: jruby-head
24
25
  env: JRUBY_OPTS="--server -J-Xms1500m -J-Xmx1500m -J-XX:+UseConcMarkSweepGC -J-XX:-UseGCOverheadLimit -J-XX:+CMSClassUnloadingEnabled"
25
- jdk: oraclejdk8
26
+ jdk: oraclejdk9
26
27
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ##### 4.1.6
2
+ * Added signal feature
3
+
4
+ ##### 4.1.5
5
+ * Update dependency dry-validation
6
+ * Includes minimum Ruby version requirement of 2.4+
7
+
1
8
  ##### 4.0.28
2
9
  * Added Concurrent-ruby Gem
3
10
  * Removed Celluloid
data/Gemfile.lock CHANGED
@@ -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.6)
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.6
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.6
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ps.pndsn.com/signal/demo/demo/0/demo/0/%2200000000000000000000000000000000000000000000000000%22?auth=ruby-test-auth&ortt=%7B%22t%22:15663104632819572%7D&pnsdk=PubNub-Ruby/4.1.5&seqn=1&uuid=ruby-test-uuid
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.6 (2019-04-01))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Tue, 20 Aug 2019 14:14:23 GMT
16
+ response:
17
+ status:
18
+ code: 400
19
+ message: INVALID
20
+ headers:
21
+ Date:
22
+ - Tue, 20 Aug 2019 14:14:25 GMT
23
+ Content-Type:
24
+ - text/javascript; charset="UTF-8"
25
+ Content-Length:
26
+ - '47'
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: '[0,"Signal size too large","15663104658224536"]'
38
+ http_version:
39
+ recorded_at: Tue, 20 Aug 2019 14:14:23 GMT
40
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ps.pndsn.com/signal/demo/demo/0/demo/0/%22whatever%22?auth=ruby-test-auth&ortt=%7B%22t%22:15663104631310930%7D&pnsdk=PubNub-Ruby/4.1.5&seqn=1&uuid=ruby-test-uuid
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.6 (2019-04-01))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Tue, 20 Aug 2019 14:14:23 GMT
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 20 Aug 2019 14:14:25 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","15663104657143915"]'
38
+ http_version:
39
+ recorded_at: Tue, 20 Aug 2019 14:14:23 GMT
40
+ recorded_with: VCR 5.0.0
@@ -5,7 +5,7 @@ module Pubnub
5
5
  # Module that holds generator for all events
6
6
  module Events
7
7
  EVENTS = %w[publish subscribe presence leave history here_now audit grant delete_messages
8
- revoke time heartbeat where_now set_state state channel_registration message_counts
8
+ revoke time heartbeat where_now set_state state channel_registration message_counts signal
9
9
  add_channels_to_push list_push_provisions remove_channels_from_push remove_device_from_push].freeze
10
10
 
11
11
  EVENTS.each do |event_name|
data/lib/pubnub/client.rb CHANGED
@@ -49,6 +49,7 @@ require 'pubnub/validators/where_now'
49
49
  require 'pubnub/validators/delete'
50
50
  require 'pubnub/validators/message_counts'
51
51
  require 'pubnub/validators/push'
52
+ require 'pubnub/validators/signal'
52
53
 
53
54
  Dir[File.join(File.dirname(__dir__), 'pubnub', 'events', '*.rb')].each do |file|
54
55
  require file
@@ -65,6 +65,7 @@ module Pubnub
65
65
  OPERATION_LIST_PUSH_PROVISIONS = :list_push_provisions
66
66
  OPERATION_REMOVE_CHANNELS_FROM_PUSH = :remove_channels_from_push
67
67
  OPERATION_REMOVE_DEVICE_FROM_PUSH = :remove_device_from_push
68
+ OPERATION_SIGNAL = :signal
68
69
 
69
70
  OPERATIONS = [
70
71
  OPERATION_SUBSCRIBE, OPERATION_HEARTBEAT, OPERATION_PRESENCE, OPERATION_TIME, OPERATION_HISTORY,
@@ -72,7 +73,7 @@ module Pubnub
72
73
  OPERATION_LIST_ALL_CHANNELS_IN_CHANNEL_GROUP, OPERATION_CHANNEL_GROUP_ADD, OPERATION_CHANNEL_GROUP_REMOVE,
73
74
  OPERATION_AUDIT, OPERATION_GRANT, OPERATION_REVOKE, OPERATION_WHERE_NOW, OPERATION_MESSAGE_COUNTS,
74
75
  OPERATION_ADD_CHANNELS_TO_PUSH, OPERATION_LIST_PUSH_PROVISIONS, OPERATION_REMOVE_CHANNELS_FROM_PUSH,
75
- OPERATION_REMOVE_DEVICE_FROM_PUSH
76
+ OPERATION_REMOVE_DEVICE_FROM_PUSH, OPERATION_SIGNAL
76
77
  ].freeze
77
78
 
78
79
  # Announcements
@@ -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
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Toplevel Pubnub module.
4
+ module Pubnub
5
+ # Holds history functionality
6
+ class Signal < SingleEvent
7
+ include Concurrent::Async
8
+ include Pubnub::Validator::Signal
9
+
10
+ attr_reader :store
11
+
12
+ def initialize(options, app)
13
+ @event = :signal
14
+ @telemetry_name = :l_sig
15
+ super
16
+ @sequence_number = sequence_number!
17
+ @origination_time_token = @app.generate_ortt
18
+ end
19
+
20
+ private
21
+
22
+ def current_operation
23
+ Pubnub::Constants::OPERATION_SIGNAL
24
+ end
25
+
26
+ def parameters(*_args)
27
+ params = super
28
+
29
+ params = params.merge(seqn: @sequence_number,
30
+ ortt: { t: @origination_time_token })
31
+ params
32
+ end
33
+
34
+ def path
35
+ '/' + [
36
+ 'signal',
37
+ @publish_key,
38
+ @subscribe_key,
39
+ '0',
40
+ Formatter.format_channel(@channel, true),
41
+ '0',
42
+ Formatter.format_message(@message, @cipher_key)
43
+ ].join('/')
44
+ end
45
+
46
+ def sequence_number!
47
+ @app.sequence_number_for_publish!
48
+ end
49
+
50
+ def timetoken(parsed_response)
51
+ parsed_response[2]
52
+ rescue StandardError
53
+ nil
54
+ end
55
+
56
+ def response_message(parsed_response)
57
+ parsed_response[1]
58
+ rescue StandardError
59
+ nil
60
+ end
61
+
62
+ def valid_envelope(parsed_response, req_res_objects)
63
+ Pubnub::Envelope.new(
64
+ event: @event,
65
+ event_options: @given_options,
66
+ timetoken: timetoken(parsed_response),
67
+ status: {
68
+ code: req_res_objects[:response].code,
69
+ operation: Pubnub::Constants::OPERATION_SIGNAL,
70
+ client_request: req_res_objects[:request],
71
+ server_response: req_res_objects[:response],
72
+ data: nil,
73
+ category: Pubnub::Constants::STATUS_ACK,
74
+ error: false,
75
+ auto_retried: false,
76
+
77
+ current_timetoken: nil,
78
+ last_timetoken: nil,
79
+ subscribed_channels: nil,
80
+ subscribed_channel_groups: nil,
81
+
82
+ config: get_config
83
+ }
84
+ )
85
+ end
86
+ end
87
+ end