centrifuge 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/centrifuge/client.rb +4 -0
- data/lib/centrifuge/version.rb +1 -1
- data/spec/client_spec.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98fe217d5cfae7faea96a53a7639a26b66a48038
|
4
|
+
data.tar.gz: c4d0450027b408d23bb13da3ccf5400a7939ef6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15a092b443b206561f95a29c71271391f0258c283f80dd6db23a25518681b01c780cf3c411692884aee6df4a8db3ee9de2470d54d68f160f8607f47beecfd552
|
7
|
+
data.tar.gz: 2e6d765c38c309bc18bf195c3ee934d7203c1b9494c99a50482b40137a023c3c9e00f169ea33b31fb6321ac1c570adae28f28d9db55c253ce5fd2e852d7b5cd5
|
data/lib/centrifuge/client.rb
CHANGED
@@ -39,6 +39,10 @@ module Centrifuge
|
|
39
39
|
})
|
40
40
|
end
|
41
41
|
|
42
|
+
def broadcast(channels, data)
|
43
|
+
Centrifuge::Builder.new('broadcast', { channels: channels, data: data }, self).process
|
44
|
+
end
|
45
|
+
|
42
46
|
def publish(channel, data)
|
43
47
|
Centrifuge::Builder.new('publish', { channel: channel, data: data }, self).process
|
44
48
|
end
|
data/lib/centrifuge/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Centrifuge::Client do
|
4
|
-
let(:options) { { scheme: :https, host: 'centrifugo
|
4
|
+
let(:options) { { scheme: :https, host: 'centrifugo.herokuapp.com', port: 443, secret: 'secret' } }
|
5
5
|
let(:client) { Centrifuge::Client.new(options) }
|
6
6
|
let(:data) { { action: :test } }
|
7
7
|
|
8
8
|
it 'generates url' do
|
9
|
-
expect(client.url.to_s).to eq "https://centrifugo
|
9
|
+
expect(client.url.to_s).to eq "https://centrifugo.herokuapp.com:443/api/"
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'publishes data' do
|
@@ -14,6 +14,12 @@ describe Centrifuge::Client do
|
|
14
14
|
expect(client.publish(channel, data)).to eq [{"body" => nil, "error" => nil, "method" => "publish"}]
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'broadcasts data' do
|
18
|
+
channel = SecureRandom.hex
|
19
|
+
channel1 = SecureRandom.hex
|
20
|
+
expect(client.broadcast([channel, channel1], data)).to eq [{"body" => nil, "error" => nil, "method" => "broadcast"}]
|
21
|
+
end
|
22
|
+
|
17
23
|
it 'unsubscribes user' do
|
18
24
|
channel = SecureRandom.hex
|
19
25
|
expect(client.unsubscribe(channel, "23")).to eq [{"body"=>nil, "error"=>nil, "method"=>"unsubscribe"}]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: centrifuge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Bovykin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|