centrifuge 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dd6a57d6f6525d54ff0000a21749dce050db914
4
- data.tar.gz: 7d83d816656b36548c99d62375bf42b20a68f6f2
3
+ metadata.gz: 98fe217d5cfae7faea96a53a7639a26b66a48038
4
+ data.tar.gz: c4d0450027b408d23bb13da3ccf5400a7939ef6f
5
5
  SHA512:
6
- metadata.gz: 82e6e2ae22dc001988effd042d17ce99ab7f9e0616097bcbb75aa71288a5ca9fe473c146dc06d9f7835c64592876dbfe07184f3ec21c996cdc743bb729a3775c
7
- data.tar.gz: 8b52a71f68ebaaf6b4a157c0f86006d6650cfdf3df6f67283d7c91ed13c4c8e99c8da0d19ed8e38a0b14dd2b1b6f24f3fbd34a22d2b7d80c904828e480d84658
6
+ metadata.gz: 15a092b443b206561f95a29c71271391f0258c283f80dd6db23a25518681b01c780cf3c411692884aee6df4a8db3ee9de2470d54d68f160f8607f47beecfd552
7
+ data.tar.gz: 2e6d765c38c309bc18bf195c3ee934d7203c1b9494c99a50482b40137a023c3c9e00f169ea33b31fb6321ac1c570adae28f28d9db55c253ce5fd2e852d7b5cd5
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Centrifuge
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
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-dev.herokuapp.com', port: 443, secret: 'secret' } }
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-dev.herokuapp.com:443/api/"
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.1
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: 2015-10-29 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient