pubnub 4.0.14 → 4.0.15
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 +4 -4
- data/.pubnub.yml +8 -1
- data/CHANGELOG.md +3 -2
- data/Gemfile.lock +2 -0
- data/Pubnub Ruby SDK upgrade guide.md +1304 -0
- data/VERSION +1 -1
- data/lib/pubnub/event.rb +2 -0
- data/lib/pubnub/pam.rb +4 -0
- data/lib/pubnub/version.rb +1 -1
- metadata +4 -4
- data/UPGRADE_GUIDE.md +0 -51
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.0.
|
1
|
+
4.0.15
|
data/lib/pubnub/event.rb
CHANGED
@@ -80,6 +80,8 @@ module Pubnub
|
|
80
80
|
variables_for_signature
|
81
81
|
].join("\n")
|
82
82
|
|
83
|
+
message = message.gsub(/[!~*'()]/) { |char| '%' + char.ord.to_s(16).upcase }
|
84
|
+
|
83
85
|
URI.encode_www_form_component(Base64.encode64(
|
84
86
|
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
|
85
87
|
@app.env[:secret_key].to_s, message)
|
data/lib/pubnub/pam.rb
CHANGED
@@ -19,6 +19,10 @@ module Pubnub
|
|
19
19
|
@event,
|
20
20
|
variables_for_signature
|
21
21
|
].join("\n")
|
22
|
+
|
23
|
+
# Replace ! ~ * ' ( )
|
24
|
+
message = message.gsub(/[!~*'()]/) { |char| '%' + char.ord.to_s(16).upcase }
|
25
|
+
|
22
26
|
Base64.urlsafe_encode64(
|
23
27
|
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
|
24
28
|
@secret_key.to_s, message)
|
data/lib/pubnub/version.rb
CHANGED
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.
|
4
|
+
version: 4.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PubNub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -103,9 +103,9 @@ files:
|
|
103
103
|
- Gemfile
|
104
104
|
- Gemfile.lock
|
105
105
|
- LICENSE.txt
|
106
|
+
- Pubnub Ruby SDK upgrade guide.md
|
106
107
|
- README.md
|
107
108
|
- Rakefile
|
108
|
-
- UPGRADE_GUIDE.md
|
109
109
|
- VERSION
|
110
110
|
- docs.md
|
111
111
|
- fixtures/vcr_cassettes/client/connection_callbacks_0.yml
|
@@ -10610,7 +10610,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
10610
10610
|
version: '0'
|
10611
10611
|
requirements: []
|
10612
10612
|
rubyforge_project:
|
10613
|
-
rubygems_version: 2.5.
|
10613
|
+
rubygems_version: 2.5.2
|
10614
10614
|
signing_key:
|
10615
10615
|
specification_version: 4
|
10616
10616
|
summary: PubNub Official Ruby gem.
|
data/UPGRADE_GUIDE.md
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
### Upgrade Guide 3.8.x to 4.0.x
|
2
|
-
|
3
|
-
##### Envelope result
|
4
|
-
|
5
|
-
Pubnub Ruby SDK `4.x` version uses new `Envelope` object for response. You can find here how it is structured:
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
envelope.id # unique envelope ID for internal usage
|
9
|
-
envelope.event # event key (:publish, :time, :grant etc.)
|
10
|
-
envelope.event_options # options given to the event when it was fired
|
11
|
-
envelope.status # status response Hash
|
12
|
-
envelope.result # result response Hash
|
13
|
-
envelope.timetoken # timetoken
|
14
|
-
```
|
15
|
-
|
16
|
-
Status and result structures for specific events can be found in our [docs](https://www.pubnub.com/docs/ruby/api-reference-sdk-v4).
|
17
|
-
|
18
|
-
##### Subscribe changes
|
19
|
-
|
20
|
-
Subscribe callbacks has been completly reworked and now uses listeners (`SubscribeCalback`).
|
21
|
-
|
22
|
-
For example, let's upgrade old code:
|
23
|
-
```
|
24
|
-
# Old code
|
25
|
-
pubnub.subscribe(channel: :demo){ |envelope| puts "MSG: #{envelope}" }
|
26
|
-
pubnub.presence(channel: :demo){ |envelope| puts "PRESENCE #{envelope}" }
|
27
|
-
|
28
|
-
# New code
|
29
|
-
|
30
|
-
# We're creating listener here
|
31
|
-
callbacks = Pubnub::SubscribeCallback.new(
|
32
|
-
# Fired for messages
|
33
|
-
message: ->(envelope) {
|
34
|
-
puts "MSG: #{envelope.result}" if envelope.result[:data][:message_meta_data]['uuid'] != pubnub.uuid
|
35
|
-
},
|
36
|
-
# Fired for presence events
|
37
|
-
presence: ->(envelope) {
|
38
|
-
puts "PRESENCE #{envelope.result}"
|
39
|
-
},
|
40
|
-
# Fired for status events (like `connected`)
|
41
|
-
status: ->(envelope) {
|
42
|
-
puts "STATUS #{envelope.status}"
|
43
|
-
}
|
44
|
-
)
|
45
|
-
|
46
|
-
# Here it's added to listeners
|
47
|
-
pubnub.add_listener(callback: callbacks)
|
48
|
-
|
49
|
-
# Finally we're firing subscribe
|
50
|
-
pubnub.subscribe(channel: :demo, presence: :demo)
|
51
|
-
```
|