require "spec_helper" describe Pubnub::Grant do around :each do |example| @fired = false @callback = -> (_envelope) do @fired = true end @pubnub = Pubnub.new( publish_key: "pub-a-mock-key", subscribe_key: "sub-a-mock-key", secret_key: "sec-a-mock-key", uuid: "ruby-test-uuid-client-one", auth_key: "ruby-test-auth-client-one", ) example.run_with_retry retry: 10 end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1913", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186924" Pubnub::Grant.any_instance.stub(:signature).and_return "iwq4P9Pj380rmcE12kKqVC6wxEYIRZtWW7PLPA-wlBg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1911", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186925" Pubnub::Grant.any_instance.stub(:signature).and_return "sm7tz3s44S5KljquSZfYX5qUBJq8McoklzIcLQi07is=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1912", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186925" Pubnub::Grant.any_instance.stub(:signature).and_return "sm7tz3s44S5KljquSZfYX5qUBJq8McoklzIcLQi07is=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1910", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187231" Pubnub::Grant.any_instance.stub(:signature).and_return "wNl-bByPNOqbKeeGMAqGfPUJC8IYMbKedveEdJoJ4mM=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1908", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187232" Pubnub::Grant.any_instance.stub(:signature).and_return "_R_8sJjWHdZjN2g9ZrYhAZ-Hn9-66d8d_qfZvX3XRNc=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1909", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187232" Pubnub::Grant.any_instance.stub(:signature).and_return "_R_8sJjWHdZjN2g9ZrYhAZ-Hn9-66d8d_qfZvX3XRNc=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1919", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186928" Pubnub::Grant.any_instance.stub(:signature).and_return "wWOSE13yYPPOQs6Il6R_aQivI56bWnGo09WfiG1Zsyg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1917", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186929" Pubnub::Grant.any_instance.stub(:signature).and_return "ocOqrv_x-pY6bfenV34lDbv_BUrpSfnPuAg6OFLbI7A=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1918", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186929" Pubnub::Grant.any_instance.stub(:signature).and_return "ocOqrv_x-pY6bfenV34lDbv_BUrpSfnPuAg6OFLbI7A=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1916", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187233" Pubnub::Grant.any_instance.stub(:signature).and_return "M2RdX5RXunS9Xx2uxYWbMs0BFvtgO1m4dYga-Xvdkzs=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1914", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187233" Pubnub::Grant.any_instance.stub(:signature).and_return "M2RdX5RXunS9Xx2uxYWbMs0BFvtgO1m4dYga-Xvdkzs=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1915", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187234" Pubnub::Grant.any_instance.stub(:signature).and_return "MrjD1i1-EnUqvHopiPA7bFqTwdbdwmlTJpiaktwkzq8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1925", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186932" Pubnub::Grant.any_instance.stub(:signature).and_return "b7k2zBPsanhdw2xyBuDGuFhPPCSRG8nsWDU-cy9Ht60=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1923", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186932" Pubnub::Grant.any_instance.stub(:signature).and_return "b7k2zBPsanhdw2xyBuDGuFhPPCSRG8nsWDU-cy9Ht60=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1924", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186933" Pubnub::Grant.any_instance.stub(:signature).and_return "0_stP4mnBfB78C8SxyFIJAh_dZ2oQ5lPx_lM0RSC14E=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1922", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187234" Pubnub::Grant.any_instance.stub(:signature).and_return "kpkeml0Fa9pYGjibka3F1cjIxotbAONuJx2Zh90tWVo=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1920", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187235" Pubnub::Grant.any_instance.stub(:signature).and_return "HW29BU-vwo6_28NIsiiyiBM4KEWEDlhnOa6YME0Layg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1921", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187040" Pubnub::Grant.any_instance.stub(:signature).and_return "KZPxcwvgXXMS-plSW8M1HrCf2RZOgLvNXYGoEqBJnZU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1931", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186935" Pubnub::Grant.any_instance.stub(:signature).and_return "Hyaq4LN9LZMHIOvfrywGCRxJp4f1GXJdZBkyaLDg1Io=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1929", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186936" Pubnub::Grant.any_instance.stub(:signature).and_return "UQPTRvGAqsGF-ioINZFts2PWrdTldrY509TU1X_l3Bc=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1930", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186937" Pubnub::Grant.any_instance.stub(:signature).and_return "BuvF1Zmhy6PFJwaNrLz_-IVq9OHoKA5kMovdIYoR2Ag=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1928", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187235" Pubnub::Grant.any_instance.stub(:signature).and_return "Yv01KKs5tJsB_SZZlSM72Xa31bqMspcoSQGFCSVGw3g=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1926", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187236" Pubnub::Grant.any_instance.stub(:signature).and_return "8KpAhzfk9fyUEoOc9TKA7zoDLiyUhMCvwVc90kycMGg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1927", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187042" Pubnub::Grant.any_instance.stub(:signature).and_return "kPig_fzKd-kifL-gtODnjPeTn05j3GhUR9OeDE147o8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1937", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186939" Pubnub::Grant.any_instance.stub(:signature).and_return "Pn9AZ8SHV5RKiOLDKPsrYAn5KuKNgNHblN7vk8mzylA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1935", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186940" Pubnub::Grant.any_instance.stub(:signature).and_return "cKKnOUrQF7ETAcuk8UPcFycF-QdcEarksJ6eWsNt-9M=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1936", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186941" Pubnub::Grant.any_instance.stub(:signature).and_return "nVECRpx-_MAae0_CAYrYFjD5wfl0u-kbs8dEf6N7bc4=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1934", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187236" Pubnub::Grant.any_instance.stub(:signature).and_return "lckK8otiXFk3Ghb2rV2VqMvlVR5eGDYc5QkP3PY9b8Q=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1932", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187043" Pubnub::Grant.any_instance.stub(:signature).and_return "kmGWqP3-_1XHv9US_QswlEyAnRWvJB2aoaSNa2mxJeg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1933", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187237" Pubnub::Grant.any_instance.stub(:signature).and_return "9bW08PxeC6uLt1RfVi8bYOAV3fgpAIYUjw-ndL0y0-E=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1943", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186943" Pubnub::Grant.any_instance.stub(:signature).and_return "7bTlzeShikOLqlIPJy4s4CAfV5Zv86mzuQbhtEK4sL0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1941", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186944" Pubnub::Grant.any_instance.stub(:signature).and_return "60LEYUEhZSe1A3fxlUBkoz2dgEqQ0qTgWBNWveYqQIE=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1942", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186945" Pubnub::Grant.any_instance.stub(:signature).and_return "MKrORnQh1u22FVyZAsNDfGrEUzGewgSCcfOXIa4txhs=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1940", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187237" Pubnub::Grant.any_instance.stub(:signature).and_return "AP2vth9lqsHAg_PWmWqOJtf87sHNnCYKAuPPx-z59vk=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1938", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187238" Pubnub::Grant.any_instance.stub(:signature).and_return "xqpcE_21Fz-vYwyM0jxm2FttDxGp6DMNWYkb-4_LWa0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1939", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186946" Pubnub::Grant.any_instance.stub(:signature).and_return "Hp_-ZokI0WwmEeKLlqxIvWCupdc3AmfcdwJXUcPwjE8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1841", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186947" Pubnub::Grant.any_instance.stub(:signature).and_return "XTCtch158jAYlFpymAQS6vQwmeRovd9bb4Vcc8y7_Yo=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1839", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186948" Pubnub::Grant.any_instance.stub(:signature).and_return "QdY_NVnaBQ2ee_XlFHesxNaiVdtXggJsmlQPg6ZyMmM=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1840", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186949" Pubnub::Grant.any_instance.stub(:signature).and_return "CziI_i2FE6uXABoASY7vORFTVeG_xQ2jA7r8FhMoTEo=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1838", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187239" Pubnub::Grant.any_instance.stub(:signature).and_return "UVLII9q8q2pdD3Ji8K4PXRbJLQbPFCo0r9orajc1M5c=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1836", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187239" Pubnub::Grant.any_instance.stub(:signature).and_return "UVLII9q8q2pdD3Ji8K4PXRbJLQbPFCo0r9orajc1M5c=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1837", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187046" Pubnub::Grant.any_instance.stub(:signature).and_return "gflNsZPpBYtsrwpUhuIr0RjWKsEjgRlSmvd7b8uIPh0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1847", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186951" Pubnub::Grant.any_instance.stub(:signature).and_return "qVY15G9yTO-4rhfe0-chzdyMcUnJF45DoGP6hbhxcIY=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1845", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186952" Pubnub::Grant.any_instance.stub(:signature).and_return "Kd_zjtb_iH0BS8zpgS4IZKU0kRKWs78lHjxlVxLWslg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1846", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186953" Pubnub::Grant.any_instance.stub(:signature).and_return "Hp4M3crhwPrv5_5f8Ds7K9-duQHtJSov5b19NksX1K0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1844", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187240" Pubnub::Grant.any_instance.stub(:signature).and_return "NZXVZq-SUPl_nhtfeQ95TLJuzO-Gkb3YeVBops6u6WI=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1842", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187240" Pubnub::Grant.any_instance.stub(:signature).and_return "NZXVZq-SUPl_nhtfeQ95TLJuzO-Gkb3YeVBops6u6WI=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1843", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187047" Pubnub::Grant.any_instance.stub(:signature).and_return "Jhwjy3prf1dShvH-JA-pC2_fhTasVM-Nwxokvgeemwg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1853", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186955" Pubnub::Grant.any_instance.stub(:signature).and_return "93W9Jt6srHYJoW-2gBYhL97QX25aHtBUatFnGPIJ_es=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1851", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186956" Pubnub::Grant.any_instance.stub(:signature).and_return "wwQ2Y3E4m0eC6PDktNjL--Bu_TkfslgQowQ7ue8osqo=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1852", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186956" Pubnub::Grant.any_instance.stub(:signature).and_return "wwQ2Y3E4m0eC6PDktNjL--Bu_TkfslgQowQ7ue8osqo=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1850", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187241" Pubnub::Grant.any_instance.stub(:signature).and_return "_lEGm5hEy6vVRwthyZrFYFxrQm4emuetXrx-6vwpdeU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1848", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187241" Pubnub::Grant.any_instance.stub(:signature).and_return "_lEGm5hEy6vVRwthyZrFYFxrQm4emuetXrx-6vwpdeU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1849", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187242" Pubnub::Grant.any_instance.stub(:signature).and_return "bySn0QFEBPO9_Fs7GM-EcA5aem3chpK6UQvNroG9epg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1859", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186959" Pubnub::Grant.any_instance.stub(:signature).and_return "nqNhaw8Dc9x8BlgbrLVHCETRCc5Ev5m33BfyL2Adxac=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1857", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186960" Pubnub::Grant.any_instance.stub(:signature).and_return "xHOu487QZurVioytfm-E-tuvu1Dh-rwZAlHTU2HlwRU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1858", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186960" Pubnub::Grant.any_instance.stub(:signature).and_return "xHOu487QZurVioytfm-E-tuvu1Dh-rwZAlHTU2HlwRU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1856", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464697440" Pubnub::Grant.any_instance.stub(:signature).and_return "WX6fD3kBnhMu_6_VJbdFaIvaWHg4Z41fm_G_DNjNs38=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1854", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187242" Pubnub::Grant.any_instance.stub(:signature).and_return "dOwiTXUKPEPBWNB3yJefl52078yRdnHdj2_KHnKdIb0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1855", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187243" Pubnub::Grant.any_instance.stub(:signature).and_return "r8BaasDEuDfpxT_6y2N0DaqUPNQYUzeVBoJCA_I2jqI=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1865", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186963" Pubnub::Grant.any_instance.stub(:signature).and_return "VcJt4XhJBB6tnXn7Y8OKCRvUH6EC8DFobSC0ffJUxIM=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1863", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186963" Pubnub::Grant.any_instance.stub(:signature).and_return "VcJt4XhJBB6tnXn7Y8OKCRvUH6EC8DFobSC0ffJUxIM=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1864", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186964" Pubnub::Grant.any_instance.stub(:signature).and_return "JIVZOfvwhla_XnWTlgbGJ4kUIkCHgzhJABr2Dz2Usec=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1862", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187243" Pubnub::Grant.any_instance.stub(:signature).and_return "PjfBNccf0CaxrjG3EIYLkoz0KvhM1jkIHQBmgCKE9zU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1860", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187244" Pubnub::Grant.any_instance.stub(:signature).and_return "BHXJvbk8R34Ry_r9jftiNgkVLAZpO5F1pFirz1MfPLc=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1861", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187244" Pubnub::Grant.any_instance.stub(:signature).and_return "BHXJvbk8R34Ry_r9jftiNgkVLAZpO5F1pFirz1MfPLc=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1871", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186967" Pubnub::Grant.any_instance.stub(:signature).and_return "1HdwwE2ydNisXyaMhB9M65nKqOcReB_HhhWXDHJp8u8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1869", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186967" Pubnub::Grant.any_instance.stub(:signature).and_return "1HdwwE2ydNisXyaMhB9M65nKqOcReB_HhhWXDHJp8u8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1870", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186968" Pubnub::Grant.any_instance.stub(:signature).and_return "DZ0g0apAocucRhxcaEDv224DB-RkWRYa7s0q4WI_bo4=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1868", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187245" Pubnub::Grant.any_instance.stub(:signature).and_return "tBH8jeqvSUAAfLC67xIX3Xk2Pl1SbIOaCiivz5_IqkA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1866", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187245" Pubnub::Grant.any_instance.stub(:signature).and_return "tBH8jeqvSUAAfLC67xIX3Xk2Pl1SbIOaCiivz5_IqkA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1867", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187246" Pubnub::Grant.any_instance.stub(:signature).and_return "pc583ESSyO9KUVhb8tCLz9XBAE5p3iQB8nMvq0mAuv4=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1877", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186971" Pubnub::Grant.any_instance.stub(:signature).and_return "vJweWvEHrdPAcOjWG2uPpMpEarrax-azydmT8qcueaw=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1875", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186972" Pubnub::Grant.any_instance.stub(:signature).and_return "f7AqlqSQQJLIshJ7EN4iE3H5LYaQr5jbckbtgjYK2sE=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1876", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186972" Pubnub::Grant.any_instance.stub(:signature).and_return "f7AqlqSQQJLIshJ7EN4iE3H5LYaQr5jbckbtgjYK2sE=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1874", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187246" Pubnub::Grant.any_instance.stub(:signature).and_return "X6xu0ad1SJJ4NSoFIj_HRHqXDSNAMDzuxpOWWytNI5Y=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1872", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187247" Pubnub::Grant.any_instance.stub(:signature).and_return "kY4KdHSisNkc35_C3kOz7Trc6zcAkF4Hi9KkinaAFnQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1873", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187248" Pubnub::Grant.any_instance.stub(:signature).and_return "opIhjJuQQWLPvMmC5yqV5VqWYbwh9r7pOf09yaZ0Ocg=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1883", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186975" Pubnub::Grant.any_instance.stub(:signature).and_return "_zJAQvWnMG3Rl9xUeneFR3L4HKeD-SQvcNQf2ukZbVA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1881", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186976" Pubnub::Grant.any_instance.stub(:signature).and_return "Y5f-350XY9RfXeYGxrSQqfV3qIALYXRA9xClehaYw6A=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1882", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186976" Pubnub::Grant.any_instance.stub(:signature).and_return "Y5f-350XY9RfXeYGxrSQqfV3qIALYXRA9xClehaYw6A=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1880", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187248" Pubnub::Grant.any_instance.stub(:signature).and_return "-Qegla9W9HuSq2DtbdlZx9OH8YTVJoMEAGOH5ykRBLk=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1878", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187249" Pubnub::Grant.any_instance.stub(:signature).and_return "qDVAM4PVbp1CcY7MhCF0FQorC5OEW7ebkSTZj9S-7a0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1879", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187249" Pubnub::Grant.any_instance.stub(:signature).and_return "qDVAM4PVbp1CcY7MhCF0FQorC5OEW7ebkSTZj9S-7a0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1889", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186979" Pubnub::Grant.any_instance.stub(:signature).and_return "P9ZmvV-DPanmQSFOl654ig9aiqJG8_j_zaODLa4zZCA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1887", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186980" Pubnub::Grant.any_instance.stub(:signature).and_return "Kl3La21OvMykVbSxZyZYiXDREBDGnY87y9H66G9Gkow=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1888", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186980" Pubnub::Grant.any_instance.stub(:signature).and_return "Kl3La21OvMykVbSxZyZYiXDREBDGnY87y9H66G9Gkow=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1886", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464697441" Pubnub::Grant.any_instance.stub(:signature).and_return "1VF5L2EsGml1XJPutqgxvQSojTMiTbsFf3mGyr_Y_HU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1884", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187250" Pubnub::Grant.any_instance.stub(:signature).and_return "jHKA1Vgk4Ma-aA1YjPCWJ3gtm2-UomqrMtRnJHFDVpA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1885", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186982" Pubnub::Grant.any_instance.stub(:signature).and_return "F48TQxcMrJ-MKz4XIS2q6AbmtsQH2Ffygni2M43EqhM=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1895", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186983" Pubnub::Grant.any_instance.stub(:signature).and_return "gu0S3rg7vdX1H8hrcM0V1-z1W5K1PV2mI2TwKrx6g1U=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1893", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186984" Pubnub::Grant.any_instance.stub(:signature).and_return "0D-MrXYRtXldx7c4Fi7nTPTw-KvRuH0riGIpYruDdC8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1894", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186985" Pubnub::Grant.any_instance.stub(:signature).and_return "lnvBl63HQ4-q1-gklOaULWwFY8w3ERbk6tvfpwT6AOY=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1892", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187250" Pubnub::Grant.any_instance.stub(:signature).and_return "POyfnIt0yEdPJns_6BDP6Ny7E308SXYRP40OtKL5RgA=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1890", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187251" Pubnub::Grant.any_instance.stub(:signature).and_return "GCEaF9I_6f_EZK2SwMu6otZIZcK15KxvAhQbbthZQik=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1891", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187252" Pubnub::Grant.any_instance.stub(:signature).and_return "5kxb1_hxJqKmrtgnwVztd-6Ma2W7KVQozsDiLrwJVqI=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1901", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186987" Pubnub::Grant.any_instance.stub(:signature).and_return "aY9fBOwo2dUMl_FqnMXyApKo60qNBjvOpUjWu6kbx0M=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1899", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186988" Pubnub::Grant.any_instance.stub(:signature).and_return "NBlhZUYbLLJMjtYxnudl9oclwsjCbAksSZcYMSDGprU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1900", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186988" Pubnub::Grant.any_instance.stub(:signature).and_return "NBlhZUYbLLJMjtYxnudl9oclwsjCbAksSZcYMSDGprU=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1898", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187252" Pubnub::Grant.any_instance.stub(:signature).and_return "cPu-3y-F7AziChvyIzp3mdWpd1YGYkAmMfD2KkIi4EM=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1896", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187060" Pubnub::Grant.any_instance.stub(:signature).and_return "DcHveMY2YlAGf8Dq4X0l_YjCSM3ApdVxAlvZ4Qzr718=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1897", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187253" Pubnub::Grant.any_instance.stub(:signature).and_return "wj63BPDjseMK-8LI4C19YFmyrKnQlKsmZdP8DEm0O94=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1907", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186991" Pubnub::Grant.any_instance.stub(:signature).and_return "AXNemcq9arlgaXMBd3KqJKOtz-e9vcSGb7weJOdB8ts=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1905", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186991" Pubnub::Grant.any_instance.stub(:signature).and_return "AXNemcq9arlgaXMBd3KqJKOtz-e9vcSGb7weJOdB8ts=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1906", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464186992" Pubnub::Grant.any_instance.stub(:signature).and_return "ygfiPgruGtsRBHKjjGpVmjaidALvnwkXw5OWEKxKKXc=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1904", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187253" Pubnub::Grant.any_instance.stub(:signature).and_return "HNYr6maQaL6SQRHHLH_M9jP3tk-A1zWRl87hNA-otM0=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1902", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187254" Pubnub::Grant.any_instance.stub(:signature).and_return "xhU6zCRckudhYoLKk6bCLKRiyGl-G6bOYNwNWXBYD84=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1903", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187254" Pubnub::Grant.any_instance.stub(:signature).and_return "xhU6zCRckudhYoLKk6bCLKRiyGl-G6bOYNwNWXBYD84=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1697", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187063" Pubnub::Grant.any_instance.stub(:signature).and_return "zEtl3VsszHA61_BCdwlSKbWLBgi1mPow5-zIOWZGFXk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1695", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187064" Pubnub::Grant.any_instance.stub(:signature).and_return "R0MLfLI3Qt6_knCqlbZzk0CLzu0kVHdM3cr0KlJ6e7Y=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1696", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187065" Pubnub::Grant.any_instance.stub(:signature).and_return "0xFcSeqlSleE8hg9k3zBO_Px0AonKxsQdPRnml8yDfQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1694", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187255" Pubnub::Grant.any_instance.stub(:signature).and_return "NwZ-TC3uCyFZtfO_CQ_EDQLypHw9xbXKCmv7fJdzaZc=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1692", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187065" Pubnub::Grant.any_instance.stub(:signature).and_return "0xFcSeqlSleE8hg9k3zBO_Px0AonKxsQdPRnml8yDfQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1693", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187255" Pubnub::Grant.any_instance.stub(:signature).and_return "NwZ-TC3uCyFZtfO_CQ_EDQLypHw9xbXKCmv7fJdzaZc=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1703", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187067" Pubnub::Grant.any_instance.stub(:signature).and_return "L_opq3JFcet45BgV75p4k1544Nrb-D77TByiTGd1A9c=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1701", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187068" Pubnub::Grant.any_instance.stub(:signature).and_return "jUgihv5k9uueXrkldH9GuEId1NNMBx_IvWv8wYZlyHA=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1702", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187069" Pubnub::Grant.any_instance.stub(:signature).and_return "My5cfX6LPS3zjYPoXHzBpaIsmtjjj4S1_izQKUR4ZbE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1700", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187256" Pubnub::Grant.any_instance.stub(:signature).and_return "wweJIXcZJPwAcYTknNHA3Giqzno3ls3lFNplgc8eHy0=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1698", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187256" Pubnub::Grant.any_instance.stub(:signature).and_return "wweJIXcZJPwAcYTknNHA3Giqzno3ls3lFNplgc8eHy0=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1699", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187257" Pubnub::Grant.any_instance.stub(:signature).and_return "_FIoN0NDm-D0AdEuEyqmJOrZyuCGMuXmL4W8JhuYmc4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1709", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187072" Pubnub::Grant.any_instance.stub(:signature).and_return "LiCgmdpFKxnZY34-74oVJRhSR1DI2YJj4O_rQiDiWX4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1707", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187073" Pubnub::Grant.any_instance.stub(:signature).and_return "yEuiGWJR-XWz62pg58n4C13zzj7eys0bS13MMtnqeJ4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1708", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187073" Pubnub::Grant.any_instance.stub(:signature).and_return "yEuiGWJR-XWz62pg58n4C13zzj7eys0bS13MMtnqeJ4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1706", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187257" Pubnub::Grant.any_instance.stub(:signature).and_return "vm4lgVygg3-KxCBy1g_wsTDkxT2ez18h3ntdSbBopbg=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1704", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187258" Pubnub::Grant.any_instance.stub(:signature).and_return "iBgUjtBhi0vUndeM77S6ZahEpYpIN2Dy1ef4BkBcTNE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1705", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187258" Pubnub::Grant.any_instance.stub(:signature).and_return "iBgUjtBhi0vUndeM77S6ZahEpYpIN2Dy1ef4BkBcTNE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1715", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187076" Pubnub::Grant.any_instance.stub(:signature).and_return "G0PgrWZRURl0Kiz8t_QparXNDTr2mAzJue3nSzGoCYE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1713", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187076" Pubnub::Grant.any_instance.stub(:signature).and_return "G0PgrWZRURl0Kiz8t_QparXNDTr2mAzJue3nSzGoCYE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1714", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187077" Pubnub::Grant.any_instance.stub(:signature).and_return "734_8MBVLP065tQeogPS7F8S4nFzSwO1cLQs2BVXxNw=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1712", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187259" Pubnub::Grant.any_instance.stub(:signature).and_return "-5ntYZto868A1IjRtjI3YqGcv1cE5FRI3l723CZ4pfQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1710", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187260" Pubnub::Grant.any_instance.stub(:signature).and_return "AhJtegqtmOXyEfk3egfIzZ-7bpzKZhhLYOiI5LVfpLQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1711", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187260" Pubnub::Grant.any_instance.stub(:signature).and_return "AhJtegqtmOXyEfk3egfIzZ-7bpzKZhhLYOiI5LVfpLQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1721", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187079" Pubnub::Grant.any_instance.stub(:signature).and_return "wBNxiQkoy449WNnr952fL_Q24krg_F5ngwAI1VLotJk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1719", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187081" Pubnub::Grant.any_instance.stub(:signature).and_return "t2NK5vtZ3E0mvQKJedg0J2vBJ5sgdtLYvAMZu5PeqBY=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1720", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187081" Pubnub::Grant.any_instance.stub(:signature).and_return "t2NK5vtZ3E0mvQKJedg0J2vBJ5sgdtLYvAMZu5PeqBY=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1718", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187261" Pubnub::Grant.any_instance.stub(:signature).and_return "lwWWer1--eDaQ1aeJaBwPYepVg__m36urkmGa_8S1Kk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1716", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187261" Pubnub::Grant.any_instance.stub(:signature).and_return "lwWWer1--eDaQ1aeJaBwPYepVg__m36urkmGa_8S1Kk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1717", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187262" Pubnub::Grant.any_instance.stub(:signature).and_return "t_lPQjEXu7L_nXC_-22m1HWP544XQQsM8Y9ICHAydJk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1727", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187084" Pubnub::Grant.any_instance.stub(:signature).and_return "z-FzxTM76mqxii7GkZIwob6cGOrr84FYOtu0qc1DFM8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1725", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187085" Pubnub::Grant.any_instance.stub(:signature).and_return "reZSp8DKVPweEdrCpSRyTvNt8Z2RdNwThYtmkYB1aRM=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1726", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187085" Pubnub::Grant.any_instance.stub(:signature).and_return "reZSp8DKVPweEdrCpSRyTvNt8Z2RdNwThYtmkYB1aRM=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1724", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187262" Pubnub::Grant.any_instance.stub(:signature).and_return "taWuoOKAS54uen6bt7DM_j8sYNf9_j2RFxe8ET0Uvq8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1722", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187263" Pubnub::Grant.any_instance.stub(:signature).and_return "1mDU0cSTR5b_SXT1jKzYteY6BkSGjDHcgd5_qbT8wN8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1723", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187263" Pubnub::Grant.any_instance.stub(:signature).and_return "1mDU0cSTR5b_SXT1jKzYteY6BkSGjDHcgd5_qbT8wN8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1625", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187088" Pubnub::Grant.any_instance.stub(:signature).and_return "QeUXU8cz3mgVHJgiAyoGkp-wQXWVn1mpD82JFy4O-8c=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1623", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187089" Pubnub::Grant.any_instance.stub(:signature).and_return "6kse4OUFS1KA3_h7JhiOFu862hg5bfak2vCn7-GW9As=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1624", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187089" Pubnub::Grant.any_instance.stub(:signature).and_return "6kse4OUFS1KA3_h7JhiOFu862hg5bfak2vCn7-GW9As=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1622", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187264" Pubnub::Grant.any_instance.stub(:signature).and_return "WhA1kF6Crdc30AGpEQe179Q7OEaZxdXf9uCLidE5Uak=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1620", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187264" Pubnub::Grant.any_instance.stub(:signature).and_return "WhA1kF6Crdc30AGpEQe179Q7OEaZxdXf9uCLidE5Uak=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1621", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187091" Pubnub::Grant.any_instance.stub(:signature).and_return "GxiaeWVpPPxGFeo4tUihFHzb9kxlU0Xj0IoQRYrGXcQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1631", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187092" Pubnub::Grant.any_instance.stub(:signature).and_return "SNL6p7sCnFKV70irYbw1urBEhd-RnGsryO-WV1AP2dE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1629", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187093" Pubnub::Grant.any_instance.stub(:signature).and_return "r0vN-MsQzQBSDTMGZD57wbb14iTBgHtps-Au2ackqLM=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1630", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187094" Pubnub::Grant.any_instance.stub(:signature).and_return "wtivPYy_J3dqAgUuDeTEzLBnkPxvgs2l5dwvXdPDq-Y=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1628", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187265" Pubnub::Grant.any_instance.stub(:signature).and_return "XcDMEaiQmJiR_zxHMEbZTXEXwSTawldsBH4ltSKkzPQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1626", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187265" Pubnub::Grant.any_instance.stub(:signature).and_return "XcDMEaiQmJiR_zxHMEbZTXEXwSTawldsBH4ltSKkzPQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1627", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187266" Pubnub::Grant.any_instance.stub(:signature).and_return "r8lo4SDeE_To1g0SQEZomx4Exyh4NOALU6QX0Nvm4OU=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1637", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187096" Pubnub::Grant.any_instance.stub(:signature).and_return "Sv1ZNGB08Y0uu5Aca0g6u7FZ294laOd8aMeN8cSUgD8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1635", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187097" Pubnub::Grant.any_instance.stub(:signature).and_return "cqLA_vSu4Ybvg23Sh37XqbjT_amwCzODATdGlNG42C4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1636", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187098" Pubnub::Grant.any_instance.stub(:signature).and_return "H6gqjUhseTZWeg6tON5kjZjmmY4Q59ClUJW6xwQXCMM=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1634", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187267" Pubnub::Grant.any_instance.stub(:signature).and_return "ekfrOPFVdPXGN4nDaoSXSjSQNMzePlWc96rtUqqsD1U=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1632", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187267" Pubnub::Grant.any_instance.stub(:signature).and_return "ekfrOPFVdPXGN4nDaoSXSjSQNMzePlWc96rtUqqsD1U=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1633", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187268" Pubnub::Grant.any_instance.stub(:signature).and_return "dSpaAvdXjHCRXxwIP7W4809Hi04KGfQILo87XrwqOYw=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1643", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464697441" Pubnub::Grant.any_instance.stub(:signature).and_return "Qfuois83LrY7aWaOrB52gs8hdQQt-G-kJvcIBet87js=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1641", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187101" Pubnub::Grant.any_instance.stub(:signature).and_return "yFGitL5LvLTIrXNMr6kaj-bNSThLuuypZ5y50vWtiic=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1642", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187101" Pubnub::Grant.any_instance.stub(:signature).and_return "yFGitL5LvLTIrXNMr6kaj-bNSThLuuypZ5y50vWtiic=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1640", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187268" Pubnub::Grant.any_instance.stub(:signature).and_return "gkMSaQRaMnYilU0ZOMM9IAdIGPYzy61SXAT1QIkRA5k=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1638", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187269" Pubnub::Grant.any_instance.stub(:signature).and_return "geU2UhiSai-NMDlKvkQX9O-gu_54Ye2a2t5I3h9M8so=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1639", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187270" Pubnub::Grant.any_instance.stub(:signature).and_return "f0ngcGdgB_-0KG1jvEKQ65ydZ2tdg-bQdseHCEPP_b8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1649", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187104" Pubnub::Grant.any_instance.stub(:signature).and_return "rII0hrHvE46c2jc-x2-_1iAPcWUm5dxNifnQGd-JExk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1647", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187104" Pubnub::Grant.any_instance.stub(:signature).and_return "rII0hrHvE46c2jc-x2-_1iAPcWUm5dxNifnQGd-JExk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1648", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187106" Pubnub::Grant.any_instance.stub(:signature).and_return "CwAzFIwxpMQ0q37lrXTS569qPYCAnluibmCCJbI_ukA=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1646", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187270" Pubnub::Grant.any_instance.stub(:signature).and_return "WjX8pbtGu3ltr6E4SIGCojUYjqkJdqXcOyJEzAEJe7A=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1644", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187271" Pubnub::Grant.any_instance.stub(:signature).and_return "G6TJNTf9ENlB_QUPdD6FE4wnbbnSxsB_2SjoeqIPVgU=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1645", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187271" Pubnub::Grant.any_instance.stub(:signature).and_return "G6TJNTf9ENlB_QUPdD6FE4wnbbnSxsB_2SjoeqIPVgU=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1655", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187108" Pubnub::Grant.any_instance.stub(:signature).and_return "T0kMyKcNakwBRgMSXIQ4U8q6bxDIvTZDxXzChEU9GpI=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1653", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187109" Pubnub::Grant.any_instance.stub(:signature).and_return "g10pMK0g1BkzHEvN3n6WrOPCwnLAkxeyvurCWAkJogw=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1654", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187109" Pubnub::Grant.any_instance.stub(:signature).and_return "g10pMK0g1BkzHEvN3n6WrOPCwnLAkxeyvurCWAkJogw=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1652", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187272" Pubnub::Grant.any_instance.stub(:signature).and_return "rceOEowW7JP_Ej9v2IFToqtOkBs3CWPCYjid1UM75p4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1650", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187110" Pubnub::Grant.any_instance.stub(:signature).and_return "xbkRLWPwQujzULgtvo59AYMnw-3S9cx8XJ_CdNxnnAo=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1651", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187272" Pubnub::Grant.any_instance.stub(:signature).and_return "rceOEowW7JP_Ej9v2IFToqtOkBs3CWPCYjid1UM75p4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1661", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187112" Pubnub::Grant.any_instance.stub(:signature).and_return "praZD8Y_B8vImDL2BDrl11dcSWw303NbVgU9cNS2p2M=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1659", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187113" Pubnub::Grant.any_instance.stub(:signature).and_return "qyV6wD_rlRh1DUOqaoCtq9a2-vakUh0eMroYYfJu1ms=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1660", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187113" Pubnub::Grant.any_instance.stub(:signature).and_return "qyV6wD_rlRh1DUOqaoCtq9a2-vakUh0eMroYYfJu1ms=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1658", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187273" Pubnub::Grant.any_instance.stub(:signature).and_return "FRW99S_54_r8ixH0HdCrS6yipYlEwiErHmDD-8oOGhU=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1656", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187273" Pubnub::Grant.any_instance.stub(:signature).and_return "FRW99S_54_r8ixH0HdCrS6yipYlEwiErHmDD-8oOGhU=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1657", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187274" Pubnub::Grant.any_instance.stub(:signature).and_return "jBIbtgfGUQWM6TOdregsbxFMjSdtr2Hvqp_t6219hig=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1667", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187116" Pubnub::Grant.any_instance.stub(:signature).and_return "TUKL9EwAC5r2UsgVLu5vfqkLoonbtIdW75luuTBBdyc=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1665", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187117" Pubnub::Grant.any_instance.stub(:signature).and_return "hIUVsxdGHsNhtDIeujC83knvYeu6a9Jj3JoSi5c-HXA=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1666", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187118" Pubnub::Grant.any_instance.stub(:signature).and_return "Yv3l-KBfvDhl2iqkqIGfa7Inl3DV5BYkfrWFeGuHujY=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1664", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187274" Pubnub::Grant.any_instance.stub(:signature).and_return "D91M_a6n-QN4uC7JodyXpkBi2Deiao6fbAz-VP6UdM0=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1662", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187275" Pubnub::Grant.any_instance.stub(:signature).and_return "awZCtCSjyfe8qF85NlIkDXsP5Gnwxh4H9RVm_oalovA=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1663", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187119" Pubnub::Grant.any_instance.stub(:signature).and_return "gBEH59LU_m46TxPsK1IvChUZ2N4fEfWKvITER29dLCQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1673", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187120" Pubnub::Grant.any_instance.stub(:signature).and_return "AlcBpsIUTjRrGrUSw9WLc66IxNfRbvSLYzhoZvN5Ids=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1671", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187121" Pubnub::Grant.any_instance.stub(:signature).and_return "osJ_Sqva045XdaENHQOJ4SPuac6twxXEltcgMhJUPXc=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1672", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187122" Pubnub::Grant.any_instance.stub(:signature).and_return "jtsDdMEGgXxc3Db_DSCS52Blb05TuA51SyahoxwpVJw=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1670", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187275" Pubnub::Grant.any_instance.stub(:signature).and_return "fxSSsJ9WyFOh8rW4tZYS-dso0DOStmACabPQbA_lcK8=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1668", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187276" Pubnub::Grant.any_instance.stub(:signature).and_return "x89Km14JJJsgr1JZbWz90voOs5nsRaGDDrmJF_HJUJk=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1669", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187123" Pubnub::Grant.any_instance.stub(:signature).and_return "8fpwRiltFOisxAvx3VSeZrMiCDP53n6j09vV7M3F2ZA=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1679", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187124" Pubnub::Grant.any_instance.stub(:signature).and_return "d4CcgqkHE8e5JXmpyzmYi4qfjbftRaSkJtNb56J5C7Q=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1677", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187125" Pubnub::Grant.any_instance.stub(:signature).and_return "zL3w2pJ9KoCGgcPUja8PGbFLVpwi5yY1HKArfsvFNdQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1678", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187125" Pubnub::Grant.any_instance.stub(:signature).and_return "zL3w2pJ9KoCGgcPUja8PGbFLVpwi5yY1HKArfsvFNdQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1676", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187276" Pubnub::Grant.any_instance.stub(:signature).and_return "9ixp1NitveS0UwWLoFew101ioj8crWL8VGQbvZyUHLg=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1674", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187277" Pubnub::Grant.any_instance.stub(:signature).and_return "mTdFMJXqBPonRQ-KwOFXnXWQEoJ-K7voq959L_7cTQQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1675", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187277" Pubnub::Grant.any_instance.stub(:signature).and_return "mTdFMJXqBPonRQ-KwOFXnXWQEoJ-K7voq959L_7cTQQ=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1685", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464697442" Pubnub::Grant.any_instance.stub(:signature).and_return "fWd8mFPluNIn0XVkYmHXXo32YWl99Ax3app7edhlhXI=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1683", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187129" Pubnub::Grant.any_instance.stub(:signature).and_return "BKAfpv2NYmB_x_jdmwE1y_sE4lwcU98FMnruHiU7iKY=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1684", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187130" Pubnub::Grant.any_instance.stub(:signature).and_return "vagJeLCh2RAMnGCxBM1Bd7AsnjJoL--A2JyCQ5wG-yE=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1682", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187278" Pubnub::Grant.any_instance.stub(:signature).and_return "OCuA8Yjin6P1KDgITNseLvcXHR6U8GAFddNhehlakQw=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1680", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187279" Pubnub::Grant.any_instance.stub(:signature).and_return "-f6jfsPhffHeRlP3JPHn6J6wqpGwiQBcFoZw6o4-OA0=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1681", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187279" Pubnub::Grant.any_instance.stub(:signature).and_return "-f6jfsPhffHeRlP3JPHn6J6wqpGwiQBcFoZw6o4-OA0=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1691", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187132" Pubnub::Grant.any_instance.stub(:signature).and_return "BI-Ts8MFmqV9TH_8PZ3uQ1saz8Vm5B9IlyaXN15Cxjg=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1689", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187133" Pubnub::Grant.any_instance.stub(:signature).and_return "z00hEp9yOFvh0tFT0TgNJVuan3Jp_jmD29wV_xQSG7s=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1690", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187133" Pubnub::Grant.any_instance.stub(:signature).and_return "z00hEp9yOFvh0tFT0TgNJVuan3Jp_jmD29wV_xQSG7s=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1688", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187280" Pubnub::Grant.any_instance.stub(:signature).and_return "3VcKkZc4Xomtw25QsX8jVli3KBl2_p-gm5e3r0vzIc4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1686", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187280" Pubnub::Grant.any_instance.stub(:signature).and_return "3VcKkZc4Xomtw25QsX8jVli3KBl2_p-gm5e3r0vzIc4=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1687", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187281" Pubnub::Grant.any_instance.stub(:signature).and_return "F6CZMMHt1Wwbuu7-OsOzAbiFQ9sTA5Krm1dOCeCT9Bg=" envelope = @pubnub.grant(channel: :demo, read: true, write: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1805", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187136" Pubnub::Grant.any_instance.stub(:signature).and_return "Vsw-EBaHtJEombcNssjbdkFX2Kqyl26Rs3P-DMOBeUA=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1803", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187136" Pubnub::Grant.any_instance.stub(:signature).and_return "Vsw-EBaHtJEombcNssjbdkFX2Kqyl26Rs3P-DMOBeUA=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1804", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187137" Pubnub::Grant.any_instance.stub(:signature).and_return "YcIlYCkrlM2DOpDuI3rTjBGcLi_mCEbbtMoSW7F5zhU=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1802", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187281" Pubnub::Grant.any_instance.stub(:signature).and_return "iwLM1-00CS3hcHms7dppmQQCSq1W9BCqcAiyStMhUgQ=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1800", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187282" Pubnub::Grant.any_instance.stub(:signature).and_return "wgPN5Iewq_Ap-7aR3uhpvqxskl3o7DCFdA6P1aj0rb4=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1801", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187282" Pubnub::Grant.any_instance.stub(:signature).and_return "wgPN5Iewq_Ap-7aR3uhpvqxskl3o7DCFdA6P1aj0rb4=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1811", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187140" Pubnub::Grant.any_instance.stub(:signature).and_return "t8579D1qYjy1zObMdXnAjcFwyPmXg6si5Z5gd3nFNeI=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1809", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187141" Pubnub::Grant.any_instance.stub(:signature).and_return "QE-Xj3fd0qAvOXX0Zuik9P_aF_bMuLxIOGLSPn7ZY2s=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1810", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187141" Pubnub::Grant.any_instance.stub(:signature).and_return "QE-Xj3fd0qAvOXX0Zuik9P_aF_bMuLxIOGLSPn7ZY2s=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1808", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187283" Pubnub::Grant.any_instance.stub(:signature).and_return "0LH6kfT2D0CTGtYdFriDnJKCN--3oJbH0AoGmHnjpQs=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1806", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187283" Pubnub::Grant.any_instance.stub(:signature).and_return "0LH6kfT2D0CTGtYdFriDnJKCN--3oJbH0AoGmHnjpQs=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1807", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187143" Pubnub::Grant.any_instance.stub(:signature).and_return "NbBUXwie-1K-b8saj7_yZXAAdh44k0H3bLGZi0Atvyc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1817", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187144" Pubnub::Grant.any_instance.stub(:signature).and_return "ALuSk7PXvSe3Q0t2gz-vqOkPK8nU9_3TfALLZYdJ-_Y=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1815", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187144" Pubnub::Grant.any_instance.stub(:signature).and_return "ALuSk7PXvSe3Q0t2gz-vqOkPK8nU9_3TfALLZYdJ-_Y=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1816", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187145" Pubnub::Grant.any_instance.stub(:signature).and_return "82CeYrqD9Om8JwPtp1WrNfoF6u-MlKhpBF5MGPsuU9c=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1814", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187284" Pubnub::Grant.any_instance.stub(:signature).and_return "CxPZw75VF2tUHeqJbwl2R3IPYWDDRdPLjT0FjxI-7BM=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1812", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187285" Pubnub::Grant.any_instance.stub(:signature).and_return "rAaOsCgOAh_clCdxFmS8W1i2T6CxgqIE3uq1IYKWo-U=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1813", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187285" Pubnub::Grant.any_instance.stub(:signature).and_return "rAaOsCgOAh_clCdxFmS8W1i2T6CxgqIE3uq1IYKWo-U=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1823", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464697442" Pubnub::Grant.any_instance.stub(:signature).and_return "Ok8mpo2Di6xqvqhEFd-Eft0PaXdI4kCHXTJYY0VEW-I=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1821", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187148" Pubnub::Grant.any_instance.stub(:signature).and_return "ePXB2yzAi_6G8D9zUiSU7gMX27sLLJYdhR1HLY-eUTE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1822", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187149" Pubnub::Grant.any_instance.stub(:signature).and_return "oAxds6FX-vslGzgOY1dVcILAlGAcxdw8UmHkG5gqqkY=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1820", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187286" Pubnub::Grant.any_instance.stub(:signature).and_return "D94wGxQF0SbUNToYiEeVo2M1HJ5h3HRoKAIx4_vwIBQ=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1818", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187150" Pubnub::Grant.any_instance.stub(:signature).and_return "OnMu-mMMO34RvhbtZOT3jJ8l1FKEF337cufRnvC3mkw=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1819", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187150" Pubnub::Grant.any_instance.stub(:signature).and_return "OnMu-mMMO34RvhbtZOT3jJ8l1FKEF337cufRnvC3mkw=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1829", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464697443" Pubnub::Grant.any_instance.stub(:signature).and_return "uEq7W_XvapELlJnEgCsLip2zXs5n_DI78_9Uu6WH91A=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1827", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187286" Pubnub::Grant.any_instance.stub(:signature).and_return "wFH5kvrOC3tADrue_P86C9wCkslTdK3bVGHeSsk_fak=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1828", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187287" Pubnub::Grant.any_instance.stub(:signature).and_return "ubwA1Oc_SnKkWkj-TBr7KZKYPSNmLyr2k6fDsLzA9uo=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1826", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187287" Pubnub::Grant.any_instance.stub(:signature).and_return "ubwA1Oc_SnKkWkj-TBr7KZKYPSNmLyr2k6fDsLzA9uo=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1824", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187288" Pubnub::Grant.any_instance.stub(:signature).and_return "OiSK8i6mUK4VdOq-DDOP1co6VBaT72-2Poc4b3UFCbE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1825", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187288" Pubnub::Grant.any_instance.stub(:signature).and_return "OiSK8i6mUK4VdOq-DDOP1co6VBaT72-2Poc4b3UFCbE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1835", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187289" Pubnub::Grant.any_instance.stub(:signature).and_return "SmsOVc-RRjEs4mHkvAF8K15xWeRSulQpNnGaZaaXZPc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1833", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187289" Pubnub::Grant.any_instance.stub(:signature).and_return "SmsOVc-RRjEs4mHkvAF8K15xWeRSulQpNnGaZaaXZPc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1834", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187290" Pubnub::Grant.any_instance.stub(:signature).and_return "n3uLjKuDzBysYBV_Ae46YW82X41bxqgJkbemZrYNL0Y=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1832", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187291" Pubnub::Grant.any_instance.stub(:signature).and_return "CeT5oEozSWwcGFiJRKtiHXvmFkGHHzwdBrk0r88LFa8=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1830", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187291" Pubnub::Grant.any_instance.stub(:signature).and_return "CeT5oEozSWwcGFiJRKtiHXvmFkGHHzwdBrk0r88LFa8=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1831", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187292" Pubnub::Grant.any_instance.stub(:signature).and_return "Pi0eig_gpDHGDHkrCKtm4-wO_cZHwRT6tTK8LvRP_Kw=" envelope = @pubnub.grant(channel: :demo, read: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1733", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187292" Pubnub::Grant.any_instance.stub(:signature).and_return "FNm1klY9VcLiw0Zbf6YSEojvImhOzEwKTpY7zUD3BZc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1731", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187293" Pubnub::Grant.any_instance.stub(:signature).and_return "vPS8ouT5ISDNUoAlZwft6DTn1j12uJvOEtwRRhjoMoI=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1732", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187293" Pubnub::Grant.any_instance.stub(:signature).and_return "vPS8ouT5ISDNUoAlZwft6DTn1j12uJvOEtwRRhjoMoI=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1730", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187294" Pubnub::Grant.any_instance.stub(:signature).and_return "kZqYyrjTPUxU8YclIq7HGD2rGw3Ap1Fk7B89Bxh5D2U=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1728", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187294" Pubnub::Grant.any_instance.stub(:signature).and_return "kZqYyrjTPUxU8YclIq7HGD2rGw3Ap1Fk7B89Bxh5D2U=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1729", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187295" Pubnub::Grant.any_instance.stub(:signature).and_return "VVek-S9bFxoyvySLOHP1s_kNYixxFNjLOUP5M8CiJoE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1739", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187295" Pubnub::Grant.any_instance.stub(:signature).and_return "V3RHvCDPvXZo1VGTysqjA1o-LZu0lkr7mZEUhGPUHtc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1737", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187296" Pubnub::Grant.any_instance.stub(:signature).and_return "fsyZ0juitpG_hqKxua_TS4-KonUoBkl6P7NUrm9DUZE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1738", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187296" Pubnub::Grant.any_instance.stub(:signature).and_return "fsyZ0juitpG_hqKxua_TS4-KonUoBkl6P7NUrm9DUZE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1736", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187297" Pubnub::Grant.any_instance.stub(:signature).and_return "akJiuPHrR54ysNmed9561LDJzOLeIfOIe8VQgEv0oVA=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1734", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187297" Pubnub::Grant.any_instance.stub(:signature).and_return "akJiuPHrR54ysNmed9561LDJzOLeIfOIe8VQgEv0oVA=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1735", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187298" Pubnub::Grant.any_instance.stub(:signature).and_return "mw1nkoxQ9nRlaeGtG_92cmsVqLTDof6ERE5dm1Ya_VQ=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1745", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187298" Pubnub::Grant.any_instance.stub(:signature).and_return "akQUJmCzMXeRd5BNNzF4YwhaUSKVRquIQLW9lUrFGNg=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1743", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187299" Pubnub::Grant.any_instance.stub(:signature).and_return "CAjdmx3QwzSU83e2vbYnb6bfltTdVdGOTO0ykTITp5I=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1744", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187300" Pubnub::Grant.any_instance.stub(:signature).and_return "-fmZs2n_xtzwadUEciywXndTWXZ84TBN6H9-JAsjYc0=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1742", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187300" Pubnub::Grant.any_instance.stub(:signature).and_return "-fmZs2n_xtzwadUEciywXndTWXZ84TBN6H9-JAsjYc0=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1740", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187301" Pubnub::Grant.any_instance.stub(:signature).and_return "I33f0cskiTRCXozBmyUsj_cBiWr-z5xfkeW8rwxoWz8=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1741", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187301" Pubnub::Grant.any_instance.stub(:signature).and_return "I33f0cskiTRCXozBmyUsj_cBiWr-z5xfkeW8rwxoWz8=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1751", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187302" Pubnub::Grant.any_instance.stub(:signature).and_return "HodLhgZ99Oy3K7zfNIS6rJsRdVuT6maMYuliPgu-Ljc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1749", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187302" Pubnub::Grant.any_instance.stub(:signature).and_return "HodLhgZ99Oy3K7zfNIS6rJsRdVuT6maMYuliPgu-Ljc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1750", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187303" Pubnub::Grant.any_instance.stub(:signature).and_return "QkWlm1H2fBWx-DU972AVD_AnqrsqMk6_YFzj8X5wYeY=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1748", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187303" Pubnub::Grant.any_instance.stub(:signature).and_return "QkWlm1H2fBWx-DU972AVD_AnqrsqMk6_YFzj8X5wYeY=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1746", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187304" Pubnub::Grant.any_instance.stub(:signature).and_return "3Qq10CjVG5AC7dtsJWvdkwgphOiFxFUXqZlRTidQMjE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1747", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187304" Pubnub::Grant.any_instance.stub(:signature).and_return "3Qq10CjVG5AC7dtsJWvdkwgphOiFxFUXqZlRTidQMjE=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1757", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187305" Pubnub::Grant.any_instance.stub(:signature).and_return "lvtJgKWtnFPUDe8RmqFlQJJKaB7GZWXwYLC9e16pO14=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1755", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187305" Pubnub::Grant.any_instance.stub(:signature).and_return "lvtJgKWtnFPUDe8RmqFlQJJKaB7GZWXwYLC9e16pO14=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1756", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187306" Pubnub::Grant.any_instance.stub(:signature).and_return "fZGoY5om6ImJn5umu-C8M7PAiwn4gfvkq2D8ojoADLI=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1754", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187307" Pubnub::Grant.any_instance.stub(:signature).and_return "0lTyWdmpvTZDotsxE0X6mSUvdbJHAe9wMxinEht2B0A=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1752", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187307" Pubnub::Grant.any_instance.stub(:signature).and_return "0lTyWdmpvTZDotsxE0X6mSUvdbJHAe9wMxinEht2B0A=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1753", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187308" Pubnub::Grant.any_instance.stub(:signature).and_return "f0hQLy2m8VOOMTZkWfmQLhfjwqAXlbQwEwXsh3Tyf_I=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1763", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187309" Pubnub::Grant.any_instance.stub(:signature).and_return "Y3y2ezEfV8rPfv74lwWuDz5Ljt3PaUcuKrTtIoVzwyc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1761", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187309" Pubnub::Grant.any_instance.stub(:signature).and_return "Y3y2ezEfV8rPfv74lwWuDz5Ljt3PaUcuKrTtIoVzwyc=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1762", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187310" Pubnub::Grant.any_instance.stub(:signature).and_return "Tuf9xiKvyBSmtYOssb3zEl-KE0lWkti15jKbxNMkSVM=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1760", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187310" Pubnub::Grant.any_instance.stub(:signature).and_return "Tuf9xiKvyBSmtYOssb3zEl-KE0lWkti15jKbxNMkSVM=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1758", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187311" Pubnub::Grant.any_instance.stub(:signature).and_return "SCyjjntdCUvrd0Hv_LPnsV20obSC1J_Uud1W46A7UCk=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1759", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187311" Pubnub::Grant.any_instance.stub(:signature).and_return "SCyjjntdCUvrd0Hv_LPnsV20obSC1J_Uud1W46A7UCk=" envelope = @pubnub.grant(channel: :demo, read: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1769", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187312" Pubnub::Grant.any_instance.stub(:signature).and_return "zpjXv0NINLHC_le6RpLOmwZylkUStu7YnS0Usc-e4LQ=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1767", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187312" Pubnub::Grant.any_instance.stub(:signature).and_return "zpjXv0NINLHC_le6RpLOmwZylkUStu7YnS0Usc-e4LQ=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1768", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187313" Pubnub::Grant.any_instance.stub(:signature).and_return "6VhJVTkQMLQlkhMCuWp0BI0xSV95U3szejyFCp2RV24=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1766", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187313" Pubnub::Grant.any_instance.stub(:signature).and_return "6VhJVTkQMLQlkhMCuWp0BI0xSV95U3szejyFCp2RV24=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1764", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187314" Pubnub::Grant.any_instance.stub(:signature).and_return "qlgB3tLHuAFWPwFM2DmQeuYllaxRD-vJmer1hzvzFsI=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1765", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187314" Pubnub::Grant.any_instance.stub(:signature).and_return "qlgB3tLHuAFWPwFM2DmQeuYllaxRD-vJmer1hzvzFsI=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1775", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187315" Pubnub::Grant.any_instance.stub(:signature).and_return "z7uk0rvnqDlzoQ302GduDdYksuyrgtfaGj3tEJOKyeg=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1773", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187316" Pubnub::Grant.any_instance.stub(:signature).and_return "6thSbnbNfes35ay0ooUMrFLNE0CQJLChvDiFkbVNAKU=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1774", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187316" Pubnub::Grant.any_instance.stub(:signature).and_return "6thSbnbNfes35ay0ooUMrFLNE0CQJLChvDiFkbVNAKU=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1772", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187317" Pubnub::Grant.any_instance.stub(:signature).and_return "GAgTQtWdWMiokLi5dmTdaDa0u4w45EpeIoFr-DjmeZw=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1770", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187317" Pubnub::Grant.any_instance.stub(:signature).and_return "GAgTQtWdWMiokLi5dmTdaDa0u4w45EpeIoFr-DjmeZw=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1771", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187318" Pubnub::Grant.any_instance.stub(:signature).and_return "B6r-dy_1PxyTdE4PGjdAWcKAIXk7nlCguKbicUhG7aI=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1781", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187318" Pubnub::Grant.any_instance.stub(:signature).and_return "fX82gF7KczD1FRxWJRDChvSPdMFJWYTTbJxlPZQekW8=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1779", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187319" Pubnub::Grant.any_instance.stub(:signature).and_return "RNP16pZnBpg1iyiBa7akGM6oqkvvk5j0bBRVXs22YJk=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1780", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187319" Pubnub::Grant.any_instance.stub(:signature).and_return "RNP16pZnBpg1iyiBa7akGM6oqkvvk5j0bBRVXs22YJk=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1778", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187320" Pubnub::Grant.any_instance.stub(:signature).and_return "lw_RXDhaia4Z6Ml9TDALBhfxklu6DSbBN-z1X7CaRW0=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1776", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187320" Pubnub::Grant.any_instance.stub(:signature).and_return "lw_RXDhaia4Z6Ml9TDALBhfxklu6DSbBN-z1X7CaRW0=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1777", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187321" Pubnub::Grant.any_instance.stub(:signature).and_return "gzg-q3inINH2-9DkdV7DK99cNQjAPurWp7pazwTfUQo=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1787", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187321" Pubnub::Grant.any_instance.stub(:signature).and_return "NPiFBMpIaaFF0KDvnAOAc4XR__1NaEz0FBnjgNrBrFA=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1785", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187322" Pubnub::Grant.any_instance.stub(:signature).and_return "ZHoRvYDsl2-Q7FT_wcvMEMGgnHioVOowsjiCXYvWpfY=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1786", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187322" Pubnub::Grant.any_instance.stub(:signature).and_return "ZHoRvYDsl2-Q7FT_wcvMEMGgnHioVOowsjiCXYvWpfY=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1784", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187323" Pubnub::Grant.any_instance.stub(:signature).and_return "NUisNY_uFtRZflk8U3Skc6EmQ7LToHMxGMURrKt0UOk=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1782", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187324" Pubnub::Grant.any_instance.stub(:signature).and_return "xOGdqsVGtrY3vceZKKF0Fdn8lbPVZpP25SxixzrBJks=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1783", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187324" Pubnub::Grant.any_instance.stub(:signature).and_return "xOGdqsVGtrY3vceZKKF0Fdn8lbPVZpP25SxixzrBJks=" envelope = @pubnub.grant(channel: :demo, read: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1793", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187325" Pubnub::Grant.any_instance.stub(:signature).and_return "N31c7BLcyWSmNvuwNi4leWyAdYrm9-juwsqp7lW4YGY=" envelope = @pubnub.grant(channel: :demo, read: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1791", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187325" Pubnub::Grant.any_instance.stub(:signature).and_return "N31c7BLcyWSmNvuwNi4leWyAdYrm9-juwsqp7lW4YGY=" envelope = @pubnub.grant(channel: :demo, read: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1792", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187326" Pubnub::Grant.any_instance.stub(:signature).and_return "5TQDgEqddRMd088Q610nBItRx9c8RB-x38mLxHQ_1IQ=" envelope = @pubnub.grant(channel: :demo, read: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1790", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187326" Pubnub::Grant.any_instance.stub(:signature).and_return "5TQDgEqddRMd088Q610nBItRx9c8RB-x38mLxHQ_1IQ=" envelope = @pubnub.grant(channel: :demo, read: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1788", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187327" Pubnub::Grant.any_instance.stub(:signature).and_return "exO8_sIlTbeUSSgB5KyjayoT9FQiGq9JEq_ZDnYs4Ns=" envelope = @pubnub.grant(channel: :demo, read: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1789", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187327" Pubnub::Grant.any_instance.stub(:signature).and_return "exO8_sIlTbeUSSgB5KyjayoT9FQiGq9JEq_ZDnYs4Ns=" envelope = @pubnub.grant(channel: :demo, read: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1799", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187328" Pubnub::Grant.any_instance.stub(:signature).and_return "_6lPYwDEOdZ_Jzfq3Qxi-dMdq6l0XhSeJjxM817OPso=" envelope = @pubnub.grant(channel: :demo, read: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1797", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187328" Pubnub::Grant.any_instance.stub(:signature).and_return "_6lPYwDEOdZ_Jzfq3Qxi-dMdq6l0XhSeJjxM817OPso=" envelope = @pubnub.grant(channel: :demo, read: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1798", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187329" Pubnub::Grant.any_instance.stub(:signature).and_return "6CmwmXlhddksUqHtWaolbWRfkZaeslFeS7XaO7SC5lg=" envelope = @pubnub.grant(channel: :demo, read: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1796", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187330" Pubnub::Grant.any_instance.stub(:signature).and_return "agP-ZlfwMVK1v0_7JC3t8418Hr_vaYm3akOZG2aOaCs=" envelope = @pubnub.grant(channel: :demo, read: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1794", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187330" Pubnub::Grant.any_instance.stub(:signature).and_return "agP-ZlfwMVK1v0_7JC3t8418Hr_vaYm3akOZG2aOaCs=" envelope = @pubnub.grant(channel: :demo, read: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1795", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187331" Pubnub::Grant.any_instance.stub(:signature).and_return "EOfycAM4ZKDSeJCRlHnT2teWZkhqgVV0EK5Zh3GeA-M=" envelope = @pubnub.grant(channel: :demo, read: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1265", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187331" Pubnub::Grant.any_instance.stub(:signature).and_return "cxxDIrqORuY5La7xKlFjODePhOEWKFq22FtpVouER40=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1263", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187332" Pubnub::Grant.any_instance.stub(:signature).and_return "dUDcWMwK1sb542-Cyu0GGLb2WnKD35hFIEOMWJHqMvw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1264", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187332" Pubnub::Grant.any_instance.stub(:signature).and_return "dUDcWMwK1sb542-Cyu0GGLb2WnKD35hFIEOMWJHqMvw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1262", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187333" Pubnub::Grant.any_instance.stub(:signature).and_return "qN6L3pwQSe9pz4Wr5l3qkdZOB-WzwhEL4xSKiijtmXw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1260", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187333" Pubnub::Grant.any_instance.stub(:signature).and_return "qN6L3pwQSe9pz4Wr5l3qkdZOB-WzwhEL4xSKiijtmXw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1261", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187334" Pubnub::Grant.any_instance.stub(:signature).and_return "gIg8eJ9SC0AsVT59_ueoqQnX56y0UYUIgnnGRVCNNzY=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1271", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187334" Pubnub::Grant.any_instance.stub(:signature).and_return "VmzjB68T3cpCJ7Dz8sfuAI-lmIPP98Y8mmDRcaTaH4o=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1269", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187335" Pubnub::Grant.any_instance.stub(:signature).and_return "3s-LBCWg-3kO5mX-lMLjXY0ZHIEFKAzJ00oFQP3ikbU=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1270", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187335" Pubnub::Grant.any_instance.stub(:signature).and_return "3s-LBCWg-3kO5mX-lMLjXY0ZHIEFKAzJ00oFQP3ikbU=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1268", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187336" Pubnub::Grant.any_instance.stub(:signature).and_return "LSj3GP0l-MLyStat664_e4CDtBlFXwB9XpfHCuxPRaA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1266", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187336" Pubnub::Grant.any_instance.stub(:signature).and_return "LSj3GP0l-MLyStat664_e4CDtBlFXwB9XpfHCuxPRaA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1267", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187337" Pubnub::Grant.any_instance.stub(:signature).and_return "VuWt_YGWP7KpzAx9fH_v8bYEtsoEVAXyeKw8Kq61Yx0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1277", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187337" Pubnub::Grant.any_instance.stub(:signature).and_return "TFbD_pJ-fCfX-n3FxBUoLJekhmIq0nZMH3GpGUHaXdM=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1275", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187338" Pubnub::Grant.any_instance.stub(:signature).and_return "B9I5tEvIF3rHEch6vj5pss8nK1eaUJWaScCC3BBzhT8=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1276", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187339" Pubnub::Grant.any_instance.stub(:signature).and_return "A8wYF5XvDACnpGyq4mjV9JdzNcD9dMy4Y9BLb0zLSqE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1274", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187339" Pubnub::Grant.any_instance.stub(:signature).and_return "A8wYF5XvDACnpGyq4mjV9JdzNcD9dMy4Y9BLb0zLSqE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1272", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187340" Pubnub::Grant.any_instance.stub(:signature).and_return "OvZKXKQZ_WJCbS-6C8iVPjaYjDnKW9Zus1ah8rUJxgQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1273", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187340" Pubnub::Grant.any_instance.stub(:signature).and_return "OvZKXKQZ_WJCbS-6C8iVPjaYjDnKW9Zus1ah8rUJxgQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1283", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187341" Pubnub::Grant.any_instance.stub(:signature).and_return "zwdsa0HPmi5sqM7CC2CN31jq9bGN33OB4GReL39w_nA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1281", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187341" Pubnub::Grant.any_instance.stub(:signature).and_return "zwdsa0HPmi5sqM7CC2CN31jq9bGN33OB4GReL39w_nA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1282", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187342" Pubnub::Grant.any_instance.stub(:signature).and_return "ZBdK9NUyTbLwlVWF7j_T4EBb4aJTfFJx9scWi9MLhzM=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1280", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187342" Pubnub::Grant.any_instance.stub(:signature).and_return "ZBdK9NUyTbLwlVWF7j_T4EBb4aJTfFJx9scWi9MLhzM=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1278", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187343" Pubnub::Grant.any_instance.stub(:signature).and_return "2muZ2KN-Si_6Q_GYZF0tQ9N894ee7ZX0NVO4S3t_cAc=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1279", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187344" Pubnub::Grant.any_instance.stub(:signature).and_return "202vnBhLF4mVjbzeDMhDa65UHvYnodlV0BBBGMdn9PA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1289", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187344" Pubnub::Grant.any_instance.stub(:signature).and_return "fhYl-oTQKjLOSnRtVIGr5HhpSXW43bK0OCYrQFH0GB8=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1287", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187345" Pubnub::Grant.any_instance.stub(:signature).and_return "bgMHVePTl7m14Fky4BmSta1wPe-67_xw2rllTAcI4k4=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1288", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187345" Pubnub::Grant.any_instance.stub(:signature).and_return "bgMHVePTl7m14Fky4BmSta1wPe-67_xw2rllTAcI4k4=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1286", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187346" Pubnub::Grant.any_instance.stub(:signature).and_return "J5O8n0h8gKfHRfma94EiUrB-nKNpDJIY_geL4MbhFjk=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1284", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187346" Pubnub::Grant.any_instance.stub(:signature).and_return "J5O8n0h8gKfHRfma94EiUrB-nKNpDJIY_geL4MbhFjk=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1285", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187347" Pubnub::Grant.any_instance.stub(:signature).and_return "0J65KOfPe1PkXvtxLB-ww8sOJHSqM0pXLIuphV2Of6Q=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1295", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187348" Pubnub::Grant.any_instance.stub(:signature).and_return "2ACIOlQmSadPH06ffLjKX6S2ONOxh3zJ8ippFn9fZ6E=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1293", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187348" Pubnub::Grant.any_instance.stub(:signature).and_return "2ACIOlQmSadPH06ffLjKX6S2ONOxh3zJ8ippFn9fZ6E=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1294", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187349" Pubnub::Grant.any_instance.stub(:signature).and_return "KWEjh4reBlCbgsxC8EHVdIBf3cYV1_xi2E8RMmIixJw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1292", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187349" Pubnub::Grant.any_instance.stub(:signature).and_return "KWEjh4reBlCbgsxC8EHVdIBf3cYV1_xi2E8RMmIixJw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1290", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187350" Pubnub::Grant.any_instance.stub(:signature).and_return "QB2xXZORZFct9Xv2a5tP0zK1CWHW1FNU25pak-L5j3w=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1291", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187350" Pubnub::Grant.any_instance.stub(:signature).and_return "QB2xXZORZFct9Xv2a5tP0zK1CWHW1FNU25pak-L5j3w=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1193", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187351" Pubnub::Grant.any_instance.stub(:signature).and_return "zj4OLy7A7ZC796KdVg6bOOo-TVHdsx33UaVSJ7dTQJo=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1191", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187363" Pubnub::Grant.any_instance.stub(:signature).and_return "p2RGgYVTIohKcFY2-bYBHdgQ_MNW4sFZ7Fw9JCMTCp0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1192", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187363" Pubnub::Grant.any_instance.stub(:signature).and_return "p2RGgYVTIohKcFY2-bYBHdgQ_MNW4sFZ7Fw9JCMTCp0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1190", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187364" Pubnub::Grant.any_instance.stub(:signature).and_return "AX3SXMvAH2P5Lnx5c3lhX6SVwEpMCBYgsioG-C0yn0k=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1188", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187365" Pubnub::Grant.any_instance.stub(:signature).and_return "hR22Y83jNMzp09ZEjrUrEjIzlSG7p8vGHrPi1kcta84=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1189", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187365" Pubnub::Grant.any_instance.stub(:signature).and_return "hR22Y83jNMzp09ZEjrUrEjIzlSG7p8vGHrPi1kcta84=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1199", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187366" Pubnub::Grant.any_instance.stub(:signature).and_return "cWvw5D02_t9YPOoMMGhK9d9PxU3c1oAcllZvxNeIQOY=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1197", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187366" Pubnub::Grant.any_instance.stub(:signature).and_return "cWvw5D02_t9YPOoMMGhK9d9PxU3c1oAcllZvxNeIQOY=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1198", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187367" Pubnub::Grant.any_instance.stub(:signature).and_return "aLvHcnmeQaQb63fld7ZeMnuP722QitMFYpq3vJ7-_HE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1196", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187367" Pubnub::Grant.any_instance.stub(:signature).and_return "aLvHcnmeQaQb63fld7ZeMnuP722QitMFYpq3vJ7-_HE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1194", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187368" Pubnub::Grant.any_instance.stub(:signature).and_return "Cpt8xpnxXoFdBWI38ESSeuq_8tCVpeUC8ZrVVvjsIGE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1195", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187368" Pubnub::Grant.any_instance.stub(:signature).and_return "Cpt8xpnxXoFdBWI38ESSeuq_8tCVpeUC8ZrVVvjsIGE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1205", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187369" Pubnub::Grant.any_instance.stub(:signature).and_return "KRK8o0Sjmp-pIfLMM55pQHc3hC3XscJBWjiMZWuthn0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1203", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187369" Pubnub::Grant.any_instance.stub(:signature).and_return "KRK8o0Sjmp-pIfLMM55pQHc3hC3XscJBWjiMZWuthn0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1204", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187370" Pubnub::Grant.any_instance.stub(:signature).and_return "C4vv_80q_HcKsD8AEaMC4dxh9_kKI8odm5KXn8Lhuyo=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1202", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187370" Pubnub::Grant.any_instance.stub(:signature).and_return "C4vv_80q_HcKsD8AEaMC4dxh9_kKI8odm5KXn8Lhuyo=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1200", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187371" Pubnub::Grant.any_instance.stub(:signature).and_return "rUaWlrVZbES68M3eWDYBClBbkSVipDIMGeX4Zlum3D0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1201", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187371" Pubnub::Grant.any_instance.stub(:signature).and_return "rUaWlrVZbES68M3eWDYBClBbkSVipDIMGeX4Zlum3D0=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1211", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187372" Pubnub::Grant.any_instance.stub(:signature).and_return "k57b0MZGW2lrZd6FgtGVtDgyacBfl8vuUyye1X4mcKE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1209", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187372" Pubnub::Grant.any_instance.stub(:signature).and_return "k57b0MZGW2lrZd6FgtGVtDgyacBfl8vuUyye1X4mcKE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1210", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187373" Pubnub::Grant.any_instance.stub(:signature).and_return "At1RkVOYEO18dy0BhY8q6vV67o0nu_XiI6d9uW4Z9rQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1208", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187374" Pubnub::Grant.any_instance.stub(:signature).and_return "lv4XOxlPV2H2NoyJJjTpgf0M3V4TcthEFUPtSz6vruU=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1206", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187374" Pubnub::Grant.any_instance.stub(:signature).and_return "lv4XOxlPV2H2NoyJJjTpgf0M3V4TcthEFUPtSz6vruU=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1207", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187375" Pubnub::Grant.any_instance.stub(:signature).and_return "5za8YLOzv8OBVTLtn8w8CjrdDbU3ZmzlhSDhQdeZ56E=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1217", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187375" Pubnub::Grant.any_instance.stub(:signature).and_return "kag7GBcHxqa1dKru2Mtfkfhc8wqdXZ763HJiIaIDyRo=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1215", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187376" Pubnub::Grant.any_instance.stub(:signature).and_return "zIBgUVAcWBHuQlD_DO7XgEhdTkrlYkV_-mpzggIKmTE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1216", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187376" Pubnub::Grant.any_instance.stub(:signature).and_return "zIBgUVAcWBHuQlD_DO7XgEhdTkrlYkV_-mpzggIKmTE=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1214", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187377" Pubnub::Grant.any_instance.stub(:signature).and_return "0mZCrgcIdxN1TO6RLOjzF9GuDWeJbJprqVXXZX0xigw=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1212", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187378" Pubnub::Grant.any_instance.stub(:signature).and_return "xY_B9r2UTey7vQlT9j-WvSekvFMw9lGQTifDbhIDSJs=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1213", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187378" Pubnub::Grant.any_instance.stub(:signature).and_return "xY_B9r2UTey7vQlT9j-WvSekvFMw9lGQTifDbhIDSJs=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1223", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187379" Pubnub::Grant.any_instance.stub(:signature).and_return "dWR54WuNr1ZG2yJhuQEAHme0NqakC7YoXNdH9vt-APs=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1221", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187379" Pubnub::Grant.any_instance.stub(:signature).and_return "dWR54WuNr1ZG2yJhuQEAHme0NqakC7YoXNdH9vt-APs=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1222", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187380" Pubnub::Grant.any_instance.stub(:signature).and_return "PN4xHh344sbgD6vYknl3fH6WBzV3Iw48bB-G33HNN6k=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1220", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187380" Pubnub::Grant.any_instance.stub(:signature).and_return "PN4xHh344sbgD6vYknl3fH6WBzV3Iw48bB-G33HNN6k=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1218", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187381" Pubnub::Grant.any_instance.stub(:signature).and_return "WBJtngVt7k4cu45FTGYw9T7zGJlDm5igJhToXhl9PLc=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1219", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187381" Pubnub::Grant.any_instance.stub(:signature).and_return "WBJtngVt7k4cu45FTGYw9T7zGJlDm5igJhToXhl9PLc=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1229", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187382" Pubnub::Grant.any_instance.stub(:signature).and_return "n8rigMzt3Vi0_S1H1q6WAT1ZTqcbBqWNH1Fk2JcQ6CQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1227", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187382" Pubnub::Grant.any_instance.stub(:signature).and_return "n8rigMzt3Vi0_S1H1q6WAT1ZTqcbBqWNH1Fk2JcQ6CQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1228", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187383" Pubnub::Grant.any_instance.stub(:signature).and_return "unYBtZG9n3JgoN6UbU7U7zZ6w3UuKnqJepqTg9j6NxA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1226", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187383" Pubnub::Grant.any_instance.stub(:signature).and_return "unYBtZG9n3JgoN6UbU7U7zZ6w3UuKnqJepqTg9j6NxA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1224", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187384" Pubnub::Grant.any_instance.stub(:signature).and_return "QrkrL20RpXuTP8hxwttaO-FbOriuhv4JKndW7DD_oXQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1225", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187385" Pubnub::Grant.any_instance.stub(:signature).and_return "lX6QwveHEZNbEwPqAmaVEX3gDkZ8CnkyPGOUIBwh65c=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1235", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187385" Pubnub::Grant.any_instance.stub(:signature).and_return "FLfthQGjOM8fgHvzfRxj2A-uc1JoEVdgtTbHNseD_vI=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1233", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187386" Pubnub::Grant.any_instance.stub(:signature).and_return "wcW-zB6HDQfzOULaija0cpJmjPiPFk-BBGX_Jani0NA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1234", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187386" Pubnub::Grant.any_instance.stub(:signature).and_return "wcW-zB6HDQfzOULaija0cpJmjPiPFk-BBGX_Jani0NA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1232", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187387" Pubnub::Grant.any_instance.stub(:signature).and_return "jxamA5i2NCkGj9f8iIyslXKZJXG3ayBDP1rZCOgZXaA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1230", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187387" Pubnub::Grant.any_instance.stub(:signature).and_return "jxamA5i2NCkGj9f8iIyslXKZJXG3ayBDP1rZCOgZXaA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1231", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187388" Pubnub::Grant.any_instance.stub(:signature).and_return "ylsqt-MBZiqLJYPR5_F-nevuB40BIny5AXZaHXbZfUQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1241", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187388" Pubnub::Grant.any_instance.stub(:signature).and_return "cnq0m7meu-Gso9q4d4Etj5UU87Afi-qNOethXDkcczA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1239", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187389" Pubnub::Grant.any_instance.stub(:signature).and_return "o46MIzmEHCZg12weo930BSBJn-jKsCWlW5nz_tHQi7s=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1240", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187389" Pubnub::Grant.any_instance.stub(:signature).and_return "o46MIzmEHCZg12weo930BSBJn-jKsCWlW5nz_tHQi7s=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1238", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187390" Pubnub::Grant.any_instance.stub(:signature).and_return "gyHG80E7xyUAI8KHu5ydfdnbVv7qA1gMKETruWnYClY=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1236", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187391" Pubnub::Grant.any_instance.stub(:signature).and_return "IA3ICf19RL0vw0w2APGlrBkYQ2E5VYGIvP5D7G6tU3w=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1237", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187391" Pubnub::Grant.any_instance.stub(:signature).and_return "IA3ICf19RL0vw0w2APGlrBkYQ2E5VYGIvP5D7G6tU3w=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1247", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187392" Pubnub::Grant.any_instance.stub(:signature).and_return "Ise-IZT8W-jewenGLmS2rSJ6RMFDWl0S-MsFadCx9tg=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1245", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187392" Pubnub::Grant.any_instance.stub(:signature).and_return "Ise-IZT8W-jewenGLmS2rSJ6RMFDWl0S-MsFadCx9tg=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1246", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187393" Pubnub::Grant.any_instance.stub(:signature).and_return "N63Ng7gb-pRdLEXmLZQPn3tcqbczrOB8wMeAX8tVUME=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1244", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187393" Pubnub::Grant.any_instance.stub(:signature).and_return "N63Ng7gb-pRdLEXmLZQPn3tcqbczrOB8wMeAX8tVUME=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1242", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187394" Pubnub::Grant.any_instance.stub(:signature).and_return "6o5k2MJNB3TpBBCS9rPbquPd_IURE_dQt9mNeoaX3wA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1243", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187394" Pubnub::Grant.any_instance.stub(:signature).and_return "6o5k2MJNB3TpBBCS9rPbquPd_IURE_dQt9mNeoaX3wA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1253", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187395" Pubnub::Grant.any_instance.stub(:signature).and_return "ViJfoyf8Tq__hKU0-a4TKqon7QgnbPFeIajdWP_vG3Y=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1251", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187395" Pubnub::Grant.any_instance.stub(:signature).and_return "ViJfoyf8Tq__hKU0-a4TKqon7QgnbPFeIajdWP_vG3Y=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1252", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187396" Pubnub::Grant.any_instance.stub(:signature).and_return "qvPD-4cmFF_xIluSd9U1m2qNuRwkPDkb-NKSIggqtEg=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1250", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187397" Pubnub::Grant.any_instance.stub(:signature).and_return "3kn-WFPkUCXzJBmiCD4nU_0I-gY-KciWK0UeU-oa9Ms=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1248", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187397" Pubnub::Grant.any_instance.stub(:signature).and_return "3kn-WFPkUCXzJBmiCD4nU_0I-gY-KciWK0UeU-oa9Ms=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1249", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187398" Pubnub::Grant.any_instance.stub(:signature).and_return "WbMNQNGFXnYbNN0gY-QgATncfUHPPx5MOgbIf-3kniY=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1259", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187398" Pubnub::Grant.any_instance.stub(:signature).and_return "-I6IU9c0MEmeip61c9OVUnyGsgJjI68w0ioDRpz08TU=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1257", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187399" Pubnub::Grant.any_instance.stub(:signature).and_return "Oru0G9o2JrSagUBLqw8wX7gcQVqGelVauHebK6wRsbA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1258", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187399" Pubnub::Grant.any_instance.stub(:signature).and_return "Oru0G9o2JrSagUBLqw8wX7gcQVqGelVauHebK6wRsbA=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1256", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187400" Pubnub::Grant.any_instance.stub(:signature).and_return "QzZ4fb62c6_gfYWFhsnmGkvn8lQliLQJTkb2SM7bu2U=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1254", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187401" Pubnub::Grant.any_instance.stub(:signature).and_return "BoqFvagc9e_Eyv1OV4-02gc04O0zsgBffzQv1-8JrIg=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1255", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187401" Pubnub::Grant.any_instance.stub(:signature).and_return "BoqFvagc9e_Eyv1OV4-02gc04O0zsgBffzQv1-8JrIg=" envelope = @pubnub.grant(channel: :demo, read: false, write: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1049", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187402" Pubnub::Grant.any_instance.stub(:signature).and_return "GEBGdjWi23u-DAR-L0f_SzhXEYXoPOjmG-hiZsjEaOQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1047", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187402" Pubnub::Grant.any_instance.stub(:signature).and_return "GEBGdjWi23u-DAR-L0f_SzhXEYXoPOjmG-hiZsjEaOQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1048", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187403" Pubnub::Grant.any_instance.stub(:signature).and_return "CvnlUTYYEjiHHTA1l6ikqytQVdWtTKthhJbW0Ss9T3U=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1046", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187403" Pubnub::Grant.any_instance.stub(:signature).and_return "CvnlUTYYEjiHHTA1l6ikqytQVdWtTKthhJbW0Ss9T3U=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1044", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187404" Pubnub::Grant.any_instance.stub(:signature).and_return "DOvXp0gDoPzUmwNVLBt2jiz_jAYhD_phlckiteYsM38=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1045", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187404" Pubnub::Grant.any_instance.stub(:signature).and_return "DOvXp0gDoPzUmwNVLBt2jiz_jAYhD_phlckiteYsM38=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1055", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187405" Pubnub::Grant.any_instance.stub(:signature).and_return "V6caicrGcfDT-FiN7Hqw5rXh_doFzfyPB8HjyCrxddg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1053", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187405" Pubnub::Grant.any_instance.stub(:signature).and_return "V6caicrGcfDT-FiN7Hqw5rXh_doFzfyPB8HjyCrxddg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1054", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187406" Pubnub::Grant.any_instance.stub(:signature).and_return "KRJT0LrqN5gNoRFHrT0-0NToaHLjSnAC0IRJp82BKuQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1052", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187407" Pubnub::Grant.any_instance.stub(:signature).and_return "6D3k-6SoRP0Ck1WN_xBm18RtWbe0hQPS-oI4fSHD26A=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1050", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187407" Pubnub::Grant.any_instance.stub(:signature).and_return "6D3k-6SoRP0Ck1WN_xBm18RtWbe0hQPS-oI4fSHD26A=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1051", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187408" Pubnub::Grant.any_instance.stub(:signature).and_return "iep3wTpGtRi12XAuc6flQnXR3dKkkiENg690oqVnM0w=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1061", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187408" Pubnub::Grant.any_instance.stub(:signature).and_return "W_lx26hRaMLX5KLs1C2L_EHqxc52E5IyDuIlh83sqUg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1059", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187409" Pubnub::Grant.any_instance.stub(:signature).and_return "8aSfHLBJ_tWFvfGk3GidZ3RlnmYdLjWEmevT7tbsbjw=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1060", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187409" Pubnub::Grant.any_instance.stub(:signature).and_return "8aSfHLBJ_tWFvfGk3GidZ3RlnmYdLjWEmevT7tbsbjw=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1058", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187410" Pubnub::Grant.any_instance.stub(:signature).and_return "ZjzoZ06T4ULScURSvhFTWS56Q-sX7nEZ7Y6pzsiJ2po=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1056", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187410" Pubnub::Grant.any_instance.stub(:signature).and_return "ZjzoZ06T4ULScURSvhFTWS56Q-sX7nEZ7Y6pzsiJ2po=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1057", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187411" Pubnub::Grant.any_instance.stub(:signature).and_return "BQaaH9o9116ZcqUeFQwPAcIynihAkXXExm27p-_Nwto=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1067", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187411" Pubnub::Grant.any_instance.stub(:signature).and_return "nLZbhT5HHXAnrgHEkLcRMNYt1COCoyeWwOfqGXQFDAo=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1065", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187412" Pubnub::Grant.any_instance.stub(:signature).and_return "Xdb6SFiYY2UT3TrDlG7rj_dtVcyQYq39bLBsilG6J4c=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1066", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187413" Pubnub::Grant.any_instance.stub(:signature).and_return "15TBI57TlOH1oCs33AMA3liJ_c_5AdVORAjNC-BQS0U=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1064", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187414" Pubnub::Grant.any_instance.stub(:signature).and_return "zg6qdeqJqiSPB3SVb9gy0bzoVyXvJZ-9nQ5lKnLyjJY=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1062", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187414" Pubnub::Grant.any_instance.stub(:signature).and_return "zg6qdeqJqiSPB3SVb9gy0bzoVyXvJZ-9nQ5lKnLyjJY=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1063", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187415" Pubnub::Grant.any_instance.stub(:signature).and_return "DzBiPo9JCcYLOoeLt9ThLLnVs9_qjIYw08vEkjrZUvM=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1073", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187415" Pubnub::Grant.any_instance.stub(:signature).and_return "gfPkEKKf8v1ezPRRWC9YSTijPqAqIHfq-trA0V4kKwc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1071", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187416" Pubnub::Grant.any_instance.stub(:signature).and_return "eQ-7vBsc08LjzZcEucCkqCnvTdH-1ptVozdkEoujzz0=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1072", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187417" Pubnub::Grant.any_instance.stub(:signature).and_return "hoTDXzn6lfJD6HSrBMzIWlC80ubQN6rBhfYqFkr9PHc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1070", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187417" Pubnub::Grant.any_instance.stub(:signature).and_return "hoTDXzn6lfJD6HSrBMzIWlC80ubQN6rBhfYqFkr9PHc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1068", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187418" Pubnub::Grant.any_instance.stub(:signature).and_return "ZaKSlK9889HlgnsIswCckoj_HcIKKdY42TKElBCPYw4=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1069", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187418" Pubnub::Grant.any_instance.stub(:signature).and_return "ZaKSlK9889HlgnsIswCckoj_HcIKKdY42TKElBCPYw4=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1079", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187420" Pubnub::Grant.any_instance.stub(:signature).and_return "q-VnGhxNoLbkbp4-bvwG-I7g8Uxp55hyBdTT4u3Ahoc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1077", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187420" Pubnub::Grant.any_instance.stub(:signature).and_return "q-VnGhxNoLbkbp4-bvwG-I7g8Uxp55hyBdTT4u3Ahoc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1078", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187421" Pubnub::Grant.any_instance.stub(:signature).and_return "jnRgASx1_ZQTYQGsFQxcaTCCEsc1zOPeY9uKMrVJFLI=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1076", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187421" Pubnub::Grant.any_instance.stub(:signature).and_return "jnRgASx1_ZQTYQGsFQxcaTCCEsc1zOPeY9uKMrVJFLI=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1074", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187422" Pubnub::Grant.any_instance.stub(:signature).and_return "0uwbVpOsIsBFeG9TnGKHNMsZj916r-AQ717HTk_0yj8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1075", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187423" Pubnub::Grant.any_instance.stub(:signature).and_return "9QPVvJKoVbxVTU534vCPkHvOVEP4dgIFjEXWP6G3Qas=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/977", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187424" Pubnub::Grant.any_instance.stub(:signature).and_return "gmWBI6mx7QxW8nuJbPUcKURhBQnicdkGolacMgd762E=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/975", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187424" Pubnub::Grant.any_instance.stub(:signature).and_return "gmWBI6mx7QxW8nuJbPUcKURhBQnicdkGolacMgd762E=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/976", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187425" Pubnub::Grant.any_instance.stub(:signature).and_return "kFleId-FIaG45v65hM9dq8bwc1cWouVaJ-m6DdznXuE=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/974", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187426" Pubnub::Grant.any_instance.stub(:signature).and_return "XR7zUjNuQfV7St_3Hk_w150nDbpFeOAePdgEjh8QtCE=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/972", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187426" Pubnub::Grant.any_instance.stub(:signature).and_return "XR7zUjNuQfV7St_3Hk_w150nDbpFeOAePdgEjh8QtCE=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/973", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187427" Pubnub::Grant.any_instance.stub(:signature).and_return "jO3Ak6Gx4zS0Jn90f4-USbDMlN-BQ30nSpV2LsNg_w4=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/983", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187427" Pubnub::Grant.any_instance.stub(:signature).and_return "IBUu_UkiDJKpmywd7RAqxdoGXNVmz9ZIKui6OwcFxvM=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/981", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187428" Pubnub::Grant.any_instance.stub(:signature).and_return "eoDDmpkXD6Z912PnsadF6xohXQBYXrUWiW93yqwew8k=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/982", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187428" Pubnub::Grant.any_instance.stub(:signature).and_return "eoDDmpkXD6Z912PnsadF6xohXQBYXrUWiW93yqwew8k=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/980", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187429" Pubnub::Grant.any_instance.stub(:signature).and_return "Pd7b3SrkvW6T3E-2EkbgTBbe3zsB-yGT11FYMDRQV_A=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/978", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187430" Pubnub::Grant.any_instance.stub(:signature).and_return "DvHHzRMARr-V2VSYKTVLozxTCaBlNj4Rw2f3EdB61LE=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/979", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187431" Pubnub::Grant.any_instance.stub(:signature).and_return "3yrIb-9NXRLnhT-WxlC2CufJew5iogacdNyhatKLzNg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/989", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187431" Pubnub::Grant.any_instance.stub(:signature).and_return "UensZuLXs6xV8sV439neHh4R-8o5r6rwLlapgzidfCg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/987", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187432" Pubnub::Grant.any_instance.stub(:signature).and_return "cMyZ_ARn2eXJ61SnXrUGP8AScExaMDU6xDGY8XQ_S88=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/988", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187432" Pubnub::Grant.any_instance.stub(:signature).and_return "cMyZ_ARn2eXJ61SnXrUGP8AScExaMDU6xDGY8XQ_S88=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/986", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187433" Pubnub::Grant.any_instance.stub(:signature).and_return "s8MI8Em1bndL0ClL_hJBlNUKJ4yFn4LJyxd2Ya_8bzQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/984", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187433" Pubnub::Grant.any_instance.stub(:signature).and_return "s8MI8Em1bndL0ClL_hJBlNUKJ4yFn4LJyxd2Ya_8bzQ=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/985", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187434" Pubnub::Grant.any_instance.stub(:signature).and_return "VvRm9e_aSZACDQr7ES0RAFKfBdJE5DxE1w2c4XSG-1k=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/995", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187435" Pubnub::Grant.any_instance.stub(:signature).and_return "DP6YPNscHzpU-bCL3r1gYUTiUTSRF394G4wnFv6DtYU=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/993", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187435" Pubnub::Grant.any_instance.stub(:signature).and_return "DP6YPNscHzpU-bCL3r1gYUTiUTSRF394G4wnFv6DtYU=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/994", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187436" Pubnub::Grant.any_instance.stub(:signature).and_return "gAjysDOrZEudagno3eXRGltmT4WIso_jI_hFbx6wGmc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/992", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187437" Pubnub::Grant.any_instance.stub(:signature).and_return "0ADYj5r4WiDRUqHm0RY91ZX06NDmat8atyqpu2zxyZk=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/990", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187437" Pubnub::Grant.any_instance.stub(:signature).and_return "0ADYj5r4WiDRUqHm0RY91ZX06NDmat8atyqpu2zxyZk=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/991", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187438" Pubnub::Grant.any_instance.stub(:signature).and_return "dlHPG5QXmwyyhYj6zxPbKguBGDuSaMBP4qnKM1RB5cA=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1001", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187439" Pubnub::Grant.any_instance.stub(:signature).and_return "VpkrMcUtdFogZDh2H1Pap8IWA5kTNvm32T6ogn6CFaM=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/999", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187439" Pubnub::Grant.any_instance.stub(:signature).and_return "VpkrMcUtdFogZDh2H1Pap8IWA5kTNvm32T6ogn6CFaM=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1000", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187440" Pubnub::Grant.any_instance.stub(:signature).and_return "MynX2vqRHqwErWjEHMdZEeMT8uR6tJEO53oLF9c0Gus=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/998", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187462" Pubnub::Grant.any_instance.stub(:signature).and_return "PXG1OOYhm68jBrzQNwsczEpFEG4DRaSmh2kcCxzxeNE=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/996", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187463" Pubnub::Grant.any_instance.stub(:signature).and_return "pqCT5UaxN1yETrNfYJFl7vhKal0eTWYCCiaHOmt3j7Q=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/997", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187464" Pubnub::Grant.any_instance.stub(:signature).and_return "e49v_h35u60ZZOiubX_xSo9DQs-HtGei9ii4q5cLAG8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1007", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187473" Pubnub::Grant.any_instance.stub(:signature).and_return "JHdoNM5bGTPI_V-tIMegzvRNoslC2Wk4fjAnKryuk1U=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1005", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187474" Pubnub::Grant.any_instance.stub(:signature).and_return "SoEhwy5VZ92ozwgyy_YYmdRpeJGAFILS26T3_XWuGss=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1006", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187474" Pubnub::Grant.any_instance.stub(:signature).and_return "SoEhwy5VZ92ozwgyy_YYmdRpeJGAFILS26T3_XWuGss=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1004", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187475" Pubnub::Grant.any_instance.stub(:signature).and_return "mhfnCMP6hCD84VzK5DDZLBRexBUd3XKagJJ0RuEzkus=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1002", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187475" Pubnub::Grant.any_instance.stub(:signature).and_return "mhfnCMP6hCD84VzK5DDZLBRexBUd3XKagJJ0RuEzkus=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1003", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187476" Pubnub::Grant.any_instance.stub(:signature).and_return "amI1SPsBe3S14-Zcqtk7DOsBYoWuQTJJntEpmiBmxak=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1013", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187477" Pubnub::Grant.any_instance.stub(:signature).and_return "vI6RonDznu4tdffI147PHTSAa1bA2-jEKBL62NO5gIU=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1011", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187477" Pubnub::Grant.any_instance.stub(:signature).and_return "vI6RonDznu4tdffI147PHTSAa1bA2-jEKBL62NO5gIU=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1012", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187478" Pubnub::Grant.any_instance.stub(:signature).and_return "CV4CYkgMIcgwEHaYUM24fCTGlbWebe8oXxjftXOY8bc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1010", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187478" Pubnub::Grant.any_instance.stub(:signature).and_return "CV4CYkgMIcgwEHaYUM24fCTGlbWebe8oXxjftXOY8bc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1008", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187479" Pubnub::Grant.any_instance.stub(:signature).and_return "P9nDXFhSPUaRS3BQqlpkxrxscrU90Ev22uX0jdGt4C8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1009", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187479" Pubnub::Grant.any_instance.stub(:signature).and_return "P9nDXFhSPUaRS3BQqlpkxrxscrU90Ev22uX0jdGt4C8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1019", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187480" Pubnub::Grant.any_instance.stub(:signature).and_return "jo2k5Y3YhjJnista0qQ43Nd4w64Fp14t-UqZCEpcqS8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1017", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187480" Pubnub::Grant.any_instance.stub(:signature).and_return "jo2k5Y3YhjJnista0qQ43Nd4w64Fp14t-UqZCEpcqS8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1018", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187481" Pubnub::Grant.any_instance.stub(:signature).and_return "JJ2RIY2lWWwhZSUejL02g5uWJqXNiFZwfbv0a0BCMe8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1016", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187481" Pubnub::Grant.any_instance.stub(:signature).and_return "JJ2RIY2lWWwhZSUejL02g5uWJqXNiFZwfbv0a0BCMe8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1014", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187482" Pubnub::Grant.any_instance.stub(:signature).and_return "Y91xcQJpCyrk1GCeo0ffFDHJ5nf94aqPWWf9cMWqzj8=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1015", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187483" Pubnub::Grant.any_instance.stub(:signature).and_return "V4S6leZHoqer2QRTttKEdxBamDDcBxavW3VL74qTqRk=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1025", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187483" Pubnub::Grant.any_instance.stub(:signature).and_return "IAQSILEshKMDZYkq38tpBbijCVGAmbHwV-7P8zIDDGA=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1023", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187484" Pubnub::Grant.any_instance.stub(:signature).and_return "O5rQVvI8Ux0RGOG6JmpuFLtVDcWmawiPGwwVn9jh5JI=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1024", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187484" Pubnub::Grant.any_instance.stub(:signature).and_return "O5rQVvI8Ux0RGOG6JmpuFLtVDcWmawiPGwwVn9jh5JI=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1022", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187485" Pubnub::Grant.any_instance.stub(:signature).and_return "i7_IVjYbU1lcUMGDRiWq3I-hwX8gxQJ_nJxnpPdriDc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1020", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187485" Pubnub::Grant.any_instance.stub(:signature).and_return "i7_IVjYbU1lcUMGDRiWq3I-hwX8gxQJ_nJxnpPdriDc=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1021", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187486" Pubnub::Grant.any_instance.stub(:signature).and_return "7mrIvjVeaM_zgp-KVdc6D9twPzxCAe6sI8yAXW5eLCw=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1031", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187487" Pubnub::Grant.any_instance.stub(:signature).and_return "j0MRSb_Hzti_2uht9ohojqw_kTvgin--vAARqpMQdHI=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1029", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187487" Pubnub::Grant.any_instance.stub(:signature).and_return "j0MRSb_Hzti_2uht9ohojqw_kTvgin--vAARqpMQdHI=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1030", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187488" Pubnub::Grant.any_instance.stub(:signature).and_return "cY0aR3Bx7QCYzWD2e036XPvy3ybE03wnejpT9S2b3NY=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1028", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187488" Pubnub::Grant.any_instance.stub(:signature).and_return "cY0aR3Bx7QCYzWD2e036XPvy3ybE03wnejpT9S2b3NY=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1026", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187489" Pubnub::Grant.any_instance.stub(:signature).and_return "q6NDM74pgeGZwzYJ-1ATTIOvIiJHAjt4OIj6d6c9yNg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1027", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187489" Pubnub::Grant.any_instance.stub(:signature).and_return "q6NDM74pgeGZwzYJ-1ATTIOvIiJHAjt4OIj6d6c9yNg=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1037", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187490" Pubnub::Grant.any_instance.stub(:signature).and_return "nDdzCFWdP8SkpV3U1KfNnuyAxdv4mv6uCgpCPRwHTic=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1035", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187490" Pubnub::Grant.any_instance.stub(:signature).and_return "nDdzCFWdP8SkpV3U1KfNnuyAxdv4mv6uCgpCPRwHTic=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1036", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187491" Pubnub::Grant.any_instance.stub(:signature).and_return "7nwXGydk1OG4joJT6RBLsSPV-6JStNjtqJOaeFXbU6U=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1034", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187491" Pubnub::Grant.any_instance.stub(:signature).and_return "7nwXGydk1OG4joJT6RBLsSPV-6JStNjtqJOaeFXbU6U=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1032", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187492" Pubnub::Grant.any_instance.stub(:signature).and_return "l-64WaiqMG2I2KLl-ctjSlQi9yrUdQypq9uIjeVsAHU=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1033", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187492" Pubnub::Grant.any_instance.stub(:signature).and_return "l-64WaiqMG2I2KLl-ctjSlQi9yrUdQypq9uIjeVsAHU=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1043", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187493" Pubnub::Grant.any_instance.stub(:signature).and_return "SbPcxf8hP7PgfZkhQr0bxjhRcMT9MLkeRpYki53lZRs=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1041", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187494" Pubnub::Grant.any_instance.stub(:signature).and_return "pIXfDkKK9fJEq358_QEFXEiCUL_Zpjme_J6_m5SW10I=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1042", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187494" Pubnub::Grant.any_instance.stub(:signature).and_return "pIXfDkKK9fJEq358_QEFXEiCUL_Zpjme_J6_m5SW10I=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1040", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187495" Pubnub::Grant.any_instance.stub(:signature).and_return "pllP35-qZskN9-pVUtklDqNNU8iwXxtLW1MEamnTEbs=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1038", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187495" Pubnub::Grant.any_instance.stub(:signature).and_return "pllP35-qZskN9-pVUtklDqNNU8iwXxtLW1MEamnTEbs=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1039", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187496" Pubnub::Grant.any_instance.stub(:signature).and_return "gjy6VTHTy37iRW3gvkgM7cewJH2y3BV5Pr5GZjW9IR4=" envelope = @pubnub.grant(channel: :demo, read: false, write: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1157", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187496" Pubnub::Grant.any_instance.stub(:signature).and_return "0CrfLTRoukg9dwZLBDZ504ohKccu-aKEv77pNMcEMLc=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1155", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187497" Pubnub::Grant.any_instance.stub(:signature).and_return "fOZvsLZwJXCYfFN9EwH37w-0skZ-NkBleiTAg9q6iLc=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1156", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187497" Pubnub::Grant.any_instance.stub(:signature).and_return "fOZvsLZwJXCYfFN9EwH37w-0skZ-NkBleiTAg9q6iLc=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1154", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187498" Pubnub::Grant.any_instance.stub(:signature).and_return "jezp2at7EC1mAT9dq-Wk_3AK9i8Ja166Wn4_K1_v_g8=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1152", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187498" Pubnub::Grant.any_instance.stub(:signature).and_return "jezp2at7EC1mAT9dq-Wk_3AK9i8Ja166Wn4_K1_v_g8=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1153", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187499" Pubnub::Grant.any_instance.stub(:signature).and_return "JSzaD4McVkv3Ue3lSu2RuUOla1NYixWxee3SCR6Z5HE=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1163", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187499" Pubnub::Grant.any_instance.stub(:signature).and_return "ZDZhMsYAHaesCKzgEVFptC87tX78QI-SFRZeOi8paGA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1161", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187500" Pubnub::Grant.any_instance.stub(:signature).and_return "PrvtowVkfVyIVRwWkjkKDjzWkeB3D_hBUZ-oSS06AxU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1162", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187501" Pubnub::Grant.any_instance.stub(:signature).and_return "WW2cSZpiAo-2772Q7KunJ-hhyoo5WEGnSTD9F7zx7R4=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1160", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187501" Pubnub::Grant.any_instance.stub(:signature).and_return "WW2cSZpiAo-2772Q7KunJ-hhyoo5WEGnSTD9F7zx7R4=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1158", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187502" Pubnub::Grant.any_instance.stub(:signature).and_return "YLRgCD_9Y0P9Pkcwic_CJNwfcwLHNn9SHYMa7l9dj-k=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1159", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187502" Pubnub::Grant.any_instance.stub(:signature).and_return "YLRgCD_9Y0P9Pkcwic_CJNwfcwLHNn9SHYMa7l9dj-k=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1169", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187503" Pubnub::Grant.any_instance.stub(:signature).and_return "X_mmFurlukKB5qHIBD6mjpsG22A_GSmFLYJmuPtdevo=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1167", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187504" Pubnub::Grant.any_instance.stub(:signature).and_return "CNKyXBmkbq7Lr-FznUjW5G2aXyKHRXNdZ6YBVvWV5QA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1168", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187504" Pubnub::Grant.any_instance.stub(:signature).and_return "CNKyXBmkbq7Lr-FznUjW5G2aXyKHRXNdZ6YBVvWV5QA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1166", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187505" Pubnub::Grant.any_instance.stub(:signature).and_return "af2Vnzlvcs0R2aeE4MluXdWbaCxrpuT38fRShW6pNEc=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1164", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187505" Pubnub::Grant.any_instance.stub(:signature).and_return "af2Vnzlvcs0R2aeE4MluXdWbaCxrpuT38fRShW6pNEc=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1165", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187506" Pubnub::Grant.any_instance.stub(:signature).and_return "1yJ9E524RYIG8RofuPE5Oo_smlxhWUWtbEGYRUU_FfE=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1175", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187506" Pubnub::Grant.any_instance.stub(:signature).and_return "U7Kdt1IWKmY8XBGbnSL6Ms2VV7V5Nj3em0dNqXLQPhA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1173", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187507" Pubnub::Grant.any_instance.stub(:signature).and_return "4959SMHFi_TWo4ztwEeOMTj3tmkEBt_Bw62DnJ1KWlA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1174", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187507" Pubnub::Grant.any_instance.stub(:signature).and_return "4959SMHFi_TWo4ztwEeOMTj3tmkEBt_Bw62DnJ1KWlA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1172", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187508" Pubnub::Grant.any_instance.stub(:signature).and_return "i-ThTeL5VNKhjbK9pLTz1N-dvqbRVSzGId1BILYSyms=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1170", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187508" Pubnub::Grant.any_instance.stub(:signature).and_return "i-ThTeL5VNKhjbK9pLTz1N-dvqbRVSzGId1BILYSyms=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1171", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187509" Pubnub::Grant.any_instance.stub(:signature).and_return "6OZwuZORf72SH2aY6alkRVosXAN50nvwyxHcHsk4zI0=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1181", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187510" Pubnub::Grant.any_instance.stub(:signature).and_return "M21fsdcnVigAYMv_V5jD467t275Js1VhqIvI_JXPdRE=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1179", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187510" Pubnub::Grant.any_instance.stub(:signature).and_return "M21fsdcnVigAYMv_V5jD467t275Js1VhqIvI_JXPdRE=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1180", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187511" Pubnub::Grant.any_instance.stub(:signature).and_return "5aeHFYJOcNR5tat0XK9rATurCsiTDeHBWCGIfMnGokY=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1178", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187511" Pubnub::Grant.any_instance.stub(:signature).and_return "5aeHFYJOcNR5tat0XK9rATurCsiTDeHBWCGIfMnGokY=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1176", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187512" Pubnub::Grant.any_instance.stub(:signature).and_return "XnRku21smpBNU5ZS8Se1emSEo2bnbK9HoUS4TdJmNWg=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1177", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187513" Pubnub::Grant.any_instance.stub(:signature).and_return "uzCV2EklFa83MVMTVldsb7Sko9WTeru7pkaGk04vUGI=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1187", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187513" Pubnub::Grant.any_instance.stub(:signature).and_return "XTyK8kueMJ9Kr54Yn4adp7oPUWdop-jBYyUXZv6Mabo=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1185", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187514" Pubnub::Grant.any_instance.stub(:signature).and_return "EgnTNNPFkFALlXpluJY_N7BtgiLBqQOularCWSJCsRA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1186", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187514" Pubnub::Grant.any_instance.stub(:signature).and_return "EgnTNNPFkFALlXpluJY_N7BtgiLBqQOularCWSJCsRA=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1184", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187515" Pubnub::Grant.any_instance.stub(:signature).and_return "NtidY-uVuevmd6LKIk3U8Of0TI8CVjiujioxS1u3roU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1182", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187515" Pubnub::Grant.any_instance.stub(:signature).and_return "NtidY-uVuevmd6LKIk3U8Of0TI8CVjiujioxS1u3roU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1183", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187516" Pubnub::Grant.any_instance.stub(:signature).and_return "SJnxsm1J0ZKkchXl7ObQ8389Zql47VSeuiyRJnkHWmc=" envelope = @pubnub.grant(channel: :demo, read: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1085", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187517" Pubnub::Grant.any_instance.stub(:signature).and_return "8bb_pN6dtxHQ7EeF-6rIM0bAgLODsAwA_oH3o9qrhHg=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1083", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187518" Pubnub::Grant.any_instance.stub(:signature).and_return "Wv9MmiTZS1u10HD65koH-8PXvP5RSMTvgDxU5W_vVAY=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1084", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187518" Pubnub::Grant.any_instance.stub(:signature).and_return "Wv9MmiTZS1u10HD65koH-8PXvP5RSMTvgDxU5W_vVAY=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1082", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187519" Pubnub::Grant.any_instance.stub(:signature).and_return "MqpG_goY-xaEhvj7SWQn7FYKIe6566TkL6J6ObuuL0s=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1080", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187519" Pubnub::Grant.any_instance.stub(:signature).and_return "MqpG_goY-xaEhvj7SWQn7FYKIe6566TkL6J6ObuuL0s=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1081", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187520" Pubnub::Grant.any_instance.stub(:signature).and_return "j8_7Y-6zEE4H94qkloA3t0MIDUspB75KkKQ0rxbK8V4=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1091", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187520" Pubnub::Grant.any_instance.stub(:signature).and_return "bAS8REKm0dsThzGs-Ix0tCgTT-Vm0PgnZ2xKaGVyF2E=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1089", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187521" Pubnub::Grant.any_instance.stub(:signature).and_return "kWRNBBk_n1BeneSm4mUHdGV9s2dh_obG0Aai3ihcs20=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1090", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187521" Pubnub::Grant.any_instance.stub(:signature).and_return "kWRNBBk_n1BeneSm4mUHdGV9s2dh_obG0Aai3ihcs20=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1088", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187522" Pubnub::Grant.any_instance.stub(:signature).and_return "ynjpUu_cMNkPwn8koawI3a6eT5BFRCTjH69BR-At7tI=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1086", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187522" Pubnub::Grant.any_instance.stub(:signature).and_return "ynjpUu_cMNkPwn8koawI3a6eT5BFRCTjH69BR-At7tI=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1087", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187523" Pubnub::Grant.any_instance.stub(:signature).and_return "vwsOh8dvQUtP-bcod87vejENhNfZqVQ_xD_ETX53QsU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1097", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187523" Pubnub::Grant.any_instance.stub(:signature).and_return "Je7UDfg39NSqB9072ZIQjADaq34xHdfr7oZvH-58Gyw=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1095", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187524" Pubnub::Grant.any_instance.stub(:signature).and_return "nsoLlJSIJe9SwggDP-w4YZy97f4uI9bJvzcAFx5dinU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1096", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187524" Pubnub::Grant.any_instance.stub(:signature).and_return "nsoLlJSIJe9SwggDP-w4YZy97f4uI9bJvzcAFx5dinU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1094", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187525" Pubnub::Grant.any_instance.stub(:signature).and_return "wxqQ1vhXTMk5pGpOuD3ojLJWTWC0jJlnshIW1tcgwx4=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1092", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187526" Pubnub::Grant.any_instance.stub(:signature).and_return "ZGc51rD9es_bFrU-q9R_JM7UgJJd75i-9shls31OBr0=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1093", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187526" Pubnub::Grant.any_instance.stub(:signature).and_return "ZGc51rD9es_bFrU-q9R_JM7UgJJd75i-9shls31OBr0=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1103", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187527" Pubnub::Grant.any_instance.stub(:signature).and_return "7ySussfhJgofaOXNetxy9QwjGm1zLP8iO7r0cNuGpKQ=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1101", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187527" Pubnub::Grant.any_instance.stub(:signature).and_return "7ySussfhJgofaOXNetxy9QwjGm1zLP8iO7r0cNuGpKQ=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1102", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187528" Pubnub::Grant.any_instance.stub(:signature).and_return "ISzSxxo54275kzwFq7o8xYzcqMedLxEOQipFvIMu92M=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1100", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187528" Pubnub::Grant.any_instance.stub(:signature).and_return "ISzSxxo54275kzwFq7o8xYzcqMedLxEOQipFvIMu92M=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1098", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187529" Pubnub::Grant.any_instance.stub(:signature).and_return "HzL12yo54Cj20llWUaR9vRGWsVRQN30RULelVq8C6Hw=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1099", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187529" Pubnub::Grant.any_instance.stub(:signature).and_return "HzL12yo54Cj20llWUaR9vRGWsVRQN30RULelVq8C6Hw=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1109", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187530" Pubnub::Grant.any_instance.stub(:signature).and_return "ouZ0x8A6lnJXSoOluYtbRq18VO8RpT2Wxmv3A_aMz14=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1107", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187530" Pubnub::Grant.any_instance.stub(:signature).and_return "ouZ0x8A6lnJXSoOluYtbRq18VO8RpT2Wxmv3A_aMz14=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1108", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187531" Pubnub::Grant.any_instance.stub(:signature).and_return "aTi363mlJo6Piggm22xn9petdQ-a5T4IdPgaQeldDyU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1106", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187531" Pubnub::Grant.any_instance.stub(:signature).and_return "aTi363mlJo6Piggm22xn9petdQ-a5T4IdPgaQeldDyU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1104", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187532" Pubnub::Grant.any_instance.stub(:signature).and_return "HLp2s8yIxFE_eFgjGhBl9TwKDYwz3_Qj1Ec9sWYXV3I=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1105", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187533" Pubnub::Grant.any_instance.stub(:signature).and_return "hNU8ynQJLch2y8PqvSaCN8uQJTQ0zhaj5L_CulaQ5TU=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1115", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187533" Pubnub::Grant.any_instance.stub(:signature).and_return "kyyYsdbUYR-BmiDodyQazt_j2hDvp5uKW0MVbGliF_s=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1113", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187534" Pubnub::Grant.any_instance.stub(:signature).and_return "zwbSvDhMN3HNdkX1lq1ooDl9rYLmeujZXlYJS4IUC2Y=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1114", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187534" Pubnub::Grant.any_instance.stub(:signature).and_return "zwbSvDhMN3HNdkX1lq1ooDl9rYLmeujZXlYJS4IUC2Y=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1112", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187535" Pubnub::Grant.any_instance.stub(:signature).and_return "a4YVD_6PvxrL02jYcOVba5nvgQPILRhzjfd4Rqj9gn4=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1110", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187535" Pubnub::Grant.any_instance.stub(:signature).and_return "a4YVD_6PvxrL02jYcOVba5nvgQPILRhzjfd4Rqj9gn4=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1111", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187536" Pubnub::Grant.any_instance.stub(:signature).and_return "13_FPXX-JDUC_vlUj4JSU4dccdLRvdnCZHRI38XUZDI=" envelope = @pubnub.grant(channel: :demo, read: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1121", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187536" Pubnub::Grant.any_instance.stub(:signature).and_return "gqn4dw3N1lNWoXXlKLLAXlW4zmmwhSQ-p8M6KYwnCH4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1119", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187537" Pubnub::Grant.any_instance.stub(:signature).and_return "ir-Hxlc-iyRLeQOpZ1nQDQQwx_VHUjrGMlJBL6phyM4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1120", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187537" Pubnub::Grant.any_instance.stub(:signature).and_return "ir-Hxlc-iyRLeQOpZ1nQDQQwx_VHUjrGMlJBL6phyM4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1118", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187538" Pubnub::Grant.any_instance.stub(:signature).and_return "ATBjJCVZD-Pgqiytr0TJpSXXNlqKB6TNX-E3LZMd1IY=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1116", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187538" Pubnub::Grant.any_instance.stub(:signature).and_return "ATBjJCVZD-Pgqiytr0TJpSXXNlqKB6TNX-E3LZMd1IY=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1117", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187539" Pubnub::Grant.any_instance.stub(:signature).and_return "AZIwPuVu13lPewWLrpgFIKeesDTkJI4Q5dIpyK9OhIE=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1127", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187539" Pubnub::Grant.any_instance.stub(:signature).and_return "rz86b-jcAj9OCQsuVXm1-3pxoxLdTDw4Yg3GGtRrL0I=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1125", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187540" Pubnub::Grant.any_instance.stub(:signature).and_return "f__-4NcWhc-uhUodWkk9Mb9T1k5k2A97jGi2yWe_0uk=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1126", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187540" Pubnub::Grant.any_instance.stub(:signature).and_return "f__-4NcWhc-uhUodWkk9Mb9T1k5k2A97jGi2yWe_0uk=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1124", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187541" Pubnub::Grant.any_instance.stub(:signature).and_return "GN_gsHELrYHXKtMBGHJK_EUNkXomi8QqgXMzZOYiH6c=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1122", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187542" Pubnub::Grant.any_instance.stub(:signature).and_return "x8rlZB4GAqUhmGV4SRj6-agTTG4aHKOUVo_kURn32r4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1123", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187542" Pubnub::Grant.any_instance.stub(:signature).and_return "x8rlZB4GAqUhmGV4SRj6-agTTG4aHKOUVo_kURn32r4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1133", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187543" Pubnub::Grant.any_instance.stub(:signature).and_return "qgjATSALyMQdDj_4opkZf5jZAUE-DbWvmtj98PMrTyI=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1131", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187544" Pubnub::Grant.any_instance.stub(:signature).and_return "549Qg2T9frcA4eF7x-Jz6u2wDANcl1rawStbFymFwZ4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1132", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187544" Pubnub::Grant.any_instance.stub(:signature).and_return "549Qg2T9frcA4eF7x-Jz6u2wDANcl1rawStbFymFwZ4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1130", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187545" Pubnub::Grant.any_instance.stub(:signature).and_return "WDujATxzypry4ahhRjt-_zQTULJBqWM84eDGeKpaSw4=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1128", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187546" Pubnub::Grant.any_instance.stub(:signature).and_return "lBXGq4CAa_rnPR8if1gB_a9Lv1q58vn-YJ_eYqzaaNA=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1129", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187546" Pubnub::Grant.any_instance.stub(:signature).and_return "lBXGq4CAa_rnPR8if1gB_a9Lv1q58vn-YJ_eYqzaaNA=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1139", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187547" Pubnub::Grant.any_instance.stub(:signature).and_return "fPaiVaDRYRUG1_vEOoMuVCRUvGsb8RVmhtyq5lMvaps=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1137", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187547" Pubnub::Grant.any_instance.stub(:signature).and_return "fPaiVaDRYRUG1_vEOoMuVCRUvGsb8RVmhtyq5lMvaps=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1138", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187548" Pubnub::Grant.any_instance.stub(:signature).and_return "6LObChqrivd1R8Rj2PjzMHGOZk2UA97hikWyJAKOYDE=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1136", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187549" Pubnub::Grant.any_instance.stub(:signature).and_return "t1ilKpHPeCSXqjXDn_-KEVRBHllJRE7W61Raifsqqek=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1134", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187549" Pubnub::Grant.any_instance.stub(:signature).and_return "t1ilKpHPeCSXqjXDn_-KEVRBHllJRE7W61Raifsqqek=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1135", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187550" Pubnub::Grant.any_instance.stub(:signature).and_return "6EEMRS2NIM4Pe6tyWeGdOoxVJAShMfvp7LPcDAVlc0g=" envelope = @pubnub.grant(channel: :demo, read: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1145", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187550" Pubnub::Grant.any_instance.stub(:signature).and_return "kFaRFzVw-sOvnXFEqhoCOLRyUxY12zCj9B78vzn0tnY=" envelope = @pubnub.grant(channel: :demo, read: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1143", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187551" Pubnub::Grant.any_instance.stub(:signature).and_return "_f24oCQf0mSKAP-oJ9NKzdCkV29PGH6FvnhRBSE48tg=" envelope = @pubnub.grant(channel: :demo, read: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1144", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187551" Pubnub::Grant.any_instance.stub(:signature).and_return "_f24oCQf0mSKAP-oJ9NKzdCkV29PGH6FvnhRBSE48tg=" envelope = @pubnub.grant(channel: :demo, read: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1142", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187552" Pubnub::Grant.any_instance.stub(:signature).and_return "X2VW9v8gh_e3-qMnYWULW3g-tQcGYOG4m3yW5YSHrVA=" envelope = @pubnub.grant(channel: :demo, read: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1140", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187552" Pubnub::Grant.any_instance.stub(:signature).and_return "X2VW9v8gh_e3-qMnYWULW3g-tQcGYOG4m3yW5YSHrVA=" envelope = @pubnub.grant(channel: :demo, read: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1141", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187553" Pubnub::Grant.any_instance.stub(:signature).and_return "koZE_8vnXx5fuHXtVeVttZQ6rdHqEH3dAmoNYC5Fd7E=" envelope = @pubnub.grant(channel: :demo, read: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1151", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187554" Pubnub::Grant.any_instance.stub(:signature).and_return "TcGjtezElnQPZeMF10FmFtoND9n7kD_cLeXv1UAuoEk=" envelope = @pubnub.grant(channel: :demo, read: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1149", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187554" Pubnub::Grant.any_instance.stub(:signature).and_return "TcGjtezElnQPZeMF10FmFtoND9n7kD_cLeXv1UAuoEk=" envelope = @pubnub.grant(channel: :demo, read: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1150", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187555" Pubnub::Grant.any_instance.stub(:signature).and_return "Z_rrbejr2SB4x2TzNgrkP-4E5--RBin9pLw72rpn8SI=" envelope = @pubnub.grant(channel: :demo, read: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1148", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187555" Pubnub::Grant.any_instance.stub(:signature).and_return "Z_rrbejr2SB4x2TzNgrkP-4E5--RBin9pLw72rpn8SI=" envelope = @pubnub.grant(channel: :demo, read: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1146", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187556" Pubnub::Grant.any_instance.stub(:signature).and_return "bHSwKhSRpjSdmHcHnYJUPCGGO6ZafMvkWJahTobjMOA=" envelope = @pubnub.grant(channel: :demo, read: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1147", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187556" Pubnub::Grant.any_instance.stub(:signature).and_return "bHSwKhSRpjSdmHcHnYJUPCGGO6ZafMvkWJahTobjMOA=" envelope = @pubnub.grant(channel: :demo, read: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1589", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187557" Pubnub::Grant.any_instance.stub(:signature).and_return "zRvRzGDcGrQ6FbT0kTkd6S5t5nFZjiGHekvCi39qzC8=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1587", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187558" Pubnub::Grant.any_instance.stub(:signature).and_return "wFIdnZxMx8evIMkeG4CFLsIFJ9YhxBx92s1mS44QF8Y=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1588", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187558" Pubnub::Grant.any_instance.stub(:signature).and_return "wFIdnZxMx8evIMkeG4CFLsIFJ9YhxBx92s1mS44QF8Y=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1586", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187559" Pubnub::Grant.any_instance.stub(:signature).and_return "SLxAkbBnvstEKrys1bJp_lHKv8gxJp9Ql0SSoGYD6X0=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1584", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187559" Pubnub::Grant.any_instance.stub(:signature).and_return "SLxAkbBnvstEKrys1bJp_lHKv8gxJp9Ql0SSoGYD6X0=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1585", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187560" Pubnub::Grant.any_instance.stub(:signature).and_return "8iQrXVmGrMXAM24NNoQHLUa0f0mbpwT253vP2ie8Bl4=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1595", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187560" Pubnub::Grant.any_instance.stub(:signature).and_return "HFnxKaqGBIcmzCery29-BkX-CvIpVKLcjyklLQG-fqM=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1593", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187561" Pubnub::Grant.any_instance.stub(:signature).and_return "M6J94kn02a3sFrUlO8op1V7hVln1r3FJWoVOlBt9A5M=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1594", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187562" Pubnub::Grant.any_instance.stub(:signature).and_return "kLt9ydXecdNAiTrp-BzqlQbkL0joGGPlDCPs_HdJY1s=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1592", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187562" Pubnub::Grant.any_instance.stub(:signature).and_return "kLt9ydXecdNAiTrp-BzqlQbkL0joGGPlDCPs_HdJY1s=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1590", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187563" Pubnub::Grant.any_instance.stub(:signature).and_return "Oexw2ekKAyVYL-FVLOsrTswlUkOHAfHpGdi-Nrl0E-o=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1591", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187563" Pubnub::Grant.any_instance.stub(:signature).and_return "Oexw2ekKAyVYL-FVLOsrTswlUkOHAfHpGdi-Nrl0E-o=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1601", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187564" Pubnub::Grant.any_instance.stub(:signature).and_return "A-GqizCdbPqZlhvmpzqbvQcXkjpAfwxPvk6qTGvQvKo=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1599", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187565" Pubnub::Grant.any_instance.stub(:signature).and_return "73Bl8oFQ7mOOxLsNlDPPfHNvSHMTv-Hy7YKwyTsYt2c=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1600", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187565" Pubnub::Grant.any_instance.stub(:signature).and_return "73Bl8oFQ7mOOxLsNlDPPfHNvSHMTv-Hy7YKwyTsYt2c=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1598", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187566" Pubnub::Grant.any_instance.stub(:signature).and_return "CsvK2l0lNg-AxUc0FPV_YlcguFDgDoOxx-GfJjpDB2w=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1596", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187566" Pubnub::Grant.any_instance.stub(:signature).and_return "CsvK2l0lNg-AxUc0FPV_YlcguFDgDoOxx-GfJjpDB2w=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1597", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187567" Pubnub::Grant.any_instance.stub(:signature).and_return "R0GY-1G8OPCveIjeuWQWza6mf4kEVJAbHOjO37BIVmg=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1607", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187568" Pubnub::Grant.any_instance.stub(:signature).and_return "pblTheGC9-zOEtaO3jcQMNgW9asPyiGeO8TnfAGcbig=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1605", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187568" Pubnub::Grant.any_instance.stub(:signature).and_return "pblTheGC9-zOEtaO3jcQMNgW9asPyiGeO8TnfAGcbig=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1606", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187569" Pubnub::Grant.any_instance.stub(:signature).and_return "aqCsrDN-HOVV10QpKm52IvtWTPp5rVY7MJ35xHXnzQE=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1604", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187569" Pubnub::Grant.any_instance.stub(:signature).and_return "aqCsrDN-HOVV10QpKm52IvtWTPp5rVY7MJ35xHXnzQE=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1602", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187570" Pubnub::Grant.any_instance.stub(:signature).and_return "UDLw5b8M8TZYgIPVpUGWGi66fBHDbSdk-aSZpuK1sc4=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1603", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187570" Pubnub::Grant.any_instance.stub(:signature).and_return "UDLw5b8M8TZYgIPVpUGWGi66fBHDbSdk-aSZpuK1sc4=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1613", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187571" Pubnub::Grant.any_instance.stub(:signature).and_return "3kVnPD-UmQVDLvUhAo7B6GQG6dB-_I93ut1VRsJ2BdA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1611", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187571" Pubnub::Grant.any_instance.stub(:signature).and_return "3kVnPD-UmQVDLvUhAo7B6GQG6dB-_I93ut1VRsJ2BdA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1612", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187572" Pubnub::Grant.any_instance.stub(:signature).and_return "E22ltcs4Jlcb_5mD2zL07Ya89VCcNcSr3UkqwYkmb4s=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1610", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187572" Pubnub::Grant.any_instance.stub(:signature).and_return "E22ltcs4Jlcb_5mD2zL07Ya89VCcNcSr3UkqwYkmb4s=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1608", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187573" Pubnub::Grant.any_instance.stub(:signature).and_return "s9-ziCEkL2TYvvWkkOTl_DNpG8z-b8duKHV2V5OWTIA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1609", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187573" Pubnub::Grant.any_instance.stub(:signature).and_return "s9-ziCEkL2TYvvWkkOTl_DNpG8z-b8duKHV2V5OWTIA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1619", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187574" Pubnub::Grant.any_instance.stub(:signature).and_return "Z2S1e2Nd8wl_5zh0sEF4x5cuB0yDcknGnmd-P_1iJQw=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1617", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187574" Pubnub::Grant.any_instance.stub(:signature).and_return "Z2S1e2Nd8wl_5zh0sEF4x5cuB0yDcknGnmd-P_1iJQw=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1618", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187575" Pubnub::Grant.any_instance.stub(:signature).and_return "KsRXlKv4tLfseLBNdG90qP5XNKJmLvbDwrBB7mEDqTs=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1616", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187575" Pubnub::Grant.any_instance.stub(:signature).and_return "KsRXlKv4tLfseLBNdG90qP5XNKJmLvbDwrBB7mEDqTs=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1614", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187576" Pubnub::Grant.any_instance.stub(:signature).and_return "jq_EWQhqpHsCz6DzQAOK8HIy7_4OaGOHGrq8XKt0NPI=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1615", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187577" Pubnub::Grant.any_instance.stub(:signature).and_return "JYCss00sGjY9Ibm8v5Hww0EXnHyz8mti7daq6-6xGlE=" envelope = @pubnub.grant(channel: :demo, write: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1517", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187577" Pubnub::Grant.any_instance.stub(:signature).and_return "mxq74DFBW3bMbMpJSGgekQHU-ocvmXRflGZM2enV_Xo=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1515", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187578" Pubnub::Grant.any_instance.stub(:signature).and_return "cQ4Ay8jNKZjEhqKLWjH8yb_kJkfj-3WxT7R3I26B-n4=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1516", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187578" Pubnub::Grant.any_instance.stub(:signature).and_return "cQ4Ay8jNKZjEhqKLWjH8yb_kJkfj-3WxT7R3I26B-n4=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1514", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187579" Pubnub::Grant.any_instance.stub(:signature).and_return "6hOU3TKi7m6_tkIdg1aqDPhppsI30dp2ipzI_8a74SA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1512", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187579" Pubnub::Grant.any_instance.stub(:signature).and_return "6hOU3TKi7m6_tkIdg1aqDPhppsI30dp2ipzI_8a74SA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1513", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187580" Pubnub::Grant.any_instance.stub(:signature).and_return "bfhHjYHDCMEFNSKcS2OhSy3nSh0feGk0q_qy4IG-WUc=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1523", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187580" Pubnub::Grant.any_instance.stub(:signature).and_return "qp5UUCbq2UmiUxDHip7lZIvpC8H6Q5dxl65LWznXu8o=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1521", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187581" Pubnub::Grant.any_instance.stub(:signature).and_return "JV5p8lydnRfrdvxaC8tTKF18FkaGqpFpx7HHrw8x3RA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1522", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187581" Pubnub::Grant.any_instance.stub(:signature).and_return "JV5p8lydnRfrdvxaC8tTKF18FkaGqpFpx7HHrw8x3RA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1520", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187582" Pubnub::Grant.any_instance.stub(:signature).and_return "isTCE9es19EOHY0WYV-46OJcqcRxWEbbkxIiCE38nCg=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1518", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187583" Pubnub::Grant.any_instance.stub(:signature).and_return "K1_dMPANrWxE-jteCkawfXNNlaP2cRqepRRxIYg1lFo=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1519", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187583" Pubnub::Grant.any_instance.stub(:signature).and_return "K1_dMPANrWxE-jteCkawfXNNlaP2cRqepRRxIYg1lFo=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1529", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187584" Pubnub::Grant.any_instance.stub(:signature).and_return "_Bw4p862QWi5EZsBUo59Wg-c9bRAnLQkxHptK8cnxmQ=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1527", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187584" Pubnub::Grant.any_instance.stub(:signature).and_return "_Bw4p862QWi5EZsBUo59Wg-c9bRAnLQkxHptK8cnxmQ=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1528", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187585" Pubnub::Grant.any_instance.stub(:signature).and_return "U5LqWaSOxAOp7ZT4QUSkMjHxRJ5LeSoGeYYF4gVIhLQ=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1526", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187586" Pubnub::Grant.any_instance.stub(:signature).and_return "EF0-Z4ZW4_wi6SMAEZ3zf3Q6C2snJpTTaTkvr_P4WBA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1524", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187586" Pubnub::Grant.any_instance.stub(:signature).and_return "EF0-Z4ZW4_wi6SMAEZ3zf3Q6C2snJpTTaTkvr_P4WBA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1525", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187587" Pubnub::Grant.any_instance.stub(:signature).and_return "X6Xr2Ee-McE0RHMnrhy7vENV9WQTuZBsqrs28ULn8oI=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1535", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187587" Pubnub::Grant.any_instance.stub(:signature).and_return "ST_qiPqStAOwysCa05kcTNCAWYzsF_Pvs3yPPRnmzuc=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1533", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187588" Pubnub::Grant.any_instance.stub(:signature).and_return "l5RG3bQGAErK9brpYdsliGZXPsP-stiSNdrkUr8MC64=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1534", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187588" Pubnub::Grant.any_instance.stub(:signature).and_return "l5RG3bQGAErK9brpYdsliGZXPsP-stiSNdrkUr8MC64=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1532", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187589" Pubnub::Grant.any_instance.stub(:signature).and_return "oH0Sl82skXQQURrCxY-rtFT_SkzC5qfCPohc32Nml6Y=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1530", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187590" Pubnub::Grant.any_instance.stub(:signature).and_return "-Opzce7SYaVCR1cOX8hW98VM7x5HCQnxOWqjK08pIAo=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1531", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187591" Pubnub::Grant.any_instance.stub(:signature).and_return "GImtsbV_VnbYH0T2vCS9SDAsh5hUlr0AqrAJnE4yVdw=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1541", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187591" Pubnub::Grant.any_instance.stub(:signature).and_return "jsx5tgqQmDFn5FWlypmaYLxH7D26wC27fWWGRBSdIfg=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1539", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187592" Pubnub::Grant.any_instance.stub(:signature).and_return "o8g6ivMxe34tOsaFz3Vp0Mvvs3pLgTjfktmCSKwBYnI=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1540", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187592" Pubnub::Grant.any_instance.stub(:signature).and_return "o8g6ivMxe34tOsaFz3Vp0Mvvs3pLgTjfktmCSKwBYnI=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1538", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187593" Pubnub::Grant.any_instance.stub(:signature).and_return "6I4RRwyYj8nXPPGSc-Lq9yKT4WhL8NwchJItZc9_2xI=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1536", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187593" Pubnub::Grant.any_instance.stub(:signature).and_return "6I4RRwyYj8nXPPGSc-Lq9yKT4WhL8NwchJItZc9_2xI=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1537", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187594" Pubnub::Grant.any_instance.stub(:signature).and_return "S_NGKFuD_lOAMOkug_Kr1l0IPxNn9QlyC_SPj0Twl00=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1547", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187595" Pubnub::Grant.any_instance.stub(:signature).and_return "zWKo_2v9XbTizt41yntoLeaZXbpRgSmlr-tFCnK3mDc=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1545", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187595" Pubnub::Grant.any_instance.stub(:signature).and_return "zWKo_2v9XbTizt41yntoLeaZXbpRgSmlr-tFCnK3mDc=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1546", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187596" Pubnub::Grant.any_instance.stub(:signature).and_return "guyzhQ1yYEYiIRtPH2OXUsfDssHv93DkiQ2mSlKTnMA=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1544", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187597" Pubnub::Grant.any_instance.stub(:signature).and_return "AaQ3vNPpUS4NpaetugcvI6PDHI9VzLi-9PA2fxscPI0=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1542", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187597" Pubnub::Grant.any_instance.stub(:signature).and_return "AaQ3vNPpUS4NpaetugcvI6PDHI9VzLi-9PA2fxscPI0=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1543", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187598" Pubnub::Grant.any_instance.stub(:signature).and_return "Qly_CkZf9VxFGcCOTmHP98SRjZ-IaGfk7fK8UdyGTwM=" envelope = @pubnub.grant(channel: :demo, write: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1553", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187598" Pubnub::Grant.any_instance.stub(:signature).and_return "lV3CrrlhyP9SVssuuhq99o080JUVU1RwTpVkvT5EnMs=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1551", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187599" Pubnub::Grant.any_instance.stub(:signature).and_return "9riB2baCdq1NnHcXZ8gsyvix_t5EZ-XTEC2WcSeAOBY=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1552", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187600" Pubnub::Grant.any_instance.stub(:signature).and_return "mUOhsx7dCQ0fewpEXpKFahqCZOhN9OSyIQIUQVQ-IKE=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1550", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187600" Pubnub::Grant.any_instance.stub(:signature).and_return "mUOhsx7dCQ0fewpEXpKFahqCZOhN9OSyIQIUQVQ-IKE=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1548", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187601" Pubnub::Grant.any_instance.stub(:signature).and_return "tiLNocmyKV4ozEyD9soCLcnGK4kkE5t4wNX2NfVQm-w=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1549", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187603" Pubnub::Grant.any_instance.stub(:signature).and_return "cToFpepPotAjqUcNoN8FjvPrK3irdvMXG7IKHDIn1hw=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1559", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187604" Pubnub::Grant.any_instance.stub(:signature).and_return "C59vjqBHFx4X-hBOWGlMtGLewRT4XPMUbih077_yxI8=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1557", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187605" Pubnub::Grant.any_instance.stub(:signature).and_return "U5FLeHsDb9Bpr9fjEyk7VF58PI8NLAaQo8AWZYhTWN4=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1558", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187605" Pubnub::Grant.any_instance.stub(:signature).and_return "U5FLeHsDb9Bpr9fjEyk7VF58PI8NLAaQo8AWZYhTWN4=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1556", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187606" Pubnub::Grant.any_instance.stub(:signature).and_return "-nXWWeQYbfTFImH3o-vPGftXMS0k7D9gZ8SMUKkdWNg=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1554", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187607" Pubnub::Grant.any_instance.stub(:signature).and_return "paxH7EQzKQMr_mw1_fUXjgIWCh_hUGixTymKAfQLU7s=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1555", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187607" Pubnub::Grant.any_instance.stub(:signature).and_return "paxH7EQzKQMr_mw1_fUXjgIWCh_hUGixTymKAfQLU7s=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1565", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187608" Pubnub::Grant.any_instance.stub(:signature).and_return "pOUGGrGVMhyVqQVQJQmx-n8GDGWJTLswiNHEn7mQnqo=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1563", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187608" Pubnub::Grant.any_instance.stub(:signature).and_return "pOUGGrGVMhyVqQVQJQmx-n8GDGWJTLswiNHEn7mQnqo=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1564", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187609" Pubnub::Grant.any_instance.stub(:signature).and_return "5bjJZBcimR1Fmw2fTaurje9dmGsYh1dszTa4mVEOxCk=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1562", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187610" Pubnub::Grant.any_instance.stub(:signature).and_return "inA9dUDAT4GunL1wbS8unwyuUefQTF9SSrhPrawbq90=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1560", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187610" Pubnub::Grant.any_instance.stub(:signature).and_return "inA9dUDAT4GunL1wbS8unwyuUefQTF9SSrhPrawbq90=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1561", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187611" Pubnub::Grant.any_instance.stub(:signature).and_return "NIvlbQUGqL2PtejcXSbrImHuOusfwtMLDKOSSv5G4Es=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1571", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187611" Pubnub::Grant.any_instance.stub(:signature).and_return "poPOhzx1n9cedXuKM0eIgQHMU1UHiH8d6fmxO8aRnrA=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1569", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187612" Pubnub::Grant.any_instance.stub(:signature).and_return "7pr7N6hjpbv4bomtqV0cgLCGRHo4EpvI8hy7O3qHblI=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1570", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187612" Pubnub::Grant.any_instance.stub(:signature).and_return "7pr7N6hjpbv4bomtqV0cgLCGRHo4EpvI8hy7O3qHblI=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1568", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187613" Pubnub::Grant.any_instance.stub(:signature).and_return "nmL1jJ1fXOEBkVMH32H6QYikTTcrOqNSjo_fWN33pBo=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1566", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187613" Pubnub::Grant.any_instance.stub(:signature).and_return "nmL1jJ1fXOEBkVMH32H6QYikTTcrOqNSjo_fWN33pBo=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1567", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187614" Pubnub::Grant.any_instance.stub(:signature).and_return "0QebxW2qbtjPpouPh3ictRWxUWXz1mDI32t6-U_tuic=" envelope = @pubnub.grant(channel: :demo, write: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1577", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187614" Pubnub::Grant.any_instance.stub(:signature).and_return "K9omTytDtVRE66MN_lpSKdahoRbUQFKhIaITd2Hv7Ek=" envelope = @pubnub.grant(channel: :demo, write: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1575", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187615" Pubnub::Grant.any_instance.stub(:signature).and_return "YmFXxiXE-uQvHYYaCJHbx_q6toZVFx471ZI-j3MUNJk=" envelope = @pubnub.grant(channel: :demo, write: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1576", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187615" Pubnub::Grant.any_instance.stub(:signature).and_return "YmFXxiXE-uQvHYYaCJHbx_q6toZVFx471ZI-j3MUNJk=" envelope = @pubnub.grant(channel: :demo, write: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1574", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187616" Pubnub::Grant.any_instance.stub(:signature).and_return "FAegylbmDJo1pkv8NwMn-k29KOVDXPPDB8BqElMftiw=" envelope = @pubnub.grant(channel: :demo, write: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1572", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187616" Pubnub::Grant.any_instance.stub(:signature).and_return "FAegylbmDJo1pkv8NwMn-k29KOVDXPPDB8BqElMftiw=" envelope = @pubnub.grant(channel: :demo, write: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1573", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187617" Pubnub::Grant.any_instance.stub(:signature).and_return "LWWlcTFBfmjeDmEzVeX9m7QvK6f9C0OevvBp-RiZKk8=" envelope = @pubnub.grant(channel: :demo, write: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1583", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187618" Pubnub::Grant.any_instance.stub(:signature).and_return "LUUKcwRwyTBfPjwM-OdxXboGsEMnptt0jc2X3o3RDWw=" envelope = @pubnub.grant(channel: :demo, write: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1581", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187618" Pubnub::Grant.any_instance.stub(:signature).and_return "LUUKcwRwyTBfPjwM-OdxXboGsEMnptt0jc2X3o3RDWw=" envelope = @pubnub.grant(channel: :demo, write: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1582", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187619" Pubnub::Grant.any_instance.stub(:signature).and_return "q21BvIZJSF3CFo0qgnqhMPKzmY8_uA223vgrU0z3GZE=" envelope = @pubnub.grant(channel: :demo, write: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1580", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187620" Pubnub::Grant.any_instance.stub(:signature).and_return "vGW0y0nnnFcvVGH2KGfXVnqG57qo0zxcPijVaSQXlRM=" envelope = @pubnub.grant(channel: :demo, write: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1578", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187620" Pubnub::Grant.any_instance.stub(:signature).and_return "vGW0y0nnnFcvVGH2KGfXVnqG57qo0zxcPijVaSQXlRM=" envelope = @pubnub.grant(channel: :demo, write: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1579", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187621" Pubnub::Grant.any_instance.stub(:signature).and_return "x3X_iVbic93ZiEZ-A1xwqGiGnrXyfR8iJH0pnkevKfA=" envelope = @pubnub.grant(channel: :demo, write: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1373", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187621" Pubnub::Grant.any_instance.stub(:signature).and_return "xaSLgnyNqebsyM_c6u43YL1BqaN46tOEtRyZ5DDBpc8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1371", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187622" Pubnub::Grant.any_instance.stub(:signature).and_return "mEvMURwqN_Znwzo8b7Fs1shGk-gsMrbnd79hPKurR4g=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1372", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187622" Pubnub::Grant.any_instance.stub(:signature).and_return "mEvMURwqN_Znwzo8b7Fs1shGk-gsMrbnd79hPKurR4g=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1370", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187623" Pubnub::Grant.any_instance.stub(:signature).and_return "2MMHa4jHwEajXdq_hzcRYEj2JGuMKQFf9fFVKix6HcM=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1368", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187623" Pubnub::Grant.any_instance.stub(:signature).and_return "2MMHa4jHwEajXdq_hzcRYEj2JGuMKQFf9fFVKix6HcM=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1369", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187624" Pubnub::Grant.any_instance.stub(:signature).and_return "ZyyKPwU_2preQ2Kqo-XwYpsL7d2rt015ZCBlNh34Rwo=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1379", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187624" Pubnub::Grant.any_instance.stub(:signature).and_return "cEZ9FuoH5oKCU6xPg8InkBvBrP8LYn6w9QSf_ThqDXU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1377", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187625" Pubnub::Grant.any_instance.stub(:signature).and_return "_X_gIVyrIPWALoCGiHxdSrJ0p-Ib6NqWgBoUsNSYC8s=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1378", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187626" Pubnub::Grant.any_instance.stub(:signature).and_return "6pG0H0jMf0ZORRlOwyXW2WDPmvaFYsngWJN_bYrSqfc=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1376", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187626" Pubnub::Grant.any_instance.stub(:signature).and_return "6pG0H0jMf0ZORRlOwyXW2WDPmvaFYsngWJN_bYrSqfc=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1374", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187627" Pubnub::Grant.any_instance.stub(:signature).and_return "zfOpose1CdqqTku00IhSVkhIuvr9dB0Kf-AzpL7anhY=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1375", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187627" Pubnub::Grant.any_instance.stub(:signature).and_return "zfOpose1CdqqTku00IhSVkhIuvr9dB0Kf-AzpL7anhY=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1385", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187628" Pubnub::Grant.any_instance.stub(:signature).and_return "ioLBWWwGRemID90KH5m205w9Xi5ZZwgEILI035PYvi8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1383", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187628" Pubnub::Grant.any_instance.stub(:signature).and_return "ioLBWWwGRemID90KH5m205w9Xi5ZZwgEILI035PYvi8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1384", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187629" Pubnub::Grant.any_instance.stub(:signature).and_return "Bl1Fr77rMgPGdUwLcBa1sBG-tqHj8ZBBzqJxV_Ewk6o=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1382", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187629" Pubnub::Grant.any_instance.stub(:signature).and_return "Bl1Fr77rMgPGdUwLcBa1sBG-tqHj8ZBBzqJxV_Ewk6o=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1380", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187630" Pubnub::Grant.any_instance.stub(:signature).and_return "asBB80OEWeNLM2teozMPCrXUPkQL9dX-755toUAsBgg=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1381", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187630" Pubnub::Grant.any_instance.stub(:signature).and_return "asBB80OEWeNLM2teozMPCrXUPkQL9dX-755toUAsBgg=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1391", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187631" Pubnub::Grant.any_instance.stub(:signature).and_return "rJq0jaNrDI1-KCo06yq2wVT1lKZN1agmCVtfY3tKYJY=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1389", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187631" Pubnub::Grant.any_instance.stub(:signature).and_return "rJq0jaNrDI1-KCo06yq2wVT1lKZN1agmCVtfY3tKYJY=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1390", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187632" Pubnub::Grant.any_instance.stub(:signature).and_return "n5_2LAEBK9LIxT9QbBpQv7rq_xFDC0m5PDBE-HHN9bQ=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1388", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187632" Pubnub::Grant.any_instance.stub(:signature).and_return "n5_2LAEBK9LIxT9QbBpQv7rq_xFDC0m5PDBE-HHN9bQ=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1386", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187633" Pubnub::Grant.any_instance.stub(:signature).and_return "nmnMExiHnOq5o6e2xI2aMifAO2v8fJ0latUJ1-LNwiM=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1387", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187633" Pubnub::Grant.any_instance.stub(:signature).and_return "nmnMExiHnOq5o6e2xI2aMifAO2v8fJ0latUJ1-LNwiM=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1397", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187634" Pubnub::Grant.any_instance.stub(:signature).and_return "5qeF7IykFrFehgcFxw44B9Qb9o6tAfnTDqu3LRjQL7c=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1395", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187634" Pubnub::Grant.any_instance.stub(:signature).and_return "5qeF7IykFrFehgcFxw44B9Qb9o6tAfnTDqu3LRjQL7c=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1396", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187635" Pubnub::Grant.any_instance.stub(:signature).and_return "PWJOUbB9DY53lboIyu6Si6ci4_xKz7BvPzdQszBBL9o=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1394", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187636" Pubnub::Grant.any_instance.stub(:signature).and_return "ishpKft36qVCKSzY0NVoWP0iUI06aabb38mSaH9eCGU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1392", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187636" Pubnub::Grant.any_instance.stub(:signature).and_return "ishpKft36qVCKSzY0NVoWP0iUI06aabb38mSaH9eCGU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1393", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187637" Pubnub::Grant.any_instance.stub(:signature).and_return "U7DOuusAUy_Go5ItWVT2jhO9_8uTa6fmASm9ANnu0R4=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1403", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187637" Pubnub::Grant.any_instance.stub(:signature).and_return "ga-XjM0NNmchiFA3SvwTbcGIHH5vWMEU_764v_yLWdI=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1401", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187638" Pubnub::Grant.any_instance.stub(:signature).and_return "dDdwZUo-YZSRrlkQOJONRH0fHh2HEWdRqm_dOHhzNR0=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1402", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187638" Pubnub::Grant.any_instance.stub(:signature).and_return "dDdwZUo-YZSRrlkQOJONRH0fHh2HEWdRqm_dOHhzNR0=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1400", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187639" Pubnub::Grant.any_instance.stub(:signature).and_return "KwCos-xPl5qYLfwzGg98PlkU4FAdW6_JzVIxJonXdGQ=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1398", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187639" Pubnub::Grant.any_instance.stub(:signature).and_return "KwCos-xPl5qYLfwzGg98PlkU4FAdW6_JzVIxJonXdGQ=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1399", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187640" Pubnub::Grant.any_instance.stub(:signature).and_return "Zafq9J8jc9-ScctkVysdqcxrKXFRplJNbJWjw4W0oNM=" envelope = @pubnub.grant(channel: :demo, write: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1301", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187640" Pubnub::Grant.any_instance.stub(:signature).and_return "mIGooM8yPrrA8XjSrt0z1xYVavG6e9_d_1DT2vJH4dU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1299", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187641" Pubnub::Grant.any_instance.stub(:signature).and_return "g0uT6YAdhBbwhVakOoXo5eNXo7dIkAEJiCyn5OSXcm8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1300", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187641" Pubnub::Grant.any_instance.stub(:signature).and_return "g0uT6YAdhBbwhVakOoXo5eNXo7dIkAEJiCyn5OSXcm8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1298", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187642" Pubnub::Grant.any_instance.stub(:signature).and_return "l4SHC0R6p-4lKzd7AQ59SOeneCdBpRhX_-reDEjAvo0=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1296", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187643" Pubnub::Grant.any_instance.stub(:signature).and_return "YhgCP7pl5eO-h4sxtGpYBGi3Y9XjiPAdBPyF3YaOofI=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1297", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187643" Pubnub::Grant.any_instance.stub(:signature).and_return "YhgCP7pl5eO-h4sxtGpYBGi3Y9XjiPAdBPyF3YaOofI=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1307", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187644" Pubnub::Grant.any_instance.stub(:signature).and_return "YkByFhBt_J464t7SHQhs4EGmh3pHA5B2j4H9jT6zKq8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1305", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187644" Pubnub::Grant.any_instance.stub(:signature).and_return "YkByFhBt_J464t7SHQhs4EGmh3pHA5B2j4H9jT6zKq8=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1306", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187645" Pubnub::Grant.any_instance.stub(:signature).and_return "eyApj1S0gRTaPogrMJiG2t3PGdnhrx8Tp1VYqIfyEFU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1304", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187645" Pubnub::Grant.any_instance.stub(:signature).and_return "eyApj1S0gRTaPogrMJiG2t3PGdnhrx8Tp1VYqIfyEFU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1302", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187646" Pubnub::Grant.any_instance.stub(:signature).and_return "-zIKzG4C_MoxS3wmr66r9k8RGODL_ke9oN6luB4vZv0=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1303", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187647" Pubnub::Grant.any_instance.stub(:signature).and_return "aTrH9uxcr3iupUcMogZB_brSi9Ks-VH01hxrrVE9M1Y=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1313", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187647" Pubnub::Grant.any_instance.stub(:signature).and_return "uZA2oOL-YcJreplBXPVqcYmL2ORTZLvn-rC9P1t_vxk=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1311", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187648" Pubnub::Grant.any_instance.stub(:signature).and_return "raH3luIK6NqXkZeBPJJx01sWYQ5nCqR8HiqtFiAFmUk=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1312", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187648" Pubnub::Grant.any_instance.stub(:signature).and_return "raH3luIK6NqXkZeBPJJx01sWYQ5nCqR8HiqtFiAFmUk=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1310", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187649" Pubnub::Grant.any_instance.stub(:signature).and_return "_XTIIJIpfsg8lvDj6hV4sqHuCWoqAELr6LG7jlC6q3U=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1308", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187649" Pubnub::Grant.any_instance.stub(:signature).and_return "_XTIIJIpfsg8lvDj6hV4sqHuCWoqAELr6LG7jlC6q3U=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1309", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187650" Pubnub::Grant.any_instance.stub(:signature).and_return "AEyLcLDAPMa2vXxJVyQ_QJ5SsrE1NYAHkVF2F_j1944=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1319", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187650" Pubnub::Grant.any_instance.stub(:signature).and_return "Fk0xNxR2qbq4g8DOcf_-6L31tAsxAsvRzz1KKeixXJo=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1317", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187651" Pubnub::Grant.any_instance.stub(:signature).and_return "43HZTNl4CcB2VkFv7zI0LH2ofJFyM0f3b7hC_EA1PQU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1318", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187651" Pubnub::Grant.any_instance.stub(:signature).and_return "43HZTNl4CcB2VkFv7zI0LH2ofJFyM0f3b7hC_EA1PQU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1316", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187652" Pubnub::Grant.any_instance.stub(:signature).and_return "JGtg2581kNJV44M7grC1dyL3tcWR32RLPwuuD5L_qKI=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1314", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187652" Pubnub::Grant.any_instance.stub(:signature).and_return "JGtg2581kNJV44M7grC1dyL3tcWR32RLPwuuD5L_qKI=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1315", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187653" Pubnub::Grant.any_instance.stub(:signature).and_return "pvV6z7sTzqu7wG7ii086ivCbEGGdvukeVAxlgkq_mqY=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1325", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187653" Pubnub::Grant.any_instance.stub(:signature).and_return "_9sGyN9LzZix_wXg22WrEv6FLxuk_rJgXSqk4xSv5ms=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1323", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187654" Pubnub::Grant.any_instance.stub(:signature).and_return "pr0rABzofG3Ip5daCHT5UC50Api4EdFvDdmXGakszV0=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1324", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187654" Pubnub::Grant.any_instance.stub(:signature).and_return "pr0rABzofG3Ip5daCHT5UC50Api4EdFvDdmXGakszV0=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1322", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187655" Pubnub::Grant.any_instance.stub(:signature).and_return "4_hV1iGNiDQXgtWnhglUfzLDUCSLmcto0iQndBHl1gc=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1320", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187656" Pubnub::Grant.any_instance.stub(:signature).and_return "qIPS_skjlfCneenyoaM49hqUBfibhysVytvjg-Io9AE=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1321", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187656" Pubnub::Grant.any_instance.stub(:signature).and_return "qIPS_skjlfCneenyoaM49hqUBfibhysVytvjg-Io9AE=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1331", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187657" Pubnub::Grant.any_instance.stub(:signature).and_return "9FwiiXh2hqAqCckezIRYMpF4HTWxXTqvWPym6g3-TMU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1329", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187657" Pubnub::Grant.any_instance.stub(:signature).and_return "9FwiiXh2hqAqCckezIRYMpF4HTWxXTqvWPym6g3-TMU=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1330", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187658" Pubnub::Grant.any_instance.stub(:signature).and_return "wswP6-Z2k6R1qBCZwh8LFhGIiIUN-fsnfUm9kdlSkPc=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1328", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187658" Pubnub::Grant.any_instance.stub(:signature).and_return "wswP6-Z2k6R1qBCZwh8LFhGIiIUN-fsnfUm9kdlSkPc=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1326", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187659" Pubnub::Grant.any_instance.stub(:signature).and_return "s-lNiniPUGq79-yfgAMJy9i2oCwWWFXRDLTrKt-xJ4s=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1327", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187659" Pubnub::Grant.any_instance.stub(:signature).and_return "s-lNiniPUGq79-yfgAMJy9i2oCwWWFXRDLTrKt-xJ4s=" envelope = @pubnub.grant(channel: :demo, write: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1337", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187660" Pubnub::Grant.any_instance.stub(:signature).and_return "W5aixKAptok7WOO5e9jH4E1yMYrkPr7124IJVmep9YQ=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1335", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187660" Pubnub::Grant.any_instance.stub(:signature).and_return "W5aixKAptok7WOO5e9jH4E1yMYrkPr7124IJVmep9YQ=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1336", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187661" Pubnub::Grant.any_instance.stub(:signature).and_return "g8cTttJ0w4Ka-IZFDawvPhYL6KWa4Q0WtWVVLkJ-tgc=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1334", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187661" Pubnub::Grant.any_instance.stub(:signature).and_return "g8cTttJ0w4Ka-IZFDawvPhYL6KWa4Q0WtWVVLkJ-tgc=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1332", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187662" Pubnub::Grant.any_instance.stub(:signature).and_return "8zq1eawnTD6pFRAPraX9XdV1hsiFGxzYY-ciVEejoQ4=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1333", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187663" Pubnub::Grant.any_instance.stub(:signature).and_return "Yy066sy6t5LbnBd8qZGo3S2pLQxx0-F1gAQn4__HsFU=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1343", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187663" Pubnub::Grant.any_instance.stub(:signature).and_return "9GkaV4KX5s40ahIO8QliCnp0hxKU80YUtqHVu62Humo=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1341", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187664" Pubnub::Grant.any_instance.stub(:signature).and_return "tGmVfFkB9xvDLPHYWBi7gydlmZPbZKKlEnkNi_IDvnc=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1342", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187664" Pubnub::Grant.any_instance.stub(:signature).and_return "tGmVfFkB9xvDLPHYWBi7gydlmZPbZKKlEnkNi_IDvnc=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1340", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187665" Pubnub::Grant.any_instance.stub(:signature).and_return "2Q1FXS7XkjHrqkIFawKQnjjTmwlT6-gAsCuTWMyKxoI=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1338", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187665" Pubnub::Grant.any_instance.stub(:signature).and_return "2Q1FXS7XkjHrqkIFawKQnjjTmwlT6-gAsCuTWMyKxoI=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1339", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187666" Pubnub::Grant.any_instance.stub(:signature).and_return "bcQvnO9vasJlpneQuBbFAWlcR8PdmiqlOiWW1QCr7tQ=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1349", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187666" Pubnub::Grant.any_instance.stub(:signature).and_return "7YG41QjIf_u1uoYymXhEpMpC6lieN_4jZ2_E1bIzcEE=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1347", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187667" Pubnub::Grant.any_instance.stub(:signature).and_return "8MevVvY0rTtIRycp6LON3vYXzt4LBrOqJboanGgW_mY=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1348", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187667" Pubnub::Grant.any_instance.stub(:signature).and_return "8MevVvY0rTtIRycp6LON3vYXzt4LBrOqJboanGgW_mY=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1346", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187668" Pubnub::Grant.any_instance.stub(:signature).and_return "OkcR-ssmTDXfIepVtNlucDlsdha6S1l_JAVJFBR3Gfc=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1344", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187669" Pubnub::Grant.any_instance.stub(:signature).and_return "Zj35qwvCaRE7PEN2WAvY59-kXJ8pyFWIejET7Tds2SY=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1345", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187669" Pubnub::Grant.any_instance.stub(:signature).and_return "Zj35qwvCaRE7PEN2WAvY59-kXJ8pyFWIejET7Tds2SY=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1355", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187670" Pubnub::Grant.any_instance.stub(:signature).and_return "47J5DJtTJ6t05f8JJY4dbgqiRJCKp48S4bGsjXFGyGI=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1353", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187670" Pubnub::Grant.any_instance.stub(:signature).and_return "47J5DJtTJ6t05f8JJY4dbgqiRJCKp48S4bGsjXFGyGI=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1354", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187671" Pubnub::Grant.any_instance.stub(:signature).and_return "b2ys5nkzLRp1oOZ0nQvmJBqoaQ3xhJUz7aFDj630omU=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1352", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187671" Pubnub::Grant.any_instance.stub(:signature).and_return "b2ys5nkzLRp1oOZ0nQvmJBqoaQ3xhJUz7aFDj630omU=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1350", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187672" Pubnub::Grant.any_instance.stub(:signature).and_return "PbCRJKknRLIOOM944f6gn8VKpWsIeWxKd3d1J8beoXo=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1351", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187672" Pubnub::Grant.any_instance.stub(:signature).and_return "PbCRJKknRLIOOM944f6gn8VKpWsIeWxKd3d1J8beoXo=" envelope = @pubnub.grant(channel: :demo, write: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1361", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187673" Pubnub::Grant.any_instance.stub(:signature).and_return "j6UnXaWM2fL4tUUA_V4_BrJ2WjE3BoVyYq3pHT2FeqQ=" envelope = @pubnub.grant(channel: :demo, write: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1359", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187673" Pubnub::Grant.any_instance.stub(:signature).and_return "j6UnXaWM2fL4tUUA_V4_BrJ2WjE3BoVyYq3pHT2FeqQ=" envelope = @pubnub.grant(channel: :demo, write: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1360", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187674" Pubnub::Grant.any_instance.stub(:signature).and_return "qPfsv2cPbv1cHIVM8FJskgeoiBQMq9FRiRRdq5gnRcM=" envelope = @pubnub.grant(channel: :demo, write: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1358", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187674" Pubnub::Grant.any_instance.stub(:signature).and_return "qPfsv2cPbv1cHIVM8FJskgeoiBQMq9FRiRRdq5gnRcM=" envelope = @pubnub.grant(channel: :demo, write: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1356", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187675" Pubnub::Grant.any_instance.stub(:signature).and_return "NBINlzmAttY5ZepZHjHIOAZqi-ucSnvAt55H1csp86A=" envelope = @pubnub.grant(channel: :demo, write: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1357", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187675" Pubnub::Grant.any_instance.stub(:signature).and_return "NBINlzmAttY5ZepZHjHIOAZqi-ucSnvAt55H1csp86A=" envelope = @pubnub.grant(channel: :demo, write: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1367", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187676" Pubnub::Grant.any_instance.stub(:signature).and_return "7qeFsNnvoba_1NUHQo10LX9HgGUUg5YHIhCUvfleUMA=" envelope = @pubnub.grant(channel: :demo, write: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1365", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187676" Pubnub::Grant.any_instance.stub(:signature).and_return "7qeFsNnvoba_1NUHQo10LX9HgGUUg5YHIhCUvfleUMA=" envelope = @pubnub.grant(channel: :demo, write: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1366", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187677" Pubnub::Grant.any_instance.stub(:signature).and_return "oiy_dJDKmo0JRfKsQFe9peRq6vuG-Kl3KMsOzrWQBYI=" envelope = @pubnub.grant(channel: :demo, write: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1364", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187678" Pubnub::Grant.any_instance.stub(:signature).and_return "pzPKI-w0ian1f0sVwmea5hM0KklTrFxlr8GO_sqQTtE=" envelope = @pubnub.grant(channel: :demo, write: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1362", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187678" Pubnub::Grant.any_instance.stub(:signature).and_return "pzPKI-w0ian1f0sVwmea5hM0KklTrFxlr8GO_sqQTtE=" envelope = @pubnub.grant(channel: :demo, write: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1363", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187679" Pubnub::Grant.any_instance.stub(:signature).and_return "ElV03tWVWCAKoTQWW3L8bKTnTHZd5Q5UBzW30j7ObKw=" envelope = @pubnub.grant(channel: :demo, write: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1481", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187679" Pubnub::Grant.any_instance.stub(:signature).and_return "e2NeG5xxJJuKloSZO5T9wiSxlwjDYkUif4zzZK1CZQk=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1479", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187680" Pubnub::Grant.any_instance.stub(:signature).and_return "V7ggKVu8GYEFOiU1FY92LYKEhKiDPqi7BvV-Q0j-IDs=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1480", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187680" Pubnub::Grant.any_instance.stub(:signature).and_return "V7ggKVu8GYEFOiU1FY92LYKEhKiDPqi7BvV-Q0j-IDs=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1478", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187681" Pubnub::Grant.any_instance.stub(:signature).and_return "VlOaRGlDGFC0yD0rggoV6CwiykBJ90Z76_3NzNnoU_s=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1476", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187681" Pubnub::Grant.any_instance.stub(:signature).and_return "VlOaRGlDGFC0yD0rggoV6CwiykBJ90Z76_3NzNnoU_s=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1477", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187682" Pubnub::Grant.any_instance.stub(:signature).and_return "T0Sa30OykG5hvl6YTUXdWO-wxF7ShHnl5sBi3O8g_BI=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1487", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187682" Pubnub::Grant.any_instance.stub(:signature).and_return "jekOH7MddJ489rOdWyOAc9bRJK2Jc_8bg17TYwJ4dao=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1485", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187683" Pubnub::Grant.any_instance.stub(:signature).and_return "xR17TRi-kJ3efnbdaJVi0rVnfESzrrekXZgHGu6ajgE=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1486", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187683" Pubnub::Grant.any_instance.stub(:signature).and_return "xR17TRi-kJ3efnbdaJVi0rVnfESzrrekXZgHGu6ajgE=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1484", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187684" Pubnub::Grant.any_instance.stub(:signature).and_return "WPzC3Cxm-UAcGbaVkef3GNWJf-u1Vqd72FnnGLMGpEo=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1482", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187684" Pubnub::Grant.any_instance.stub(:signature).and_return "WPzC3Cxm-UAcGbaVkef3GNWJf-u1Vqd72FnnGLMGpEo=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1483", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187685" Pubnub::Grant.any_instance.stub(:signature).and_return "cg0nEKaf8GUdOUpsVNw7w7V3nLVOn-o_yurKOeRWdVk=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1493", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187685" Pubnub::Grant.any_instance.stub(:signature).and_return "rw0Gf0WFk3h68Mi7eluY8aBwv2x74m8wu0LyjpyzVD4=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1491", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187686" Pubnub::Grant.any_instance.stub(:signature).and_return "VKM9qDgFwZKU4avvWJr8B1u-VGMrE5Iovu-rYICBncc=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1492", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187687" Pubnub::Grant.any_instance.stub(:signature).and_return "qCesueu4NkB3_2yT0A87W18JetKzYi6GFHRS0CjTUOQ=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1490", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187687" Pubnub::Grant.any_instance.stub(:signature).and_return "qCesueu4NkB3_2yT0A87W18JetKzYi6GFHRS0CjTUOQ=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1488", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187688" Pubnub::Grant.any_instance.stub(:signature).and_return "c4SCaD2JphFTmnWzNVzMZ8Qb0peH2-My-bQKTZiUrJI=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1489", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187688" Pubnub::Grant.any_instance.stub(:signature).and_return "c4SCaD2JphFTmnWzNVzMZ8Qb0peH2-My-bQKTZiUrJI=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1499", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187689" Pubnub::Grant.any_instance.stub(:signature).and_return "afoEoxPaxuV7tdqv1B3Baibl0VFzL-xPfOaimx7dxbs=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1497", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187689" Pubnub::Grant.any_instance.stub(:signature).and_return "afoEoxPaxuV7tdqv1B3Baibl0VFzL-xPfOaimx7dxbs=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1498", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187690" Pubnub::Grant.any_instance.stub(:signature).and_return "8EbqGx95orTLu-UvHpiitLrB3iWDlG9U1nJM9u1zz40=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1496", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187690" Pubnub::Grant.any_instance.stub(:signature).and_return "8EbqGx95orTLu-UvHpiitLrB3iWDlG9U1nJM9u1zz40=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1494", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187691" Pubnub::Grant.any_instance.stub(:signature).and_return "bFkZVhwsqFKxvsEIF_JTithCLgxXoZ0LQ0l9FWX3kBo=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1495", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187691" Pubnub::Grant.any_instance.stub(:signature).and_return "bFkZVhwsqFKxvsEIF_JTithCLgxXoZ0LQ0l9FWX3kBo=" envelope = @pubnub.grant(channel: :demo, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1505", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187692" Pubnub::Grant.any_instance.stub(:signature).and_return "KY2s9IbRN4phCmCUbAwSmYfoP4vLGO5p1ThCEV2h5zQ=" envelope = @pubnub.grant(channel: :demo, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1503", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187692" Pubnub::Grant.any_instance.stub(:signature).and_return "KY2s9IbRN4phCmCUbAwSmYfoP4vLGO5p1ThCEV2h5zQ=" envelope = @pubnub.grant(channel: :demo, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1504", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187693" Pubnub::Grant.any_instance.stub(:signature).and_return "jPSEvo6heulKPrswRBTwkMnn5pG8srHvn-XN5O9AYgA=" envelope = @pubnub.grant(channel: :demo, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1502", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187693" Pubnub::Grant.any_instance.stub(:signature).and_return "jPSEvo6heulKPrswRBTwkMnn5pG8srHvn-XN5O9AYgA=" envelope = @pubnub.grant(channel: :demo, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1500", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187694" Pubnub::Grant.any_instance.stub(:signature).and_return "Nlf2Gid8ev0sfjCxlVsLKR0UrhYap4tQeYCUgDJKx_c=" envelope = @pubnub.grant(channel: :demo, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1501", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187695" Pubnub::Grant.any_instance.stub(:signature).and_return "cafy2s_4L3TwvuQoWb6bSezT8gE93ayL0GpUxAbqIbQ=" envelope = @pubnub.grant(channel: :demo, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1511", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187695" Pubnub::Grant.any_instance.stub(:signature).and_return "LIoOWlZarNqocxgyncE05q1rp-dGPOz5RfaPVefZrdI=" envelope = @pubnub.grant(channel: :demo, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1509", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187696" Pubnub::Grant.any_instance.stub(:signature).and_return "DpQ2Wc7Lwf9fT-62qDWE4JZXxaaYZOQnnMkoW_DDs-U=" envelope = @pubnub.grant(channel: :demo, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1510", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187696" Pubnub::Grant.any_instance.stub(:signature).and_return "DpQ2Wc7Lwf9fT-62qDWE4JZXxaaYZOQnnMkoW_DDs-U=" envelope = @pubnub.grant(channel: :demo, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1508", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187697" Pubnub::Grant.any_instance.stub(:signature).and_return "STcRF64N0gsQnf_Ty8FBz-PdGMF78HwIlL3-bQVnNtY=" envelope = @pubnub.grant(channel: :demo, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1506", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187697" Pubnub::Grant.any_instance.stub(:signature).and_return "STcRF64N0gsQnf_Ty8FBz-PdGMF78HwIlL3-bQVnNtY=" envelope = @pubnub.grant(channel: :demo, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1507", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187698" Pubnub::Grant.any_instance.stub(:signature).and_return "Y5uIWjI42nR7IIBtGVoXhKTyYcF08FKnUY2zfP3glEM=" envelope = @pubnub.grant(channel: :demo, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1409", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187699" Pubnub::Grant.any_instance.stub(:signature).and_return "25PdeLLKkYs3LDsws798BkYNtLqKCIYCLPHEVtcPPwk=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1407", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187699" Pubnub::Grant.any_instance.stub(:signature).and_return "25PdeLLKkYs3LDsws798BkYNtLqKCIYCLPHEVtcPPwk=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1408", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187700" Pubnub::Grant.any_instance.stub(:signature).and_return "syawsbfWoh47O1D4nnW63CgtBXr7u7HTBjTPB2X653M=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1406", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187700" Pubnub::Grant.any_instance.stub(:signature).and_return "syawsbfWoh47O1D4nnW63CgtBXr7u7HTBjTPB2X653M=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1404", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187701" Pubnub::Grant.any_instance.stub(:signature).and_return "421r09Jhn00833gSJuD_Zjx0MSpROGUrP3GrrclSRGY=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1405", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187702" Pubnub::Grant.any_instance.stub(:signature).and_return "5gAqaPje1ncQXeRQVgcPz4ivMj-tcBPE2rQTVPv3vVM=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1415", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187702" Pubnub::Grant.any_instance.stub(:signature).and_return "JNBQatMArpXBH2X9Sf2MeB8RRcXyJznGu9aHGgtiP54=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1413", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187703" Pubnub::Grant.any_instance.stub(:signature).and_return "JCudVPJbJhnQvaLzcSjQBwhOlOg_RnVTpN2JKctP34s=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1414", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187703" Pubnub::Grant.any_instance.stub(:signature).and_return "JCudVPJbJhnQvaLzcSjQBwhOlOg_RnVTpN2JKctP34s=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1412", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187704" Pubnub::Grant.any_instance.stub(:signature).and_return "yHx3130b3Oq905Lb61odxGsBgSPTAXLLS30FTcipixk=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1410", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187704" Pubnub::Grant.any_instance.stub(:signature).and_return "yHx3130b3Oq905Lb61odxGsBgSPTAXLLS30FTcipixk=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1411", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187705" Pubnub::Grant.any_instance.stub(:signature).and_return "u8d4vOo0rrKfff1dGPutPShbHO9lE1DoIp3BtMGTViE=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1421", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187705" Pubnub::Grant.any_instance.stub(:signature).and_return "Zl47M83P2crXZUcXvIul1amlukkOZheXSw5A5aECUms=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1419", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187706" Pubnub::Grant.any_instance.stub(:signature).and_return "sQpxhGK17YREAUroh7p3Gkw1NOg1UwsVowaM8pSl3cM=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1420", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187707" Pubnub::Grant.any_instance.stub(:signature).and_return "1dvu6PZx2pyxFCjNjz_fQFQpP87RLXTTsfgz_8w51kI=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1418", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187708" Pubnub::Grant.any_instance.stub(:signature).and_return "SyeldId4fwHJKJySLDBqCu2XVJQDWuIiAg0iq8i_ar4=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1416", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187708" Pubnub::Grant.any_instance.stub(:signature).and_return "SyeldId4fwHJKJySLDBqCu2XVJQDWuIiAg0iq8i_ar4=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1417", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187709" Pubnub::Grant.any_instance.stub(:signature).and_return "P-YGgzr4kMy4fwPUT804Cgl1naNXz11PpeiOzziMN6w=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1427", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187709" Pubnub::Grant.any_instance.stub(:signature).and_return "Q89h7_zjWe_ZLRK6z_qUX_F5xWA-DZPzSbRf5OcMpaw=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1425", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187710" Pubnub::Grant.any_instance.stub(:signature).and_return "Rw3D5oKLKwpyUqPlh_bZBliZ8scHeFxsY14ZI_QgwPA=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1426", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187710" Pubnub::Grant.any_instance.stub(:signature).and_return "Rw3D5oKLKwpyUqPlh_bZBliZ8scHeFxsY14ZI_QgwPA=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1424", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187711" Pubnub::Grant.any_instance.stub(:signature).and_return "V8PpuKOA751tGphU13VscrxxCRJ5dh8yjpgvgvj1T8I=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1422", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187712" Pubnub::Grant.any_instance.stub(:signature).and_return "8u4V7FzdkraeUv2hv4xBkp2nFySgmuiAw3gKvKO0TJQ=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1423", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187713" Pubnub::Grant.any_instance.stub(:signature).and_return "5OC8QIifWTlfnkd8gRUY7nj4wsCp3u3W0R-wZnlVvAQ=" envelope = @pubnub.grant(channel: :demo, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1433", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187713" Pubnub::Grant.any_instance.stub(:signature).and_return "56ud8d7TBcwVT6TvFPxzudNSOEj4FKzcfBLUzZaVrPk=" envelope = @pubnub.grant(channel: :demo, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1431", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187714" Pubnub::Grant.any_instance.stub(:signature).and_return "eqt6tz1W1-AH5fSVP_gaeoVwqRyCJEKz-8jZ75Di4wA=" envelope = @pubnub.grant(channel: :demo, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1432", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187715" Pubnub::Grant.any_instance.stub(:signature).and_return "RmHRWlP7n7haOijK7swl_x4URK4bt8V0Dz8tG-winmc=" envelope = @pubnub.grant(channel: :demo, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1430", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187715" Pubnub::Grant.any_instance.stub(:signature).and_return "RmHRWlP7n7haOijK7swl_x4URK4bt8V0Dz8tG-winmc=" envelope = @pubnub.grant(channel: :demo, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1428", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187716" Pubnub::Grant.any_instance.stub(:signature).and_return "8M21mCC6iPnxCHsFdpkc9fxc55eY8DhF6mLQIRgZS5A=" envelope = @pubnub.grant(channel: :demo, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1429", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187716" Pubnub::Grant.any_instance.stub(:signature).and_return "8M21mCC6iPnxCHsFdpkc9fxc55eY8DhF6mLQIRgZS5A=" envelope = @pubnub.grant(channel: :demo, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1439", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187717" Pubnub::Grant.any_instance.stub(:signature).and_return "vewT-vnItB92tQPF62Q9l_KWVtH1X4nbUa22WfxMbeM=" envelope = @pubnub.grant(channel: :demo, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1437", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187718" Pubnub::Grant.any_instance.stub(:signature).and_return "2pR-73AIEAcGeJbZUbnO5IjVbK-B_GZypT13PB7MhBQ=" envelope = @pubnub.grant(channel: :demo, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1438", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187719" Pubnub::Grant.any_instance.stub(:signature).and_return "yrK0irjpRA_W30S1UtzipnhLwVgRlkUaKH41R--QYcU=" envelope = @pubnub.grant(channel: :demo, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1436", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187719" Pubnub::Grant.any_instance.stub(:signature).and_return "yrK0irjpRA_W30S1UtzipnhLwVgRlkUaKH41R--QYcU=" envelope = @pubnub.grant(channel: :demo, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1434", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187720" Pubnub::Grant.any_instance.stub(:signature).and_return "4ciVOqjQaqMyaZ3ZwJ6Y_Qu9kyjySC5N85LeWZEDM14=" envelope = @pubnub.grant(channel: :demo, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1435", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187721" Pubnub::Grant.any_instance.stub(:signature).and_return "bsrTwAvEqwY8YcSsf7cZddtG3cxeFUhRbwaUQ4OAT7M=" envelope = @pubnub.grant(channel: :demo, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1445", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187721" Pubnub::Grant.any_instance.stub(:signature).and_return "zMfGowWa3hwMtEsu9wtTxN1D-BSWwCZUCcDic1FqHdM=" envelope = @pubnub.grant(channel: :demo, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1443", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187722" Pubnub::Grant.any_instance.stub(:signature).and_return "JvLNOmxddoCW23jh8BdiRDA6s-GYr1g2YTKLBUDepSA=" envelope = @pubnub.grant(channel: :demo, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1444", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187722" Pubnub::Grant.any_instance.stub(:signature).and_return "JvLNOmxddoCW23jh8BdiRDA6s-GYr1g2YTKLBUDepSA=" envelope = @pubnub.grant(channel: :demo, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1442", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187723" Pubnub::Grant.any_instance.stub(:signature).and_return "aO_RnBAr0lN-VJBj_EbIkVqbx1SvHooLjTz4DKJnc9c=" envelope = @pubnub.grant(channel: :demo, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1440", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187724" Pubnub::Grant.any_instance.stub(:signature).and_return "T3K82hQYZJAztXUJpD73H_6oqmq_0Jl3M1uqdMePxog=" envelope = @pubnub.grant(channel: :demo, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1441", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187725" Pubnub::Grant.any_instance.stub(:signature).and_return "YKNjDifCbv7FBUsiNabU92qjzmRWBHREZiNBapda58E=" envelope = @pubnub.grant(channel: :demo, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1451", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187726" Pubnub::Grant.any_instance.stub(:signature).and_return "E6qk8JICNXtUAPQOmdHuLOIygGtHwXCZYbeGpwB1Nfw=" envelope = @pubnub.grant(channel: :demo, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1449", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187726" Pubnub::Grant.any_instance.stub(:signature).and_return "E6qk8JICNXtUAPQOmdHuLOIygGtHwXCZYbeGpwB1Nfw=" envelope = @pubnub.grant(channel: :demo, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1450", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187727" Pubnub::Grant.any_instance.stub(:signature).and_return "ZbAH6t-p8xmhJ7QZtZ8nJBN1M5m09fweZJ2qYugpxqQ=" envelope = @pubnub.grant(channel: :demo, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1448", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187728" Pubnub::Grant.any_instance.stub(:signature).and_return "FKKz4qUUNo1G1Ffl2JKmZJxKsVxvhCL5a3-ryk8iLAQ=" envelope = @pubnub.grant(channel: :demo, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1446", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187728" Pubnub::Grant.any_instance.stub(:signature).and_return "FKKz4qUUNo1G1Ffl2JKmZJxKsVxvhCL5a3-ryk8iLAQ=" envelope = @pubnub.grant(channel: :demo, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1447", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187729" Pubnub::Grant.any_instance.stub(:signature).and_return "xAf0tq7Sv-rhTa1YQRmXMs4xkFMx0fEEQeSC8b4onCs=" envelope = @pubnub.grant(channel: :demo, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1457", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187730" Pubnub::Grant.any_instance.stub(:signature).and_return "wsLr60aaRkUp5or3QMuo-cvCAXmc00pkIDM53UmsLYQ=" envelope = @pubnub.grant(channel: :demo, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1455", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187730" Pubnub::Grant.any_instance.stub(:signature).and_return "wsLr60aaRkUp5or3QMuo-cvCAXmc00pkIDM53UmsLYQ=" envelope = @pubnub.grant(channel: :demo, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1456", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187731" Pubnub::Grant.any_instance.stub(:signature).and_return "OI79oMtDcVXtCkb1a_RAC7gJz_oehhsmtkDLz8mkz9c=" envelope = @pubnub.grant(channel: :demo, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1454", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187731" Pubnub::Grant.any_instance.stub(:signature).and_return "OI79oMtDcVXtCkb1a_RAC7gJz_oehhsmtkDLz8mkz9c=" envelope = @pubnub.grant(channel: :demo, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1452", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187734" Pubnub::Grant.any_instance.stub(:signature).and_return "qT2SzCNNhDpT9CqaPGFyxwVbgJ_Fftdsoh1bovyWvnc=" envelope = @pubnub.grant(channel: :demo, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1453", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187734" Pubnub::Grant.any_instance.stub(:signature).and_return "qT2SzCNNhDpT9CqaPGFyxwVbgJ_Fftdsoh1bovyWvnc=" envelope = @pubnub.grant(channel: :demo, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1463", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187735" Pubnub::Grant.any_instance.stub(:signature).and_return "Ix0W5ZTBEBAMiuhQX0nCOoTEtHjoEVjZWBnu1UgiHag=" envelope = @pubnub.grant(channel: :demo, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1461", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187736" Pubnub::Grant.any_instance.stub(:signature).and_return "MDvStQ4DPJO4wGb_eri9E-VAi3OHTz_Irg4swnAlK1U=" envelope = @pubnub.grant(channel: :demo, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1462", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187737" Pubnub::Grant.any_instance.stub(:signature).and_return "vgPi_AaznelGhBu1iTI6rL9GIIWEtml4t3BAXlT2eJQ=" envelope = @pubnub.grant(channel: :demo, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1460", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187737" Pubnub::Grant.any_instance.stub(:signature).and_return "vgPi_AaznelGhBu1iTI6rL9GIIWEtml4t3BAXlT2eJQ=" envelope = @pubnub.grant(channel: :demo, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1458", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187738" Pubnub::Grant.any_instance.stub(:signature).and_return "PtF-ECytO1_mLVVAIoQVvCpYlZ-tiE-YpTUyzrEaaBs=" envelope = @pubnub.grant(channel: :demo, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1459", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187739" Pubnub::Grant.any_instance.stub(:signature).and_return "Y08V71IJWLY4PxZkGshxoUzkNx4a7t2NQsL8ttWUzQM=" envelope = @pubnub.grant(channel: :demo, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1469", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187739" Pubnub::Grant.any_instance.stub(:signature).and_return "_2-G_kem5siZRt_-qKECjuN92yV9v3vjIgQi4h2aqM4=" envelope = @pubnub.grant(channel: :demo, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1467", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187740" Pubnub::Grant.any_instance.stub(:signature).and_return "wW5tvOuumRz9YIdR_-nq0tKBodJfn38IhUlL8ehxaI0=" envelope = @pubnub.grant(channel: :demo, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1468", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187741" Pubnub::Grant.any_instance.stub(:signature).and_return "gL3ahsyuSVUTYZg3Q3UYBqVPaWNNismLxgjDq_Wapk0=" envelope = @pubnub.grant(channel: :demo, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1466", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187742" Pubnub::Grant.any_instance.stub(:signature).and_return "Tazry0uswZI3a01javE1gNcyTFaEx9ibZ3GPooXZpGo=" envelope = @pubnub.grant(channel: :demo, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1464", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187742" Pubnub::Grant.any_instance.stub(:signature).and_return "Tazry0uswZI3a01javE1gNcyTFaEx9ibZ3GPooXZpGo=" envelope = @pubnub.grant(channel: :demo, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1465", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187743" Pubnub::Grant.any_instance.stub(:signature).and_return "2wXopzUgknSNY3RAlmIXh3_kijRAEVvsYjgsMzQjNV0=" envelope = @pubnub.grant(channel: :demo, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1475", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187744" Pubnub::Grant.any_instance.stub(:signature).and_return "CUb_d2so9BaJogG9CbiNCWiNg2iw8q8OEpfyOA2_g3Y=" envelope = @pubnub.grant(channel: :demo, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/1473", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187745" Pubnub::Grant.any_instance.stub(:signature).and_return "G7okE7mEioChbPqI6bxk2bsyW7Wc2g1eT6czNs8AvOQ=" envelope = @pubnub.grant(channel: :demo, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/1474", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187745" Pubnub::Grant.any_instance.stub(:signature).and_return "G7okE7mEioChbPqI6bxk2bsyW7Wc2g1eT6czNs8AvOQ=" envelope = @pubnub.grant(channel: :demo, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/1472", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187746" Pubnub::Grant.any_instance.stub(:signature).and_return "yeq2yGItXq7Wkns3C1wvgY0vwK-GJDEpgHv0Vqbj888=" envelope = @pubnub.grant(channel: :demo, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/1470", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187746" Pubnub::Grant.any_instance.stub(:signature).and_return "yeq2yGItXq7Wkns3C1wvgY0vwK-GJDEpgHv0Vqbj888=" envelope = @pubnub.grant(channel: :demo, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1471", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187747" Pubnub::Grant.any_instance.stub(:signature).and_return "WKa7yQWh5CfBPGYbFChtmBH11cAFk6Aka3PGj91_bSw=" envelope = @pubnub.grant(channel: :demo, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/941", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187748" Pubnub::Grant.any_instance.stub(:signature).and_return "yzOjWXJyEpzJlGgaU3a_WibmpDTu3OfxivwVKKG8F5Q=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/939", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187748" Pubnub::Grant.any_instance.stub(:signature).and_return "yzOjWXJyEpzJlGgaU3a_WibmpDTu3OfxivwVKKG8F5Q=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/940", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187770" Pubnub::Grant.any_instance.stub(:signature).and_return "97kZQaoqlqw0k7wJW8VchSn-lrycmDD20qQsM00Eb38=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/938", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187770" Pubnub::Grant.any_instance.stub(:signature).and_return "97kZQaoqlqw0k7wJW8VchSn-lrycmDD20qQsM00Eb38=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/936", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187771" Pubnub::Grant.any_instance.stub(:signature).and_return "Zh47l2UlOL2hkl-Mvj33dywpocGN3_fRXakn2e7dSVU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/937", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187772" Pubnub::Grant.any_instance.stub(:signature).and_return "OibA7wkb_L5OkQmeDgIgyfbko1VYv8rmkXk3cnX7mI8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/947", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187772" Pubnub::Grant.any_instance.stub(:signature).and_return "jvCqF6MOqeDC0G3kkDjaU-leJY9dqnyNG-qqZtXBa_Y=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/945", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187773" Pubnub::Grant.any_instance.stub(:signature).and_return "DcqGsDYplLwyOeL1Vwc5CpRo9QMfnIzSfX8w21ez-tQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/946", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187773" Pubnub::Grant.any_instance.stub(:signature).and_return "DcqGsDYplLwyOeL1Vwc5CpRo9QMfnIzSfX8w21ez-tQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/944", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187774" Pubnub::Grant.any_instance.stub(:signature).and_return "lPqX-aPJ-DIZ9aMyW_rC0NN0dc2L-GaTeY6f34PofHA=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/942", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187774" Pubnub::Grant.any_instance.stub(:signature).and_return "lPqX-aPJ-DIZ9aMyW_rC0NN0dc2L-GaTeY6f34PofHA=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/943", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187775" Pubnub::Grant.any_instance.stub(:signature).and_return "GE5vVYPU14H42AwKVaqc1FBKvjB4IRZ9Z9-eUm-xjy4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/953", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187775" Pubnub::Grant.any_instance.stub(:signature).and_return "QzRgNFmY_kDErAlGEwjmL7qpYvij6eyu5AbkoTKE7YY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/951", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187776" Pubnub::Grant.any_instance.stub(:signature).and_return "AYaqbyzeuoW1MpaXmNYl21I26L8429b2NHxuaU0nO6g=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/952", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187776" Pubnub::Grant.any_instance.stub(:signature).and_return "AYaqbyzeuoW1MpaXmNYl21I26L8429b2NHxuaU0nO6g=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/950", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187777" Pubnub::Grant.any_instance.stub(:signature).and_return "Z8wptgDfzAZIlrNuOrOspjWhv_mlJjZLQQr-YlQMiw0=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/948", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187778" Pubnub::Grant.any_instance.stub(:signature).and_return "xSYuNrEO4BOuOXUigzvvAi7YnMDIHjUhJ1ZhNTjDGsM=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/949", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187778" Pubnub::Grant.any_instance.stub(:signature).and_return "xSYuNrEO4BOuOXUigzvvAi7YnMDIHjUhJ1ZhNTjDGsM=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/959", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187779" Pubnub::Grant.any_instance.stub(:signature).and_return "RBSBJGo8nKWDyI-wYdbLpN2Y92IqjRS1glVqu0h1HC4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/957", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187779" Pubnub::Grant.any_instance.stub(:signature).and_return "RBSBJGo8nKWDyI-wYdbLpN2Y92IqjRS1glVqu0h1HC4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/958", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187780" Pubnub::Grant.any_instance.stub(:signature).and_return "bCeS-sYCDGrWhq52az5IZ4FhTs1Fcuf6IGey064srOI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/956", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187780" Pubnub::Grant.any_instance.stub(:signature).and_return "bCeS-sYCDGrWhq52az5IZ4FhTs1Fcuf6IGey064srOI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/954", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187781" Pubnub::Grant.any_instance.stub(:signature).and_return "qm6VDsIFJLv8ipkOo1ahH0qmj5u-JEE4-yxGcFlEQyc=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/955", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187781" Pubnub::Grant.any_instance.stub(:signature).and_return "qm6VDsIFJLv8ipkOo1ahH0qmj5u-JEE4-yxGcFlEQyc=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/965", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187782" Pubnub::Grant.any_instance.stub(:signature).and_return "h2Bzsbmu6aV_zO575Hv4wQ5UArg6s0sEXKshyUAr9BI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/963", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187782" Pubnub::Grant.any_instance.stub(:signature).and_return "h2Bzsbmu6aV_zO575Hv4wQ5UArg6s0sEXKshyUAr9BI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/964", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187783" Pubnub::Grant.any_instance.stub(:signature).and_return "JbNQxVC62h4JB95vJdhHXlJwwjFUV6sd07zqzelDzoU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/962", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187784" Pubnub::Grant.any_instance.stub(:signature).and_return "oKE1rDgjFno2M9sg278dcDs_XYBa0k2t-EyR12vHe_k=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/960", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187784" Pubnub::Grant.any_instance.stub(:signature).and_return "oKE1rDgjFno2M9sg278dcDs_XYBa0k2t-EyR12vHe_k=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/961", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187785" Pubnub::Grant.any_instance.stub(:signature).and_return "igodZQtnIwXwv8EV5KeBT6AOLctqs3kgFwAIFPXnkkg=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/971", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187785" Pubnub::Grant.any_instance.stub(:signature).and_return "OoEnirbikoPW7S7YM1agV9nUO8U3u8W3__AhJFRzSZY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/969", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187786" Pubnub::Grant.any_instance.stub(:signature).and_return "PXssaFkil_GGSroRHlUdnSS80REF5ZE4fP6rpOJKMYg=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/970", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187786" Pubnub::Grant.any_instance.stub(:signature).and_return "PXssaFkil_GGSroRHlUdnSS80REF5ZE4fP6rpOJKMYg=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/968", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187787" Pubnub::Grant.any_instance.stub(:signature).and_return "0MUrHOj1rQ_FcD9t38_9deS3Cwyqz63NOttXC3015j8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/966", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187787" Pubnub::Grant.any_instance.stub(:signature).and_return "0MUrHOj1rQ_FcD9t38_9deS3Cwyqz63NOttXC3015j8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/967", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187788" Pubnub::Grant.any_instance.stub(:signature).and_return "8LA2E3VzPUruqtr50sLjIDDqjr_l2Y9oe9gU2m6ymkI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/869", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187788" Pubnub::Grant.any_instance.stub(:signature).and_return "za8J9vGZjOKjxqG_72eBVzQL60pqRzD6Nhx3H15KSZk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/867", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187789" Pubnub::Grant.any_instance.stub(:signature).and_return "DInnpYFokH_K3OagYssTdEGpSPABxNrZC7ZlTlYnvqU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/868", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187789" Pubnub::Grant.any_instance.stub(:signature).and_return "DInnpYFokH_K3OagYssTdEGpSPABxNrZC7ZlTlYnvqU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/866", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187790" Pubnub::Grant.any_instance.stub(:signature).and_return "lWlWcO-2XCiM81ve1F-LiSdcKQwEanUU0zITzGaCpOQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/864", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187790" Pubnub::Grant.any_instance.stub(:signature).and_return "lWlWcO-2XCiM81ve1F-LiSdcKQwEanUU0zITzGaCpOQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/865", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187791" Pubnub::Grant.any_instance.stub(:signature).and_return "xWjImDUXbOKd719UNXrluqXNTeCFxXlujPCtfrJH6ug=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/875", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187791" Pubnub::Grant.any_instance.stub(:signature).and_return "kwVHu17v98xCW3masKnVgxt-ez0_gIlmFDUvaV9wCgU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/873", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187792" Pubnub::Grant.any_instance.stub(:signature).and_return "rsTSiE0LV9O802rWbHAA7DKS3iz8bJ23cSiK4VBnNeM=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/874", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187793" Pubnub::Grant.any_instance.stub(:signature).and_return "pZyvquoHJLGfn8ZV3QeOQ6QoC8_T--9r6VsSLFOkrEY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/872", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187793" Pubnub::Grant.any_instance.stub(:signature).and_return "pZyvquoHJLGfn8ZV3QeOQ6QoC8_T--9r6VsSLFOkrEY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/870", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187794" Pubnub::Grant.any_instance.stub(:signature).and_return "-Vzrsl7KFeHSfGz_qpdfNzCS2yVzEbtdf3W7IjccDx8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/871", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187794" Pubnub::Grant.any_instance.stub(:signature).and_return "-Vzrsl7KFeHSfGz_qpdfNzCS2yVzEbtdf3W7IjccDx8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/881", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187795" Pubnub::Grant.any_instance.stub(:signature).and_return "K_P_Zts2JQ30nh1jADPhyKiP7x6uhP5G7mPMvGZ-jC0=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/879", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187795" Pubnub::Grant.any_instance.stub(:signature).and_return "K_P_Zts2JQ30nh1jADPhyKiP7x6uhP5G7mPMvGZ-jC0=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/880", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187796" Pubnub::Grant.any_instance.stub(:signature).and_return "2aRHq1nuLqT6Wh9Ir65486UzlZEX2bWMCpIKX5Ly3R8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/878", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187796" Pubnub::Grant.any_instance.stub(:signature).and_return "2aRHq1nuLqT6Wh9Ir65486UzlZEX2bWMCpIKX5Ly3R8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/876", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187797" Pubnub::Grant.any_instance.stub(:signature).and_return "nnyRjqhH_U89afJPfj0TjCVmX6hzWAWOrWiukWPlVsY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/877", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187797" Pubnub::Grant.any_instance.stub(:signature).and_return "nnyRjqhH_U89afJPfj0TjCVmX6hzWAWOrWiukWPlVsY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/887", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187798" Pubnub::Grant.any_instance.stub(:signature).and_return "eKPs_UyO96rLwO0uf8sgRl5HgE30741efHMpgdYyDr4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/885", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187798" Pubnub::Grant.any_instance.stub(:signature).and_return "eKPs_UyO96rLwO0uf8sgRl5HgE30741efHMpgdYyDr4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/886", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187799" Pubnub::Grant.any_instance.stub(:signature).and_return "vClwoe8YjkR5E8MnaTzBKGzmPnLnECS5CGCecWVuCEs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/884", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187799" Pubnub::Grant.any_instance.stub(:signature).and_return "vClwoe8YjkR5E8MnaTzBKGzmPnLnECS5CGCecWVuCEs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/882", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187800" Pubnub::Grant.any_instance.stub(:signature).and_return "BjT8tx630JhXr1bD-m1Uchfc_dqHXSq-6NeA3hKW-AU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/883", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187800" Pubnub::Grant.any_instance.stub(:signature).and_return "BjT8tx630JhXr1bD-m1Uchfc_dqHXSq-6NeA3hKW-AU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/893", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187801" Pubnub::Grant.any_instance.stub(:signature).and_return "joUrCDfzEEl3VgZKAym5ArB1nbS3jcvQWSrDVC5TVLU=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/891", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187802" Pubnub::Grant.any_instance.stub(:signature).and_return "CtXBgZo7n-eSUf2E7FyKpSJ0MOru7KU5AXXSDXgnlb8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/892", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187802" Pubnub::Grant.any_instance.stub(:signature).and_return "CtXBgZo7n-eSUf2E7FyKpSJ0MOru7KU5AXXSDXgnlb8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/890", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187803" Pubnub::Grant.any_instance.stub(:signature).and_return "cRzoWCZ_044v8RUGg4Q4pqKIujIOCFKY5jAcLFHYN_k=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/888", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187803" Pubnub::Grant.any_instance.stub(:signature).and_return "cRzoWCZ_044v8RUGg4Q4pqKIujIOCFKY5jAcLFHYN_k=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/889", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187804" Pubnub::Grant.any_instance.stub(:signature).and_return "cLP9PrUyYFvSE_HqbOtgukXHTTM1IKKKG2Q0Jc4X8cE=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/899", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187804" Pubnub::Grant.any_instance.stub(:signature).and_return "lpQzROKR6nWQwHuOlxojCkVn9vkFmMvLtpd6aplYRhs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/897", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187805" Pubnub::Grant.any_instance.stub(:signature).and_return "pDOtOTnRxTsCrXXW1OUZYQM9kCMl1EyJEvNy7lCT4oc=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/898", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187805" Pubnub::Grant.any_instance.stub(:signature).and_return "pDOtOTnRxTsCrXXW1OUZYQM9kCMl1EyJEvNy7lCT4oc=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/896", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187806" Pubnub::Grant.any_instance.stub(:signature).and_return "zy0G7DdxziJ1GqXFY1BZZv7Vs_v-jNryOqJsdiBQApk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/894", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187806" Pubnub::Grant.any_instance.stub(:signature).and_return "zy0G7DdxziJ1GqXFY1BZZv7Vs_v-jNryOqJsdiBQApk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/895", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187807" Pubnub::Grant.any_instance.stub(:signature).and_return "d5IJIamew71tuEFYZTotjqY4XeOfCmKdbD3Ky3cuqM4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/905", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187808" Pubnub::Grant.any_instance.stub(:signature).and_return "hEZNRh3wJtrykpfYYI7KT9sP9mi1yQu0gMSzFva9jiw=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/903", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187808" Pubnub::Grant.any_instance.stub(:signature).and_return "hEZNRh3wJtrykpfYYI7KT9sP9mi1yQu0gMSzFva9jiw=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/904", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187809" Pubnub::Grant.any_instance.stub(:signature).and_return "XS7yeDT-7qlLEcIIRNZsdDHcvTDHLW77KGNhH47Hw1U=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/902", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187809" Pubnub::Grant.any_instance.stub(:signature).and_return "XS7yeDT-7qlLEcIIRNZsdDHcvTDHLW77KGNhH47Hw1U=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/900", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187810" Pubnub::Grant.any_instance.stub(:signature).and_return "Gu4PbM_91Ba3atwdrpPkxksWjEYJCgtWyxE3W2jSsGk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/901", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187810" Pubnub::Grant.any_instance.stub(:signature).and_return "Gu4PbM_91Ba3atwdrpPkxksWjEYJCgtWyxE3W2jSsGk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/911", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187811" Pubnub::Grant.any_instance.stub(:signature).and_return "Kd8GePaIAfs8vBw_PdXS4fBIt5knPhtD5r7Q61KLBnY=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/909", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187812" Pubnub::Grant.any_instance.stub(:signature).and_return "_WN1wDxG8bvh9mboKmKw0SQc2nulwwf6EXVLhLZvcuA=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/910", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187812" Pubnub::Grant.any_instance.stub(:signature).and_return "_WN1wDxG8bvh9mboKmKw0SQc2nulwwf6EXVLhLZvcuA=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/908", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187813" Pubnub::Grant.any_instance.stub(:signature).and_return "-ekizJrDFOTKov_wrI8036R7Rx0I_xwMdIpTyW5ZrlE=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/906", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187813" Pubnub::Grant.any_instance.stub(:signature).and_return "-ekizJrDFOTKov_wrI8036R7Rx0I_xwMdIpTyW5ZrlE=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/907", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187814" Pubnub::Grant.any_instance.stub(:signature).and_return "nHGm2aNCK8xP2kbJgEjBgOKOUoxbgxxoueu5qzmYnCs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/917", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187814" Pubnub::Grant.any_instance.stub(:signature).and_return "U-39FdK1gPNxCxfKn1pnSFQ_mAdx5LHauGl-SIfrSmg=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/915", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187815" Pubnub::Grant.any_instance.stub(:signature).and_return "AdNLyoLi_j-9HYJn55IXyAf-h5ZWzzqHIUVRJOKCkgQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/916", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187815" Pubnub::Grant.any_instance.stub(:signature).and_return "AdNLyoLi_j-9HYJn55IXyAf-h5ZWzzqHIUVRJOKCkgQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/914", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187816" Pubnub::Grant.any_instance.stub(:signature).and_return "OpSIT9kHJCJAS1_49KPqkh8GdOMi4Dp9paF-oR8L8x8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/912", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187816" Pubnub::Grant.any_instance.stub(:signature).and_return "OpSIT9kHJCJAS1_49KPqkh8GdOMi4Dp9paF-oR8L8x8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/913", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187817" Pubnub::Grant.any_instance.stub(:signature).and_return "MB-a-1GGzGkeOPEsSHntoFhiYVYDCHIsNziJCmRcGcs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/923", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187818" Pubnub::Grant.any_instance.stub(:signature).and_return "V3ZDnVrL0F9r38kd6E7KRCmyAnJzZ6tJ85JSXO5uuMI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/921", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187818" Pubnub::Grant.any_instance.stub(:signature).and_return "V3ZDnVrL0F9r38kd6E7KRCmyAnJzZ6tJ85JSXO5uuMI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/922", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187819" Pubnub::Grant.any_instance.stub(:signature).and_return "KgJNevW2nNiO8Z2P-4mQIdfVt_v7XkZU-5W8Un506Tk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/920", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187819" Pubnub::Grant.any_instance.stub(:signature).and_return "KgJNevW2nNiO8Z2P-4mQIdfVt_v7XkZU-5W8Un506Tk=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/918", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187820" Pubnub::Grant.any_instance.stub(:signature).and_return "uzwWT97KnIkO_tRB9ztwMPhYE_l6RpyfzeGHfoZ_XOg=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/919", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187820" Pubnub::Grant.any_instance.stub(:signature).and_return "uzwWT97KnIkO_tRB9ztwMPhYE_l6RpyfzeGHfoZ_XOg=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/929", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187821" Pubnub::Grant.any_instance.stub(:signature).and_return "Hb_tO9xe0ZD4EtfvJjU1gxvzdbcJuS8aVDxCvR8dmD8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/927", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187822" Pubnub::Grant.any_instance.stub(:signature).and_return "DallhQcc4urR1gw1dspIE6idrV6NHgsv5Muynh0YvjE=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/928", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187822" Pubnub::Grant.any_instance.stub(:signature).and_return "DallhQcc4urR1gw1dspIE6idrV6NHgsv5Muynh0YvjE=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/926", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187823" Pubnub::Grant.any_instance.stub(:signature).and_return "sSCgj03BK1w_MSeVT-Kpdx2yefciF2P7ObvDoweQ33I=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/924", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187823" Pubnub::Grant.any_instance.stub(:signature).and_return "sSCgj03BK1w_MSeVT-Kpdx2yefciF2P7ObvDoweQ33I=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/925", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187824" Pubnub::Grant.any_instance.stub(:signature).and_return "5zV57cPKSVvIHTTvwSMSMMHE7xrJkuyBcotjJKKzvOQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/935", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187824" Pubnub::Grant.any_instance.stub(:signature).and_return "xGM_cKKghJbiBhQ_XwL_j96OQf6Kd54aCZzEWSCdgmI=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/933", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187825" Pubnub::Grant.any_instance.stub(:signature).and_return "ZquchteXJ4Q2YsDPaHQmNKnQsn9ENkZMgdl0oC7qLP4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/934", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187825" Pubnub::Grant.any_instance.stub(:signature).and_return "ZquchteXJ4Q2YsDPaHQmNKnQsn9ENkZMgdl0oC7qLP4=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/932", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187826" Pubnub::Grant.any_instance.stub(:signature).and_return "szxj0ec7M_4kEpXhpllILTPR4AvtM2fRIYqCxqgY6rs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/930", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187826" Pubnub::Grant.any_instance.stub(:signature).and_return "szxj0ec7M_4kEpXhpllILTPR4AvtM2fRIYqCxqgY6rs=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/931", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187827" Pubnub::Grant.any_instance.stub(:signature).and_return "ZCg-duEnP0uh-1jn13k1sjzPMvhCi0TyjFi8JCXPJY8=" envelope = @pubnub.grant(channel: "demo", read: true, write: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/725", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187827" Pubnub::Grant.any_instance.stub(:signature).and_return "unJskEA3hAXh88crUQXkOiHN0NySGPqkHzYbzyMh-Sw=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/723", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187828" Pubnub::Grant.any_instance.stub(:signature).and_return "HLaBxnS7wZztEvvnvfbi-hJONX-tGCf38vNmnelGrjU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/724", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187828" Pubnub::Grant.any_instance.stub(:signature).and_return "HLaBxnS7wZztEvvnvfbi-hJONX-tGCf38vNmnelGrjU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/722", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187829" Pubnub::Grant.any_instance.stub(:signature).and_return "78znNxosznSgYayF3vZo1BsbMesMWXukdc_rma-hjS0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/720", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187829" Pubnub::Grant.any_instance.stub(:signature).and_return "78znNxosznSgYayF3vZo1BsbMesMWXukdc_rma-hjS0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/721", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187830" Pubnub::Grant.any_instance.stub(:signature).and_return "Xgl9Ttsw2nSzlT18VIj9uMIAccBbxHwHCwwz55AdNmg=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/731", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187831" Pubnub::Grant.any_instance.stub(:signature).and_return "LtJKHdxQLex25ViefltMvYUxhQeabo8z8GmLl6dPK98=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/729", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187831" Pubnub::Grant.any_instance.stub(:signature).and_return "LtJKHdxQLex25ViefltMvYUxhQeabo8z8GmLl6dPK98=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/730", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187832" Pubnub::Grant.any_instance.stub(:signature).and_return "N14_ZgQ1i5xwrI4zeqr7AeAXEQjbwiOYiwb1WFiw_pA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/728", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187832" Pubnub::Grant.any_instance.stub(:signature).and_return "N14_ZgQ1i5xwrI4zeqr7AeAXEQjbwiOYiwb1WFiw_pA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/726", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187833" Pubnub::Grant.any_instance.stub(:signature).and_return "4TxR6oBMT_UqAoK3TRavLnDSq9IvpSgTZGItdaDi1BI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/727", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187833" Pubnub::Grant.any_instance.stub(:signature).and_return "4TxR6oBMT_UqAoK3TRavLnDSq9IvpSgTZGItdaDi1BI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/737", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187834" Pubnub::Grant.any_instance.stub(:signature).and_return "F3qEs_KCZZIlOBDE7gKDnrWUTzF8Tz2wJpy4aS5kJAc=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/735", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187834" Pubnub::Grant.any_instance.stub(:signature).and_return "F3qEs_KCZZIlOBDE7gKDnrWUTzF8Tz2wJpy4aS5kJAc=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/736", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187835" Pubnub::Grant.any_instance.stub(:signature).and_return "WNHQ6TFCFq6mAzuQJQBe7c8IZ33MRJhH3tpvLarjikA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/734", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187835" Pubnub::Grant.any_instance.stub(:signature).and_return "WNHQ6TFCFq6mAzuQJQBe7c8IZ33MRJhH3tpvLarjikA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/732", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187836" Pubnub::Grant.any_instance.stub(:signature).and_return "ymGK-liEZS_R25BwToC9r5MDZ9q2EKPN4QQevBytQ0Q=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/733", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187836" Pubnub::Grant.any_instance.stub(:signature).and_return "ymGK-liEZS_R25BwToC9r5MDZ9q2EKPN4QQevBytQ0Q=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/743", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187837" Pubnub::Grant.any_instance.stub(:signature).and_return "2T1y0pqKxQuK1dTA37lFbR33hIEiFWzCtYb4IHtDYk0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/741", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187838" Pubnub::Grant.any_instance.stub(:signature).and_return "G63WxhM0lh607LTJO57EXH613UA1N68dYyCMKEjN_ug=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/742", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187839" Pubnub::Grant.any_instance.stub(:signature).and_return "Sm4aR0cQT5UAjCFfdbaD_4qlRD-UEOehH5JcPoKRMHI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/740", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187839" Pubnub::Grant.any_instance.stub(:signature).and_return "Sm4aR0cQT5UAjCFfdbaD_4qlRD-UEOehH5JcPoKRMHI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/738", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187840" Pubnub::Grant.any_instance.stub(:signature).and_return "jLa9HDOhIu7rztQD_OJZawglJlletJLOGUKrJMgtVPg=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/739", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187840" Pubnub::Grant.any_instance.stub(:signature).and_return "jLa9HDOhIu7rztQD_OJZawglJlletJLOGUKrJMgtVPg=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/749", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187841" Pubnub::Grant.any_instance.stub(:signature).and_return "k5HK9N6N86_dGDRdB_gS28F4sPB96qAOmFKB9B9K1mU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/747", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187841" Pubnub::Grant.any_instance.stub(:signature).and_return "k5HK9N6N86_dGDRdB_gS28F4sPB96qAOmFKB9B9K1mU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/748", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187842" Pubnub::Grant.any_instance.stub(:signature).and_return "3dPb34uuFh12ZlssvOtUcvsClBpvW7rSCcYWPc6-6vA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/746", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187843" Pubnub::Grant.any_instance.stub(:signature).and_return "6DwuzZKSK4pg6mzSr38x6Nm7q8xER515uME5IMDNrP8=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/744", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187844" Pubnub::Grant.any_instance.stub(:signature).and_return "ha-bivcl1Nf2AhP-FHQX9Mxxn6jqryqDrz6lSq0_lw0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/745", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187844" Pubnub::Grant.any_instance.stub(:signature).and_return "ha-bivcl1Nf2AhP-FHQX9Mxxn6jqryqDrz6lSq0_lw0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/755", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187845" Pubnub::Grant.any_instance.stub(:signature).and_return "WzW2xRRkkbscE1fQmk6tuI7gwJk0gRS8DWXTmhlLEF4=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/753", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187846" Pubnub::Grant.any_instance.stub(:signature).and_return "2NCCQ7zazVRscaM10G0ed9X_hvdUQuMt4SPjPyK74cI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/754", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187846" Pubnub::Grant.any_instance.stub(:signature).and_return "2NCCQ7zazVRscaM10G0ed9X_hvdUQuMt4SPjPyK74cI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/752", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187847" Pubnub::Grant.any_instance.stub(:signature).and_return "iSYCUXoCwmL4HVvG0xGkpBVz_poqmq9x7bnBmzKxjOU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/750", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187848" Pubnub::Grant.any_instance.stub(:signature).and_return "J6jK-2gi3e7GBgBpxy1_i1OYAe06o-TlGla3esFO5Bo=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/751", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187848" Pubnub::Grant.any_instance.stub(:signature).and_return "J6jK-2gi3e7GBgBpxy1_i1OYAe06o-TlGla3esFO5Bo=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/653", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187849" Pubnub::Grant.any_instance.stub(:signature).and_return "lHFeNO51r5rh6M3x2hOGLAEK2vQgKhmDwNV8MnxsRKs=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/651", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187850" Pubnub::Grant.any_instance.stub(:signature).and_return "UfnNiurZGmlIWfJKLcTePBWFRn7ZxhQUwLuH34weluk=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/652", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187850" Pubnub::Grant.any_instance.stub(:signature).and_return "UfnNiurZGmlIWfJKLcTePBWFRn7ZxhQUwLuH34weluk=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/650", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187851" Pubnub::Grant.any_instance.stub(:signature).and_return "N2pKPskIwMR9PL1BHjK6Hs_7z5mOvxlwUOhLCn9KnfU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/648", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187851" Pubnub::Grant.any_instance.stub(:signature).and_return "N2pKPskIwMR9PL1BHjK6Hs_7z5mOvxlwUOhLCn9KnfU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/649", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187852" Pubnub::Grant.any_instance.stub(:signature).and_return "2w2NIQrXL2ltsTQ4s0pb6nAMreQn0yLW6zSHkLY2Zl0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/659", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187853" Pubnub::Grant.any_instance.stub(:signature).and_return "Svz1Qfbqyic0ddxZNeEBcbXON89t1Gf6ah220Olc1FE=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/657", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187853" Pubnub::Grant.any_instance.stub(:signature).and_return "Svz1Qfbqyic0ddxZNeEBcbXON89t1Gf6ah220Olc1FE=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/658", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187854" Pubnub::Grant.any_instance.stub(:signature).and_return "rIb2ed2vyzUwgXZ65b8TSZTVy_tf6qEKlRYc2XxfU74=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/656", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187855" Pubnub::Grant.any_instance.stub(:signature).and_return "v8U2ecByCVul_8C5QhVVoLbQIORNXF08BxtGZKdWfZc=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/654", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187855" Pubnub::Grant.any_instance.stub(:signature).and_return "v8U2ecByCVul_8C5QhVVoLbQIORNXF08BxtGZKdWfZc=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/655", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187856" Pubnub::Grant.any_instance.stub(:signature).and_return "WQ1Lhk-C3dCPIDuG1EdFeWSsrZpqqjzOjlY3ACD7rfU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/665", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187856" Pubnub::Grant.any_instance.stub(:signature).and_return "fAfDm6mNQcTFG6_APnv9pOe0EYuETR-OKccFDgwc1IM=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/663", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187857" Pubnub::Grant.any_instance.stub(:signature).and_return "Rx0pTrOWGhlvxb_IygosSQ0hS7FzLQFKtZfloEpBtcc=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/664", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187858" Pubnub::Grant.any_instance.stub(:signature).and_return "pDpsOLW7mGkllQUIu5pJf57dirLG_bXzEQDvwNEqdXw=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/662", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187858" Pubnub::Grant.any_instance.stub(:signature).and_return "pDpsOLW7mGkllQUIu5pJf57dirLG_bXzEQDvwNEqdXw=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/660", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187859" Pubnub::Grant.any_instance.stub(:signature).and_return "oh_vqxMLhrbzY4mf_oi9cSBUni1wsZaWZheh_a6GDsI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/661", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187860" Pubnub::Grant.any_instance.stub(:signature).and_return "MKcxfS3p_cYzJdJIYDwS_K1PPHR7QBVYp1HL_hK5uN0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/671", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187860" Pubnub::Grant.any_instance.stub(:signature).and_return "6JcdSiVltqH5_pnxAjT6KZgdFFQ9bAm5VRf_cXgxfq0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/669", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187861" Pubnub::Grant.any_instance.stub(:signature).and_return "fgETFjRt95HfrRR0e8fYQfdJlbgcX4JbAum0-tQrv0s=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/670", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187862" Pubnub::Grant.any_instance.stub(:signature).and_return "LYsEB3KEAgHydvPPM-Y-8YukC35gsAj43wP1qyxYQho=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/668", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187862" Pubnub::Grant.any_instance.stub(:signature).and_return "LYsEB3KEAgHydvPPM-Y-8YukC35gsAj43wP1qyxYQho=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/666", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187863" Pubnub::Grant.any_instance.stub(:signature).and_return "YPCAsu7w3wGLAr0ciDcoePpWOSBphKsKw9kAglhuYJ4=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/667", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187864" Pubnub::Grant.any_instance.stub(:signature).and_return "Qc-MjdxVdK7-UGLb4LtrJis7deIAD79OUSnfhNknWi8=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/677", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187864" Pubnub::Grant.any_instance.stub(:signature).and_return "A70WQp0S5uTz_Pe8eWP8CIoJDAX68Oa348me8jHNOF8=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/675", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187865" Pubnub::Grant.any_instance.stub(:signature).and_return "vay0P8XKi8MCkT6yOsn_S1-aobnjQKZS3RhCJ8JAGD8=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/676", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187865" Pubnub::Grant.any_instance.stub(:signature).and_return "vay0P8XKi8MCkT6yOsn_S1-aobnjQKZS3RhCJ8JAGD8=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/674", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187866" Pubnub::Grant.any_instance.stub(:signature).and_return "q1Xh-gnEAY-3tr4Y8F5lCD3hDTsk6fuzLeWL3S2kWNw=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/672", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187867" Pubnub::Grant.any_instance.stub(:signature).and_return "jS7Z2pFBIKdJt4BYKxed-qBRTQJKidO5kdv7yY4IW1A=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/673", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187867" Pubnub::Grant.any_instance.stub(:signature).and_return "jS7Z2pFBIKdJt4BYKxed-qBRTQJKidO5kdv7yY4IW1A=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/683", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187868" Pubnub::Grant.any_instance.stub(:signature).and_return "lh00gxZmLy4WK_xwum_hQThICBSeSib2RNzIMBmcvbQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/681", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187868" Pubnub::Grant.any_instance.stub(:signature).and_return "lh00gxZmLy4WK_xwum_hQThICBSeSib2RNzIMBmcvbQ=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/682", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187869" Pubnub::Grant.any_instance.stub(:signature).and_return "4KnyKsdm7OnWCEpfCWrMj0XJB_ev0lJbyi35wEX9-Q0=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/680", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187870" Pubnub::Grant.any_instance.stub(:signature).and_return "DM_tR22MFhkJcBJxOkOE1KKEaCCGM4vX_07NWVjhpDE=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/678", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187870" Pubnub::Grant.any_instance.stub(:signature).and_return "DM_tR22MFhkJcBJxOkOE1KKEaCCGM4vX_07NWVjhpDE=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/679", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187871" Pubnub::Grant.any_instance.stub(:signature).and_return "AV6t0ZZzylgTGhqv3_XPbmq0aiVpdeToPTW5bnWHcOU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/689", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187871" Pubnub::Grant.any_instance.stub(:signature).and_return "uHOa65PqX3qHmBpkduO60MRNtv92Vbrer8Z1Scaxj3A=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/687", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187872" Pubnub::Grant.any_instance.stub(:signature).and_return "ips3RMhXt9gPAcw5hFAU0opaCK-F0-wdz238OF4VcpI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/688", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187873" Pubnub::Grant.any_instance.stub(:signature).and_return "aJ_Ub2-9Md5Y-WJI6F_taNZ9FiaHqPhKmwCH98l4JhA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/686", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187874" Pubnub::Grant.any_instance.stub(:signature).and_return "HPIL1_bY6f_TSrLPxY1l2tD1O4JZKisi2O5ojryyvEI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/684", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187874" Pubnub::Grant.any_instance.stub(:signature).and_return "HPIL1_bY6f_TSrLPxY1l2tD1O4JZKisi2O5ojryyvEI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/685", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187875" Pubnub::Grant.any_instance.stub(:signature).and_return "9OojbP3kwhFxnnP7m9_k4_OgbClo5CjcDDU3VugTUeY=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/695", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187875" Pubnub::Grant.any_instance.stub(:signature).and_return "JbcfsZ5nFFjcQxrKA1Nudz_nfRNO-_hXPS0wQw737dI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/693", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187876" Pubnub::Grant.any_instance.stub(:signature).and_return "NsbRC5_xit72-g7sS6Zuov4zmokkB4UAmRiV9pzQgGM=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/694", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187876" Pubnub::Grant.any_instance.stub(:signature).and_return "NsbRC5_xit72-g7sS6Zuov4zmokkB4UAmRiV9pzQgGM=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/692", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187877" Pubnub::Grant.any_instance.stub(:signature).and_return "N5OHgUD6RBTqY3-ONrFRAql9h0gDuc2bczvcOFjzgwI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/690", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187878" Pubnub::Grant.any_instance.stub(:signature).and_return "kMS31DP0oUatJyuGcVtxRz4s2lFJB76BB7GbmIIa9Go=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/691", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187879" Pubnub::Grant.any_instance.stub(:signature).and_return "emPkfBghurp1iVFbE7e-vwG7U-H0GGWBvUxSMsiWElg=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/701", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187879" Pubnub::Grant.any_instance.stub(:signature).and_return "gt466dOrbYgWTHv0oe8yDzOF47P261PS5AGxamXiDYA=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/699", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187880" Pubnub::Grant.any_instance.stub(:signature).and_return "rNqufmww2m5fjYuSE5YtU3QvnaaScRIcTfiidcTjlRc=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/700", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187881" Pubnub::Grant.any_instance.stub(:signature).and_return "HgLGAZwrKfTyf_9k1c714Ld2frp_E_bbV8Z9lwdEKzg=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/698", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187882" Pubnub::Grant.any_instance.stub(:signature).and_return "s8ilfyKORG3Kny3hRva1CWv__emBtpPPfMerIg1a8eo=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/696", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187883" Pubnub::Grant.any_instance.stub(:signature).and_return "9yyoAVdb-cdNs5_GHVNnlVZvMlIfcgdZclR4QtZ1s7w=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/697", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187883" Pubnub::Grant.any_instance.stub(:signature).and_return "9yyoAVdb-cdNs5_GHVNnlVZvMlIfcgdZclR4QtZ1s7w=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/707", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187884" Pubnub::Grant.any_instance.stub(:signature).and_return "os4UB5gYYk049Ql5dZEsla96VJDdWFoQKUtAYKY0k1k=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/705", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187885" Pubnub::Grant.any_instance.stub(:signature).and_return "yvikt3iFcnN3XmJz7NrvHhDAIMFWffTH8MhDjkdI6vU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/706", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187885" Pubnub::Grant.any_instance.stub(:signature).and_return "yvikt3iFcnN3XmJz7NrvHhDAIMFWffTH8MhDjkdI6vU=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/704", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187886" Pubnub::Grant.any_instance.stub(:signature).and_return "rt_N6BB57vTsGN20dKenKvR7A6iLaRZKul01CgUxLOI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/702", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187886" Pubnub::Grant.any_instance.stub(:signature).and_return "rt_N6BB57vTsGN20dKenKvR7A6iLaRZKul01CgUxLOI=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/703", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187887" Pubnub::Grant.any_instance.stub(:signature).and_return "j-InfE_ydxvAYdumlIUxx8WV07CwFFIySiCEfOja838=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/713", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187887" Pubnub::Grant.any_instance.stub(:signature).and_return "nVJrrl_mTKhsLP8A4udbSXaFE1E9K9wQc9-nWryL2Xs=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/711", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187888" Pubnub::Grant.any_instance.stub(:signature).and_return "9cihQ2WBHaFaXvDyv0qMPrsnf5wIqARrE3O7bSNDzMw=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/712", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187888" Pubnub::Grant.any_instance.stub(:signature).and_return "9cihQ2WBHaFaXvDyv0qMPrsnf5wIqARrE3O7bSNDzMw=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/710", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187889" Pubnub::Grant.any_instance.stub(:signature).and_return "DGAUTCL351FOH5-9z0Ys-t1MSeCj1LRu2Mq5DIHrNVs=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/708", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187890" Pubnub::Grant.any_instance.stub(:signature).and_return "1FdoXH6FvmrYRzoXgAfYje7ia54gbmNJy1r7fk2oYJ4=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/709", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187890" Pubnub::Grant.any_instance.stub(:signature).and_return "1FdoXH6FvmrYRzoXgAfYje7ia54gbmNJy1r7fk2oYJ4=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/719", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187891" Pubnub::Grant.any_instance.stub(:signature).and_return "zLh2gxaP3dulo5x5UDT9vA6OOH79QoNeYXSrvnvwXfM=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/717", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187892" Pubnub::Grant.any_instance.stub(:signature).and_return "m2-dA66YAj9LFwW0Xyp8XQOS8xChcnqkg3NcXteSabM=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/718", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187892" Pubnub::Grant.any_instance.stub(:signature).and_return "m2-dA66YAj9LFwW0Xyp8XQOS8xChcnqkg3NcXteSabM=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/716", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187893" Pubnub::Grant.any_instance.stub(:signature).and_return "CGqQIdRegyY7NOLnDdZgIC1EuwoftRLv1G5cl2oZP6Y=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/714", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187893" Pubnub::Grant.any_instance.stub(:signature).and_return "CGqQIdRegyY7NOLnDdZgIC1EuwoftRLv1G5cl2oZP6Y=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/715", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187894" Pubnub::Grant.any_instance.stub(:signature).and_return "pTkdHWP3UkqY7zToDRDK3BnIInK_y9X2zy8K8xgIU1U=" envelope = @pubnub.grant(channel: "demo", read: true, write: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/833", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187895" Pubnub::Grant.any_instance.stub(:signature).and_return "1w7rz0F-uEX0-FmslR881B4dBAuLc45d2aydDTKDFTA=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/831", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187896" Pubnub::Grant.any_instance.stub(:signature).and_return "KcqkR1bI_1gy26Osaclv3tjQL3LxDp6ooX1QizTV0Bg=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/832", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187896" Pubnub::Grant.any_instance.stub(:signature).and_return "KcqkR1bI_1gy26Osaclv3tjQL3LxDp6ooX1QizTV0Bg=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/830", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187897" Pubnub::Grant.any_instance.stub(:signature).and_return "BZJ0Lb5XlNK-syVcGOtF9Lrh0ZtUVxSOMwErJY19PbA=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/828", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187898" Pubnub::Grant.any_instance.stub(:signature).and_return "_5sbiAH2sO-BvdjH4sqzEts_FnLhoLyYLr04JyJ7DFs=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/829", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187899" Pubnub::Grant.any_instance.stub(:signature).and_return "a8s5WVJr_nyao_klrSt_9PcFhX_vLic_4diEWiukwPc=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/839", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187899" Pubnub::Grant.any_instance.stub(:signature).and_return "rUlM0lcjzFY--kyJVSZZ8vvhxGC78wHfdmRxqTILUxg=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/837", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187900" Pubnub::Grant.any_instance.stub(:signature).and_return "OzyTaKOTr95n59wF9P0bM_HDoAYKUqgjhM7AHTYUiQ0=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/838", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187901" Pubnub::Grant.any_instance.stub(:signature).and_return "SCeywqL4eVlYzd31x-7f6SaL81T7fejuI6FPIi2PQnA=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/836", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187901" Pubnub::Grant.any_instance.stub(:signature).and_return "SCeywqL4eVlYzd31x-7f6SaL81T7fejuI6FPIi2PQnA=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/834", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187902" Pubnub::Grant.any_instance.stub(:signature).and_return "L68DS4IxDCo2vzNsqaFVcIMc8Js_1HMpROzSNSAHYT4=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/835", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187903" Pubnub::Grant.any_instance.stub(:signature).and_return "ACp6Lw_8ZP9O1gdK1X7O8odiPstI1i7mJN8T7K_ZffE=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/845", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187903" Pubnub::Grant.any_instance.stub(:signature).and_return "U1rBR_jt9GPmBvJMs2xBDhN-PFzxHf3QNpSogzKrbyI=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/843", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187904" Pubnub::Grant.any_instance.stub(:signature).and_return "3k8_q_4HNc2kqmniPtrutNCLHOu7kkUBatrZbNxFpE8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/844", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187906" Pubnub::Grant.any_instance.stub(:signature).and_return "ZDn7iwIaMSmab_DqAhJiDEmZD2R0jc6MnRVCGvZKDq8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/842", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187907" Pubnub::Grant.any_instance.stub(:signature).and_return "1NnQ2toQLajSj30eAEPjPsHyhrFhYZJ3pmRC4X-DLyw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/840", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187907" Pubnub::Grant.any_instance.stub(:signature).and_return "1NnQ2toQLajSj30eAEPjPsHyhrFhYZJ3pmRC4X-DLyw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/841", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187908" Pubnub::Grant.any_instance.stub(:signature).and_return "xVsgrB0YysK-ZXoa-SMwmW_I_RWucAKlXc5yODlsXz8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/851", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187909" Pubnub::Grant.any_instance.stub(:signature).and_return "OKlZreh36baXogI6s_c9TaApwa02k8kyKuhIlKwgayg=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/849", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187909" Pubnub::Grant.any_instance.stub(:signature).and_return "OKlZreh36baXogI6s_c9TaApwa02k8kyKuhIlKwgayg=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/850", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187910" Pubnub::Grant.any_instance.stub(:signature).and_return "zQpIHRj9o48XobZFs957XxBmQA_YTWm_9eDbfp6mcaM=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/848", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187910" Pubnub::Grant.any_instance.stub(:signature).and_return "zQpIHRj9o48XobZFs957XxBmQA_YTWm_9eDbfp6mcaM=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/846", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187911" Pubnub::Grant.any_instance.stub(:signature).and_return "q4BqbN_p7lIrT4oikpJ6pgdui2pQFcswxFeEZVxDOuY=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/847", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187912" Pubnub::Grant.any_instance.stub(:signature).and_return "GTayYOmn5kdFsykTYFDgXUlHBdD2OwJq1Uww68JT9lI=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/857", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187912" Pubnub::Grant.any_instance.stub(:signature).and_return "AWm_mpwkpL5WnUCU751NCCY2akCtjoBYfWwk_otke6k=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/855", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187913" Pubnub::Grant.any_instance.stub(:signature).and_return "cpOyLROxM8sQ0QtLzOOceaxiZ1dsB6xcmnKfHHv-Pmw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/856", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187913" Pubnub::Grant.any_instance.stub(:signature).and_return "cpOyLROxM8sQ0QtLzOOceaxiZ1dsB6xcmnKfHHv-Pmw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/854", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187914" Pubnub::Grant.any_instance.stub(:signature).and_return "YNsx7gJzXlvFcKFEXWV8HQRFZLDMGAH0GwNmH5_cT1A=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/852", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187915" Pubnub::Grant.any_instance.stub(:signature).and_return "m90raM001P8Uc57h5vDUyczj2GQC5S0hxP_z17N39Vg=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/853", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187916" Pubnub::Grant.any_instance.stub(:signature).and_return "rLjqvPOkOu2oFAcf0NGOK8LNo2pxbbWdLr0rL8k88hE=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/863", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187916" Pubnub::Grant.any_instance.stub(:signature).and_return "UlsDr8yHQfI1dMe5jK3W5NdWnXQHRkj97X2cdzezdCw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/861", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187917" Pubnub::Grant.any_instance.stub(:signature).and_return "R7fiHNvCXw9qBWo9_FuRPjFSb879_j7Uq10mfxRYStk=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/862", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187918" Pubnub::Grant.any_instance.stub(:signature).and_return "_EG4WhpMrfnhJ_8Kufmxy8WSTV8BpYDJjUEeEbttOCY=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/860", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187918" Pubnub::Grant.any_instance.stub(:signature).and_return "_EG4WhpMrfnhJ_8Kufmxy8WSTV8BpYDJjUEeEbttOCY=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/858", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187919" Pubnub::Grant.any_instance.stub(:signature).and_return "LEom7N1yzQwVKxxIBL4EwSYmPvndqXC6FEllYrt8z9k=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/859", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187920" Pubnub::Grant.any_instance.stub(:signature).and_return "Q34kP6tixfIf-x4dVsVB5li_PWxP88qYZ4vUFZivSK0=" envelope = @pubnub.grant(channel: "demo", read: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/761", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187921" Pubnub::Grant.any_instance.stub(:signature).and_return "KLOVKusMajL7uEUzMNGhssOxSgmNiaMbLL-ZxnHyYlM=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/759", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187921" Pubnub::Grant.any_instance.stub(:signature).and_return "KLOVKusMajL7uEUzMNGhssOxSgmNiaMbLL-ZxnHyYlM=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/760", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187922" Pubnub::Grant.any_instance.stub(:signature).and_return "-wib4GxpR35JWU3q2noOxjMsfP3lAUlqTypI9e97RWA=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/758", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187923" Pubnub::Grant.any_instance.stub(:signature).and_return "ccV1hcNsRqJs5wuITQLuYgkh51-uAkc6zRnkec_TPxo=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/756", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187924" Pubnub::Grant.any_instance.stub(:signature).and_return "O4WaKASmqOGfnVJpg_pGCUPPELo-jhzJ7P-IfmihU_k=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/757", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187925" Pubnub::Grant.any_instance.stub(:signature).and_return "xH-zHclbrLZeVZYvJObn_dgAamAmh8iXn6M70Pna2mM=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/767", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187925" Pubnub::Grant.any_instance.stub(:signature).and_return "a1dwgBKnFJMtqxl88HCO19Xe-GKl81FtcvRLQ9B_gS8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/765", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187926" Pubnub::Grant.any_instance.stub(:signature).and_return "PNyyWj9UUwQ7mQXf4HKrnr4eNvA5hcEi3ruLpoUSkkE=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/766", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187927" Pubnub::Grant.any_instance.stub(:signature).and_return "NoXoa1u08rUL4cQENaEQPBrv8A8CabJRscp6IMQkRl0=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/764", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187927" Pubnub::Grant.any_instance.stub(:signature).and_return "NoXoa1u08rUL4cQENaEQPBrv8A8CabJRscp6IMQkRl0=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/762", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187928" Pubnub::Grant.any_instance.stub(:signature).and_return "AgI4t3PI7ndpeSnvZOnMriD5SqCBnaEw1pNANDdabN0=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/763", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187929" Pubnub::Grant.any_instance.stub(:signature).and_return "xNsh70bbjz1b0IZCoIxuK8tJe10E-9s_-Ppya0kTURM=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/773", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187929" Pubnub::Grant.any_instance.stub(:signature).and_return "CYTtajqssUBVkQvOjVhFzd8kMWPG9XmAT7Gozr33_HE=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/771", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187930" Pubnub::Grant.any_instance.stub(:signature).and_return "IxPwVJK84GVxPeZrV89j7A8BCOhIfcPv8AsSulwTZSw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/772", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187931" Pubnub::Grant.any_instance.stub(:signature).and_return "2y3gWWZB1L22ds48kDj1B51hJDlSkuKsjHJbR-oVtrA=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/770", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187932" Pubnub::Grant.any_instance.stub(:signature).and_return "1-qk2mDRuUzqj7WO8oQjMvYdHMRx7_8agk_9UO5z7pY=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/768", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187933" Pubnub::Grant.any_instance.stub(:signature).and_return "Fpvt3tst84-DOn6oWCqnC0hiYgOFh_7yqP_Zp4B6u_s=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/769", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187933" Pubnub::Grant.any_instance.stub(:signature).and_return "Fpvt3tst84-DOn6oWCqnC0hiYgOFh_7yqP_Zp4B6u_s=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/779", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187934" Pubnub::Grant.any_instance.stub(:signature).and_return "AJ3209QU70oKr5aDLtJbzxrClWWZIjL9LInM46tGQH8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/777", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187935" Pubnub::Grant.any_instance.stub(:signature).and_return "Rmn6qoKDysFXUR2cMeaRZx6LnGv60JJmApUFFzg4EZo=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/778", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187935" Pubnub::Grant.any_instance.stub(:signature).and_return "Rmn6qoKDysFXUR2cMeaRZx6LnGv60JJmApUFFzg4EZo=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/776", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187936" Pubnub::Grant.any_instance.stub(:signature).and_return "HiFglqAF46AKBSDz7oNDC_u6OgIu9YzYBblbSJLY4S4=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/774", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187937" Pubnub::Grant.any_instance.stub(:signature).and_return "nFBsdmhfbIhC0-3qquUFwpSqjAoqMiVsyo3Mhk9Q-3g=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/775", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187937" Pubnub::Grant.any_instance.stub(:signature).and_return "nFBsdmhfbIhC0-3qquUFwpSqjAoqMiVsyo3Mhk9Q-3g=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/785", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187938" Pubnub::Grant.any_instance.stub(:signature).and_return "jvlcuafbYt1WHANLaz0AvUeeyq0ytH3mSd08ZCIY6hc=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/783", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187939" Pubnub::Grant.any_instance.stub(:signature).and_return "SpGrWgX2Qo9OdKdKh1QvgnVVhEoD0r3crmd2rhHaRu4=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/784", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187940" Pubnub::Grant.any_instance.stub(:signature).and_return "oM7u_rpgsMtQ2kFz3TpJiqn8rjpls3qD3G_VcxetFAE=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/782", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187941" Pubnub::Grant.any_instance.stub(:signature).and_return "yEpaTNt6t6RYh_w8e_B9WYQTWjTlALtw9HBwPPIjUkw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/780", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187941" Pubnub::Grant.any_instance.stub(:signature).and_return "yEpaTNt6t6RYh_w8e_B9WYQTWjTlALtw9HBwPPIjUkw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/781", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187942" Pubnub::Grant.any_instance.stub(:signature).and_return "WCXjinyXQF4MuEf2eXnANoG6IeygYBzOBq1-Z2BU38o=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/791", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187943" Pubnub::Grant.any_instance.stub(:signature).and_return "yguiz9woJT_ncV-VnNakg59AI_ebmVwW6fT00XD_8FU=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/789", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187944" Pubnub::Grant.any_instance.stub(:signature).and_return "-zvj_DIzyY6E_X3IBxyfumrKe-29kjGJtOEBJV-lqck=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/790", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187944" Pubnub::Grant.any_instance.stub(:signature).and_return "-zvj_DIzyY6E_X3IBxyfumrKe-29kjGJtOEBJV-lqck=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/788", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187945" Pubnub::Grant.any_instance.stub(:signature).and_return "Yr0TS2eD1gYDjjA37_VErMc1G4dFtdLRI92rSBTXbfw=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/786", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187946" Pubnub::Grant.any_instance.stub(:signature).and_return "97JPUJ1SEhG8tjs_SGh5ujjp4l0P7EOZIbqtipkUKV8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/787", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187946" Pubnub::Grant.any_instance.stub(:signature).and_return "97JPUJ1SEhG8tjs_SGh5ujjp4l0P7EOZIbqtipkUKV8=" envelope = @pubnub.grant(channel: "demo", read: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/797", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187947" Pubnub::Grant.any_instance.stub(:signature).and_return "1zYaTZpt6N7U0hkpMrMlz2sr5sALrgabNHFWRNohuY4=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/795", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187948" Pubnub::Grant.any_instance.stub(:signature).and_return "Jh94jJPLS5y5yNYCURWvp9Vo6kDeK1qvi-OOy6CTF8A=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/796", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187948" Pubnub::Grant.any_instance.stub(:signature).and_return "Jh94jJPLS5y5yNYCURWvp9Vo6kDeK1qvi-OOy6CTF8A=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/794", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187949" Pubnub::Grant.any_instance.stub(:signature).and_return "qUenmyks2pCCM9WftFV_Kyewri1_TU2Gbn8nfFItnwY=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/792", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187950" Pubnub::Grant.any_instance.stub(:signature).and_return "fT4SEMx9a6fdPPY0GNzsZwasNsRD_WQUb4vZVKOug8o=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/793", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187950" Pubnub::Grant.any_instance.stub(:signature).and_return "fT4SEMx9a6fdPPY0GNzsZwasNsRD_WQUb4vZVKOug8o=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/803", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187951" Pubnub::Grant.any_instance.stub(:signature).and_return "vsCQa9utxI8vIvFufq8XSClu7O8DWrJO5XJVaqr0VK4=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/801", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187951" Pubnub::Grant.any_instance.stub(:signature).and_return "vsCQa9utxI8vIvFufq8XSClu7O8DWrJO5XJVaqr0VK4=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/802", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187952" Pubnub::Grant.any_instance.stub(:signature).and_return "rFP0LrCYYbdjUoswG5BLPvKCtse4PXxu_wzjag_EQyo=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/800", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187953" Pubnub::Grant.any_instance.stub(:signature).and_return "vsZtbZA6PTz0jL5WyTYOkAXNE91c4lRrXA0OfEyVqVA=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/798", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187953" Pubnub::Grant.any_instance.stub(:signature).and_return "vsZtbZA6PTz0jL5WyTYOkAXNE91c4lRrXA0OfEyVqVA=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/799", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187954" Pubnub::Grant.any_instance.stub(:signature).and_return "mMbgDL6bstbL8nCOfW3hulOuxZiqYvvzcKbPs1J2drw=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/809", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187955" Pubnub::Grant.any_instance.stub(:signature).and_return "K-gBQAKWEE40UoR3gqMze_pA4SBPoE6daqomfUZqiPI=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/807", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187955" Pubnub::Grant.any_instance.stub(:signature).and_return "K-gBQAKWEE40UoR3gqMze_pA4SBPoE6daqomfUZqiPI=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/808", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187956" Pubnub::Grant.any_instance.stub(:signature).and_return "0hiA9U48bB2gcHGXGW0OmNyRf4VxZv_cRj-jMd_OkdQ=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/806", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187957" Pubnub::Grant.any_instance.stub(:signature).and_return "_KAklob6zKozWkZ-AbRLBqJkHA7BqrjeqUNd5oudFmM=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/804", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187958" Pubnub::Grant.any_instance.stub(:signature).and_return "EC4r8ggUTlXXNi8XX0ZtzT5dAd0MGTo0QkrPLyWKyDI=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/805", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187958" Pubnub::Grant.any_instance.stub(:signature).and_return "EC4r8ggUTlXXNi8XX0ZtzT5dAd0MGTo0QkrPLyWKyDI=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/815", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187959" Pubnub::Grant.any_instance.stub(:signature).and_return "Zjb__BM_roybCSeZa1GIbYxt2nzfNAIouQK6PagFuDY=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/813", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187960" Pubnub::Grant.any_instance.stub(:signature).and_return "tLkJaideq92wmG5Sf0XWS-SiBNDtyLG_DEuDik0CQYI=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/814", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187961" Pubnub::Grant.any_instance.stub(:signature).and_return "QcvMYp8es8QCzmp0glylvFqdMQANe9J5ziir6MTP3Lo=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/812", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187961" Pubnub::Grant.any_instance.stub(:signature).and_return "QcvMYp8es8QCzmp0glylvFqdMQANe9J5ziir6MTP3Lo=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/810", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187962" Pubnub::Grant.any_instance.stub(:signature).and_return "YHMdldh0ijq9znvua87A-9690PHLfA_FbmFCZH0gFu4=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/811", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187963" Pubnub::Grant.any_instance.stub(:signature).and_return "HtHh7WN1TLDvR1jL4aivUR1rVqlnzTtCSLWcWR1-UVI=" envelope = @pubnub.grant(channel: "demo", read: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/821", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187963" Pubnub::Grant.any_instance.stub(:signature).and_return "MJsUAQDhGu4MVMRmxBJixYuC-o44W8l5Kte0K2hRrC4=" envelope = @pubnub.grant(channel: "demo", read: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/819", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187964" Pubnub::Grant.any_instance.stub(:signature).and_return "OR3L6kOwChlntRjwwE_HQ4F7wso7UwfOiliCaGVPi8s=" envelope = @pubnub.grant(channel: "demo", read: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/820", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187965" Pubnub::Grant.any_instance.stub(:signature).and_return "UgvvIz_pFRPdXv-gPjQFyOoICxhJQ8_uMcKhbSblp68=" envelope = @pubnub.grant(channel: "demo", read: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/818", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187966" Pubnub::Grant.any_instance.stub(:signature).and_return "xAYjYTPOBa6oltonLwwPYpNONeFOfzwEnH5oYzlmwxE=" envelope = @pubnub.grant(channel: "demo", read: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/816", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187966" Pubnub::Grant.any_instance.stub(:signature).and_return "xAYjYTPOBa6oltonLwwPYpNONeFOfzwEnH5oYzlmwxE=" envelope = @pubnub.grant(channel: "demo", read: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/817", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187967" Pubnub::Grant.any_instance.stub(:signature).and_return "yVPN82daLcCVrSvIfSvBjqhzbUlozDZcD43U2guaozA=" envelope = @pubnub.grant(channel: "demo", read: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/827", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187968" Pubnub::Grant.any_instance.stub(:signature).and_return "A9vQzzS924XEPPtXdVX4uAuxwTRmQTE66tFHIJc9X1I=" envelope = @pubnub.grant(channel: "demo", read: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/825", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187969" Pubnub::Grant.any_instance.stub(:signature).and_return "WAxFNn9c1XFQqTjmJ5D5U5Rs0l4glvimoe9cSVghr1I=" envelope = @pubnub.grant(channel: "demo", read: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/826", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187969" Pubnub::Grant.any_instance.stub(:signature).and_return "WAxFNn9c1XFQqTjmJ5D5U5Rs0l4glvimoe9cSVghr1I=" envelope = @pubnub.grant(channel: "demo", read: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/824", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187970" Pubnub::Grant.any_instance.stub(:signature).and_return "ltHslKS5D8H_VKJ4TrO7DpDyJG-qTNu0vDODY87TsZM=" envelope = @pubnub.grant(channel: "demo", read: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/822", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187971" Pubnub::Grant.any_instance.stub(:signature).and_return "beY2eLNypNFSeFnFAfOmT1zcJgjpDo2e5N4B0PWGEN0=" envelope = @pubnub.grant(channel: "demo", read: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__true___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/823", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187971" Pubnub::Grant.any_instance.stub(:signature).and_return "beY2eLNypNFSeFnFAfOmT1zcJgjpDo2e5N4B0PWGEN0=" envelope = @pubnub.grant(channel: "demo", read: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/293", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187972" Pubnub::Grant.any_instance.stub(:signature).and_return "YiHTAUkAUdk_TB3OSe8pQGDfHjLJnzFIqra0TAMbX3g=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/291", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187972" Pubnub::Grant.any_instance.stub(:signature).and_return "YiHTAUkAUdk_TB3OSe8pQGDfHjLJnzFIqra0TAMbX3g=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/292", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187973" Pubnub::Grant.any_instance.stub(:signature).and_return "6GjPcQ9Iw3PDEhwVylN2yrKboWlRE8Pa66JOiUpckPQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/290", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187974" Pubnub::Grant.any_instance.stub(:signature).and_return "CiBYJiMJbY1EQADXac8LfbSVbjRT4ocUhoBsi50YUgg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/288", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187974" Pubnub::Grant.any_instance.stub(:signature).and_return "CiBYJiMJbY1EQADXac8LfbSVbjRT4ocUhoBsi50YUgg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/289", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187975" Pubnub::Grant.any_instance.stub(:signature).and_return "jgfHLDxNcFGNZi7c9Q-LzwJu4dYGO7LLkPWcK5KwbOU=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/299", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187975" Pubnub::Grant.any_instance.stub(:signature).and_return "84u87-W3Sc713sGcP9mDBXV88O7ztIwCfDpkhqtUZsE=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/297", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187976" Pubnub::Grant.any_instance.stub(:signature).and_return "ifeQ32DK_7Tb_Z_WZg-aGh92ObNvdd1IY5KbcQDBiHw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/298", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187977" Pubnub::Grant.any_instance.stub(:signature).and_return "c79LqPAwERKx9md7UYHJqkAfy70pUWpdF3BUe7hVWHI=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/296", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187977" Pubnub::Grant.any_instance.stub(:signature).and_return "c79LqPAwERKx9md7UYHJqkAfy70pUWpdF3BUe7hVWHI=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/294", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187978" Pubnub::Grant.any_instance.stub(:signature).and_return "vNmadn0yaHqu82UTjHCQSAtt1sSSXfP_oRF6ZZVsiDM=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/295", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187978" Pubnub::Grant.any_instance.stub(:signature).and_return "vNmadn0yaHqu82UTjHCQSAtt1sSSXfP_oRF6ZZVsiDM=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/305", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187979" Pubnub::Grant.any_instance.stub(:signature).and_return "KUyULnBJAp6ztcIPBhP68_9Nua-0SRrPS8RgdcZRzW8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/303", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187980" Pubnub::Grant.any_instance.stub(:signature).and_return "IUfL6X8sin4YqajfRvE7OqMPqoQBQfDV_PyoGqJ_Niw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/304", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187980" Pubnub::Grant.any_instance.stub(:signature).and_return "IUfL6X8sin4YqajfRvE7OqMPqoQBQfDV_PyoGqJ_Niw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/302", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187981" Pubnub::Grant.any_instance.stub(:signature).and_return "lx-GUufuLrPqK3SJWcgr9tIr1xzR4oRgeC_H585dFsg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/300", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187981" Pubnub::Grant.any_instance.stub(:signature).and_return "lx-GUufuLrPqK3SJWcgr9tIr1xzR4oRgeC_H585dFsg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/301", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187982" Pubnub::Grant.any_instance.stub(:signature).and_return "8Pq1hA5RaWep3VW63Z42YnadX7bCJU8c8NDja6bjiNQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/311", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187982" Pubnub::Grant.any_instance.stub(:signature).and_return "SEstdsTiv1AZbnNOtVWwlyCJUANVpiog4hLfHPB8tMU=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/309", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187983" Pubnub::Grant.any_instance.stub(:signature).and_return "HauYqJ5tahU3mHRzjG-d5H0GEuboe1h_2LPmCHFddg0=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/310", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187984" Pubnub::Grant.any_instance.stub(:signature).and_return "u__sQiM1X47FK9PXx76z3hWmS5R2ZP6jiYxHjb2aaGg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/308", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187984" Pubnub::Grant.any_instance.stub(:signature).and_return "u__sQiM1X47FK9PXx76z3hWmS5R2ZP6jiYxHjb2aaGg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/306", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187985" Pubnub::Grant.any_instance.stub(:signature).and_return "Zy3z1R8sdx-JmKZc5TpZk4yXVa1sTbgJWqtOQ3EOBzw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/307", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187985" Pubnub::Grant.any_instance.stub(:signature).and_return "Zy3z1R8sdx-JmKZc5TpZk4yXVa1sTbgJWqtOQ3EOBzw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/317", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187986" Pubnub::Grant.any_instance.stub(:signature).and_return "gNmvDa-UYlKKWRoqnI1-9cv4mKABNsZdxd-R4rsIA68=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/315", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187987" Pubnub::Grant.any_instance.stub(:signature).and_return "Eyp5kTdmlXcIF16KPSldd-sa0-i2nZyvY9BeCKCv6C8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/316", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187987" Pubnub::Grant.any_instance.stub(:signature).and_return "Eyp5kTdmlXcIF16KPSldd-sa0-i2nZyvY9BeCKCv6C8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/314", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187988" Pubnub::Grant.any_instance.stub(:signature).and_return "P6SDG9f7aflYWOIue_Alo4JMEJmx8XYcjUvA02WBa6Y=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/312", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187989" Pubnub::Grant.any_instance.stub(:signature).and_return "bMQ9Ns_i1DMVBW0lBTClFw78S45PQsbJICM-yfjbSJQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/313", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187989" Pubnub::Grant.any_instance.stub(:signature).and_return "bMQ9Ns_i1DMVBW0lBTClFw78S45PQsbJICM-yfjbSJQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/323", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187990" Pubnub::Grant.any_instance.stub(:signature).and_return "2Yo_qZeHnETGD63PjpSJAgr7MD9FzF0xQOl5i8SqQek=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/321", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187990" Pubnub::Grant.any_instance.stub(:signature).and_return "2Yo_qZeHnETGD63PjpSJAgr7MD9FzF0xQOl5i8SqQek=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/322", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187991" Pubnub::Grant.any_instance.stub(:signature).and_return "Fjh-zhuFwUYwTlCpkUr--c8JUM75YfQ7hnWKJccJf0E=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/320", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187992" Pubnub::Grant.any_instance.stub(:signature).and_return "Tq-6Pva5LS34MjlLtWJio0ji4e9Ho5SfCct81W9T35E=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/318", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187993" Pubnub::Grant.any_instance.stub(:signature).and_return "f3rYImf2gO1w9njsHl1TasWuWLcVwAHD5hV4Kl0JdBU=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/319", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187994" Pubnub::Grant.any_instance.stub(:signature).and_return "qYDn8CQ61eAXw6XelgQUi87K2zw99nguzNO9C1eXTfg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/221", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187995" Pubnub::Grant.any_instance.stub(:signature).and_return "8-MMbMCGs9juuCSm28IdReM7P-ZoZa1ggYUA0DJfHRA=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/219", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187995" Pubnub::Grant.any_instance.stub(:signature).and_return "8-MMbMCGs9juuCSm28IdReM7P-ZoZa1ggYUA0DJfHRA=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/220", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187996" Pubnub::Grant.any_instance.stub(:signature).and_return "JDezGHGefVdIFSMLv6-ExEGLWB9b5LgnHaylU8xpvpY=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/218", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187997" Pubnub::Grant.any_instance.stub(:signature).and_return "2pixGxNCHaRbfwCBTtU-ghJ_0t_dneUOwudADR3uLX8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/216", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187997" Pubnub::Grant.any_instance.stub(:signature).and_return "2pixGxNCHaRbfwCBTtU-ghJ_0t_dneUOwudADR3uLX8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/217", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187998" Pubnub::Grant.any_instance.stub(:signature).and_return "vJDkMABSJDqIzSkQtiZw89FwiAkB6-Bhc0O9dt2Hna4=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/227", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187998" Pubnub::Grant.any_instance.stub(:signature).and_return "2vXRc1SE8BNvdN_gpXA--4_u5865Fsg2Hg8SSb9Zbew=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/225", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464187999" Pubnub::Grant.any_instance.stub(:signature).and_return "-z8pBIp-7SApjVttCIh30PZxnLmTdu5yqQmi6Fe3IlU=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/226", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188000" Pubnub::Grant.any_instance.stub(:signature).and_return "v2_DMh5cUBZTrI7NWWWqlODQ9X356b16ugzN1sU2m-Q=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/224", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188000" Pubnub::Grant.any_instance.stub(:signature).and_return "v2_DMh5cUBZTrI7NWWWqlODQ9X356b16ugzN1sU2m-Q=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/222", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188001" Pubnub::Grant.any_instance.stub(:signature).and_return "baBjdygidgSJ6I-5I4dUhbGTt7rZMmI8Ohd01f-T5xo=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/223", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188001" Pubnub::Grant.any_instance.stub(:signature).and_return "baBjdygidgSJ6I-5I4dUhbGTt7rZMmI8Ohd01f-T5xo=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/233", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188002" Pubnub::Grant.any_instance.stub(:signature).and_return "ToalL45d5IdCV4s-A1Jf8gyTaIGs4dyCtaElCzBqWGE=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/231", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188002" Pubnub::Grant.any_instance.stub(:signature).and_return "ToalL45d5IdCV4s-A1Jf8gyTaIGs4dyCtaElCzBqWGE=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/232", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188003" Pubnub::Grant.any_instance.stub(:signature).and_return "C_NaG9HVGj05oc0XtyACakVBUk_dQn2A2YcmFbSYKqE=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/230", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188003" Pubnub::Grant.any_instance.stub(:signature).and_return "C_NaG9HVGj05oc0XtyACakVBUk_dQn2A2YcmFbSYKqE=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/228", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188004" Pubnub::Grant.any_instance.stub(:signature).and_return "K5fNuxMVCQ0MogpAY9gHGd7y6Kl1y6dFeh0YQNzKWME=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/229", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188005" Pubnub::Grant.any_instance.stub(:signature).and_return "OVH34KU-aDn3RPcz7hKChB5PlBPTONkdqE9hxW8fprc=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/239", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188005" Pubnub::Grant.any_instance.stub(:signature).and_return "zKdZzJgYOK_vO49iQfSNfXx8VcvJpquSrTzjz5Q8h2k=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/237", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188006" Pubnub::Grant.any_instance.stub(:signature).and_return "4C61ENy5iqpx7lfKpkQMYDmgml7GMJBEobMKlx39zJg=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/238", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188007" Pubnub::Grant.any_instance.stub(:signature).and_return "_Le9DxO1ALImwL-347GEVtfu6j3LBZEHCcXcrbxHl5o=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/236", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188007" Pubnub::Grant.any_instance.stub(:signature).and_return "_Le9DxO1ALImwL-347GEVtfu6j3LBZEHCcXcrbxHl5o=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/234", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188008" Pubnub::Grant.any_instance.stub(:signature).and_return "nsYL8K-vuiNDJUaifxOyiFjri-lJo1RWA3VdfiwCeNQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/235", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188008" Pubnub::Grant.any_instance.stub(:signature).and_return "nsYL8K-vuiNDJUaifxOyiFjri-lJo1RWA3VdfiwCeNQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/245", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188009" Pubnub::Grant.any_instance.stub(:signature).and_return "PcPKTRZKPRNavw-7NK0AOIQBkY1NgfQIASUU55VyT64=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/243", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188009" Pubnub::Grant.any_instance.stub(:signature).and_return "PcPKTRZKPRNavw-7NK0AOIQBkY1NgfQIASUU55VyT64=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/244", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188010" Pubnub::Grant.any_instance.stub(:signature).and_return "VXmBdzBfQc7c58kceoBwTLSyNonCnTm77Wkwl1XP5NM=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/242", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188010" Pubnub::Grant.any_instance.stub(:signature).and_return "VXmBdzBfQc7c58kceoBwTLSyNonCnTm77Wkwl1XP5NM=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/240", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188011" Pubnub::Grant.any_instance.stub(:signature).and_return "Q19nXim0aI4zLLFLHsPIxx22yjnhbLPxYOgRTSZHuu8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/241", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188011" Pubnub::Grant.any_instance.stub(:signature).and_return "Q19nXim0aI4zLLFLHsPIxx22yjnhbLPxYOgRTSZHuu8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/251", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188012" Pubnub::Grant.any_instance.stub(:signature).and_return "RfCtGS1zsWYNcwYkEZVbxWnf2_d47CJ9Dzjp7r8hV90=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/249", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188012" Pubnub::Grant.any_instance.stub(:signature).and_return "RfCtGS1zsWYNcwYkEZVbxWnf2_d47CJ9Dzjp7r8hV90=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/250", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188013" Pubnub::Grant.any_instance.stub(:signature).and_return "yBNyHjnZ3XvNq54_DaPoZRI7EYtkUbVRqdCmvIL8zo0=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/248", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188013" Pubnub::Grant.any_instance.stub(:signature).and_return "yBNyHjnZ3XvNq54_DaPoZRI7EYtkUbVRqdCmvIL8zo0=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/246", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188014" Pubnub::Grant.any_instance.stub(:signature).and_return "3UtJCOeJk4aekCu3HAJ_oB8so_bbe7dLiY1X24-23qs=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/247", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188015" Pubnub::Grant.any_instance.stub(:signature).and_return "ha6kv6J6HG2GtvN4kujWorQwHoOba4K7pDeAqAYiEqw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/257", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188015" Pubnub::Grant.any_instance.stub(:signature).and_return "NOgvo4nf8IdLOZUaXSJYQmAsC1Y2FeB9lR6KqWbdJC4=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/255", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188016" Pubnub::Grant.any_instance.stub(:signature).and_return "msX00nkSbvs7u2R4SAl6WHKR5_TzPNaSqfJvPi9lmcU=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/256", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188018" Pubnub::Grant.any_instance.stub(:signature).and_return "aoxwxDPgddInk-u_R5iEoxMMo6Ib9Ev_3vGuWTFc4X8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/254", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188018" Pubnub::Grant.any_instance.stub(:signature).and_return "aoxwxDPgddInk-u_R5iEoxMMo6Ib9Ev_3vGuWTFc4X8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/252", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188019" Pubnub::Grant.any_instance.stub(:signature).and_return "1_tRw5LgJgepDGKP0EGCmJrg6tBSTi4W3p3asOtzcmo=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/253", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188019" Pubnub::Grant.any_instance.stub(:signature).and_return "1_tRw5LgJgepDGKP0EGCmJrg6tBSTi4W3p3asOtzcmo=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/263", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188020" Pubnub::Grant.any_instance.stub(:signature).and_return "HnGUnTwm2Zsuqvhd-0HR0YVivOJL_n2TMfn7e8x4XhY=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/261", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188020" Pubnub::Grant.any_instance.stub(:signature).and_return "HnGUnTwm2Zsuqvhd-0HR0YVivOJL_n2TMfn7e8x4XhY=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/262", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188021" Pubnub::Grant.any_instance.stub(:signature).and_return "2MCsuqA3okVesXl8LjxOeHdM_7rKbc-hSjq2M2cP86M=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/260", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188021" Pubnub::Grant.any_instance.stub(:signature).and_return "2MCsuqA3okVesXl8LjxOeHdM_7rKbc-hSjq2M2cP86M=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/258", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188022" Pubnub::Grant.any_instance.stub(:signature).and_return "zyoByyy2aWY1DcV9pWpbP2_EDUNB29WUZ_6v32M2u2E=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/259", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188022" Pubnub::Grant.any_instance.stub(:signature).and_return "zyoByyy2aWY1DcV9pWpbP2_EDUNB29WUZ_6v32M2u2E=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/269", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188023" Pubnub::Grant.any_instance.stub(:signature).and_return "2DqSaM2tnyyuuKbhjOsM3UBZdOcXfKMIlc-mKBYdUok=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/267", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188024" Pubnub::Grant.any_instance.stub(:signature).and_return "m5wSw7BuLQmrQgNBYXhKYqJeYHUv4MkgfGHkWO1zZ5w=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/268", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188024" Pubnub::Grant.any_instance.stub(:signature).and_return "m5wSw7BuLQmrQgNBYXhKYqJeYHUv4MkgfGHkWO1zZ5w=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/266", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188025" Pubnub::Grant.any_instance.stub(:signature).and_return "HZhtRKrF0009K06-OFjfWxUB42hzY9bal9MiKF6hxTY=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/264", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188025" Pubnub::Grant.any_instance.stub(:signature).and_return "HZhtRKrF0009K06-OFjfWxUB42hzY9bal9MiKF6hxTY=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/265", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188026" Pubnub::Grant.any_instance.stub(:signature).and_return "3vWdFd1VqoaKDtD7JNTd8DgQYNmvJu01zL2GSx1h5RY=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/275", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188027" Pubnub::Grant.any_instance.stub(:signature).and_return "qSI2isbiyyVMUQdLa9KNf-mQfrmpaFBorbo-zWQcSX8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/273", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188027" Pubnub::Grant.any_instance.stub(:signature).and_return "qSI2isbiyyVMUQdLa9KNf-mQfrmpaFBorbo-zWQcSX8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/274", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188028" Pubnub::Grant.any_instance.stub(:signature).and_return "wGQSqFXlv-cm5w9QYYP4ml8nz93vaZB_fmngzyX_IXs=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/272", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188028" Pubnub::Grant.any_instance.stub(:signature).and_return "wGQSqFXlv-cm5w9QYYP4ml8nz93vaZB_fmngzyX_IXs=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/270", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188029" Pubnub::Grant.any_instance.stub(:signature).and_return "nbJrlACOy_WjH3DwHtuuabJ47-xNY6ux3gP8qM4TPDA=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/271", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188030" Pubnub::Grant.any_instance.stub(:signature).and_return "Al1kPH8SV_t9FjEe--R7ecM9nIu7A2V2jnKqbpgDikI=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/281", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188030" Pubnub::Grant.any_instance.stub(:signature).and_return "NicRB8SPpty0L1s3pj0oyX9tXg-6cun2hRYpJ0gcKdQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/279", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188031" Pubnub::Grant.any_instance.stub(:signature).and_return "K4hJd6WzoO5dxB6pULgu-5gMYXnd6uOK1W8OP9bjcZs=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/280", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188031" Pubnub::Grant.any_instance.stub(:signature).and_return "K4hJd6WzoO5dxB6pULgu-5gMYXnd6uOK1W8OP9bjcZs=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/278", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188032" Pubnub::Grant.any_instance.stub(:signature).and_return "5hwSveTYweuAeRdoUN0EhwyDVWGRP4Pw6nKdxVgs9jA=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/276", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188032" Pubnub::Grant.any_instance.stub(:signature).and_return "5hwSveTYweuAeRdoUN0EhwyDVWGRP4Pw6nKdxVgs9jA=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/277", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188033" Pubnub::Grant.any_instance.stub(:signature).and_return "YwnfK-JLfYpezbOIzwTWt7RGBANIPiGjX2r92pWX6K8=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/287", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188033" Pubnub::Grant.any_instance.stub(:signature).and_return "bVBg6pa66-mcB7tTk1QYm053SKxVTecFu2F2R0UoL_w=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/285", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188034" Pubnub::Grant.any_instance.stub(:signature).and_return "17-ZMuD1Kol4wWdfSBAK-dfIarhlR_17OMx-DwSPCQw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/286", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188034" Pubnub::Grant.any_instance.stub(:signature).and_return "17-ZMuD1Kol4wWdfSBAK-dfIarhlR_17OMx-DwSPCQw=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/284", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188035" Pubnub::Grant.any_instance.stub(:signature).and_return "_zvUfRf6ztwTVYE7cR-YqvKUws425BhOOqlM5kUn52M=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/282", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188036" Pubnub::Grant.any_instance.stub(:signature).and_return "av9R3z5fQ3N5gbfjLLRDJ5wDKz-G3ColZnbrr18SGjo=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/283", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188036" Pubnub::Grant.any_instance.stub(:signature).and_return "av9R3z5fQ3N5gbfjLLRDJ5wDKz-G3ColZnbrr18SGjo=" envelope = @pubnub.grant(channel: "demo", read: false, write: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/77", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188037" Pubnub::Grant.any_instance.stub(:signature).and_return "uwbcUGuWnHHKMQ5UbCAxlolUIKOorv2-RTHG-sryiYk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/75", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188037" Pubnub::Grant.any_instance.stub(:signature).and_return "uwbcUGuWnHHKMQ5UbCAxlolUIKOorv2-RTHG-sryiYk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/76", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188038" Pubnub::Grant.any_instance.stub(:signature).and_return "Alk0JwsCqVhSXc64BcpiaDw4lPC8wvktafwhbpnnXVg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/74", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188038" Pubnub::Grant.any_instance.stub(:signature).and_return "Alk0JwsCqVhSXc64BcpiaDw4lPC8wvktafwhbpnnXVg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/72", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188039" Pubnub::Grant.any_instance.stub(:signature).and_return "NiJtbZd16f81l0ItBnANhuticvUQ1x9k9VjO95UJUmQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/73", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188039" Pubnub::Grant.any_instance.stub(:signature).and_return "NiJtbZd16f81l0ItBnANhuticvUQ1x9k9VjO95UJUmQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/83", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188040" Pubnub::Grant.any_instance.stub(:signature).and_return "loUADwctW0ZFemKA7XSuVymKxfZ3oUydjI3lJq7dg4s=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/81", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188040" Pubnub::Grant.any_instance.stub(:signature).and_return "loUADwctW0ZFemKA7XSuVymKxfZ3oUydjI3lJq7dg4s=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/82", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188041" Pubnub::Grant.any_instance.stub(:signature).and_return "Sy24GrYlulrGr_UyxG4dHO3yptAqafQ0ZkprbSYhX4s=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/80", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188042" Pubnub::Grant.any_instance.stub(:signature).and_return "lHOP_hAORFsnOsQZXsZU4lpNUbCuGgZGbrfoC5PmQ8g=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/78", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188042" Pubnub::Grant.any_instance.stub(:signature).and_return "lHOP_hAORFsnOsQZXsZU4lpNUbCuGgZGbrfoC5PmQ8g=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/79", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188043" Pubnub::Grant.any_instance.stub(:signature).and_return "ZZBh_98EttiA_qNwPAt16IUC9SfIAFVPcLEj4OHwxB4=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/89", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188044" Pubnub::Grant.any_instance.stub(:signature).and_return "-gqSmtx1sq2P3q8ZnW5q2xBNYYJjUv1EC3K_m-2LPzw=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/87", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188044" Pubnub::Grant.any_instance.stub(:signature).and_return "-gqSmtx1sq2P3q8ZnW5q2xBNYYJjUv1EC3K_m-2LPzw=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/88", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188045" Pubnub::Grant.any_instance.stub(:signature).and_return "zuy3dHoPt52wwATMO1NGws7DOLFDCPQvk_kJaB_sSL4=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/86", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188045" Pubnub::Grant.any_instance.stub(:signature).and_return "zuy3dHoPt52wwATMO1NGws7DOLFDCPQvk_kJaB_sSL4=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/84", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188046" Pubnub::Grant.any_instance.stub(:signature).and_return "JSAWak2o_a2u9xkHkjKAzYcHYPNZKcpm31ryHAH0uAI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/85", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188046" Pubnub::Grant.any_instance.stub(:signature).and_return "JSAWak2o_a2u9xkHkjKAzYcHYPNZKcpm31ryHAH0uAI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/95", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188047" Pubnub::Grant.any_instance.stub(:signature).and_return "V0U28lS0bY2EgxOCaMs_ezmOYo1vxdCCMELC-YEZR4w=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/93", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188047" Pubnub::Grant.any_instance.stub(:signature).and_return "V0U28lS0bY2EgxOCaMs_ezmOYo1vxdCCMELC-YEZR4w=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/94", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188048" Pubnub::Grant.any_instance.stub(:signature).and_return "PKeKvnDq31eBT5RlCAOYBfHDBkwksHhjG6n0RS1jxV4=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/92", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188049" Pubnub::Grant.any_instance.stub(:signature).and_return "Mo980Nv9CvRv64uKVDG5hm1VndB3tKg1rgwNdFNOGxI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/90", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188049" Pubnub::Grant.any_instance.stub(:signature).and_return "Mo980Nv9CvRv64uKVDG5hm1VndB3tKg1rgwNdFNOGxI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/91", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188050" Pubnub::Grant.any_instance.stub(:signature).and_return "hWjvtbrlvpCAHnogtb9ogpleqQcjqY5BbdDcnAZG4rk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/101", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188050" Pubnub::Grant.any_instance.stub(:signature).and_return "_V49gZXSDusEvpTZE70wMvWsHEoqpZu8SUUF-kqifjg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/99", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188051" Pubnub::Grant.any_instance.stub(:signature).and_return "G1Mbxg1EjXVM5Xf2y8ymr-5CDI8SyEz1N8Mh3ZUglIE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/100", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188052" Pubnub::Grant.any_instance.stub(:signature).and_return "O4nllALLSzb8vs1JEtBW3hX3cPE0LKG7sEJA-hs-n8Y=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/98", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188052" Pubnub::Grant.any_instance.stub(:signature).and_return "O4nllALLSzb8vs1JEtBW3hX3cPE0LKG7sEJA-hs-n8Y=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/96", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188053" Pubnub::Grant.any_instance.stub(:signature).and_return "Jfq20pD6RbxlL4EpFgnMe68wfDNyk2MeZ1RcGL4bA2w=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/97", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188055" Pubnub::Grant.any_instance.stub(:signature).and_return "FumR3uwwriO6gi1uNfXCx3huJ9Eh3k1wYEoESxUqaYk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/107", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188056" Pubnub::Grant.any_instance.stub(:signature).and_return "kR0DcINzY7M4-YxbMMgh_Tp_upBlL7pu5Ytvj6Xk-SE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/105", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188056" Pubnub::Grant.any_instance.stub(:signature).and_return "kR0DcINzY7M4-YxbMMgh_Tp_upBlL7pu5Ytvj6Xk-SE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/106", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188057" Pubnub::Grant.any_instance.stub(:signature).and_return "8_qNr31zI41ZyNuAiT_o3hB6jcb5mrP_Uwtpenz-HwE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/104", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188057" Pubnub::Grant.any_instance.stub(:signature).and_return "8_qNr31zI41ZyNuAiT_o3hB6jcb5mrP_Uwtpenz-HwE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/102", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188058" Pubnub::Grant.any_instance.stub(:signature).and_return "vOZTWqPHYblcEuuwK_yozEf4FSdkULxekw_fpVix3ws=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/103", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188058" Pubnub::Grant.any_instance.stub(:signature).and_return "vOZTWqPHYblcEuuwK_yozEf4FSdkULxekw_fpVix3ws=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/5", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188059" Pubnub::Grant.any_instance.stub(:signature).and_return "XzM00MVENE4G2OGhRR7p4ktkMqrA7JwAu_U4bP1SdJA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/3", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188059" Pubnub::Grant.any_instance.stub(:signature).and_return "XzM00MVENE4G2OGhRR7p4ktkMqrA7JwAu_U4bP1SdJA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/4", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188060" Pubnub::Grant.any_instance.stub(:signature).and_return "ukc7y3Ey5ka4RsaXBF2YEd6bzP60BwV4GjifIGRdvBA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/2", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188061" Pubnub::Grant.any_instance.stub(:signature).and_return "GtVNdDLLmixD6lPFitgglWCWYvPSKOt34lyFd1ivADA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/0", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188061" Pubnub::Grant.any_instance.stub(:signature).and_return "GtVNdDLLmixD6lPFitgglWCWYvPSKOt34lyFd1ivADA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/1", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188062" Pubnub::Grant.any_instance.stub(:signature).and_return "iFa8issHWEVziacwGXEcYo2zTrDhSgEI6pVRDyTWLHY=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/11", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188062" Pubnub::Grant.any_instance.stub(:signature).and_return "ovoKvClthX_hzMvQPJ890uuK9l4HebBIMOhVmmxwETg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/9", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188063" Pubnub::Grant.any_instance.stub(:signature).and_return "zmNXnrhUKjFK9xYv4kMnNlGAPWIizE8kZjiWepvFZ_E=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/10", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188063" Pubnub::Grant.any_instance.stub(:signature).and_return "zmNXnrhUKjFK9xYv4kMnNlGAPWIizE8kZjiWepvFZ_E=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/8", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188064" Pubnub::Grant.any_instance.stub(:signature).and_return "IpjGtqucTPuVwrubW5vrsIzHU8jG5RK0fv-ELANYdFI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/6", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188064" Pubnub::Grant.any_instance.stub(:signature).and_return "IpjGtqucTPuVwrubW5vrsIzHU8jG5RK0fv-ELANYdFI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/7", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188065" Pubnub::Grant.any_instance.stub(:signature).and_return "AOKsjpmIfajAMKcTAahUsIZaM8k8nYpqxMMpW3rek44=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/17", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188066" Pubnub::Grant.any_instance.stub(:signature).and_return "J2z6ZaMOEll5QM6aQde0d4uSKxF0XcuzWhzWsX-_sGo=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/15", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188066" Pubnub::Grant.any_instance.stub(:signature).and_return "J2z6ZaMOEll5QM6aQde0d4uSKxF0XcuzWhzWsX-_sGo=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/16", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188067" Pubnub::Grant.any_instance.stub(:signature).and_return "ErUgGw5a_V_DHAGbRQRs6EMay6dUXTiqeSxUSt7-b2g=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/14", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188067" Pubnub::Grant.any_instance.stub(:signature).and_return "ErUgGw5a_V_DHAGbRQRs6EMay6dUXTiqeSxUSt7-b2g=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/12", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188068" Pubnub::Grant.any_instance.stub(:signature).and_return "-y69Exd_cG273RY5g9uTZjrm6qp3sTsir_1uVHbm0ts=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/13", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188068" Pubnub::Grant.any_instance.stub(:signature).and_return "-y69Exd_cG273RY5g9uTZjrm6qp3sTsir_1uVHbm0ts=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/23", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188069" Pubnub::Grant.any_instance.stub(:signature).and_return "HGXIV3RlTUbLW7QqvMSMnGa2YjC_uegyU9TaspCV07s=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/21", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188069" Pubnub::Grant.any_instance.stub(:signature).and_return "HGXIV3RlTUbLW7QqvMSMnGa2YjC_uegyU9TaspCV07s=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/22", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188070" Pubnub::Grant.any_instance.stub(:signature).and_return "Vd4o4dbnZ7rn9z_hUFbBY1BcIl8cWut5h_w9-a9CPcA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/20", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188070" Pubnub::Grant.any_instance.stub(:signature).and_return "Vd4o4dbnZ7rn9z_hUFbBY1BcIl8cWut5h_w9-a9CPcA=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/18", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188071" Pubnub::Grant.any_instance.stub(:signature).and_return "DoIargOS07VFfc5PBf-JMJZdXQ5YsawsiGdvYaAnR_M=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/19", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188071" Pubnub::Grant.any_instance.stub(:signature).and_return "DoIargOS07VFfc5PBf-JMJZdXQ5YsawsiGdvYaAnR_M=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/29", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188072" Pubnub::Grant.any_instance.stub(:signature).and_return "cneNp2ESiSS2vrvfV0g_qp_aB-HtH_X3k4UtwojAWzk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/27", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188072" Pubnub::Grant.any_instance.stub(:signature).and_return "cneNp2ESiSS2vrvfV0g_qp_aB-HtH_X3k4UtwojAWzk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/28", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188073" Pubnub::Grant.any_instance.stub(:signature).and_return "w9cGp6enPxaPWlMyJvGa0KDD7Jt-DGJUR7IcR9LVM1I=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/26", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188073" Pubnub::Grant.any_instance.stub(:signature).and_return "w9cGp6enPxaPWlMyJvGa0KDD7Jt-DGJUR7IcR9LVM1I=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/24", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188074" Pubnub::Grant.any_instance.stub(:signature).and_return "AcoAi8XPc99UA-AgwUu_5f2nhCMGw9f3xB0C2TJVR6Q=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/25", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188075" Pubnub::Grant.any_instance.stub(:signature).and_return "-DURpzVUgoTJfnnX-F2TROlnMubSirw__uKWL93g-fQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/35", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188075" Pubnub::Grant.any_instance.stub(:signature).and_return "VhVH0xn5pS5ZKlBjgp2t3P0hDQ1nToHSU_paYB70l3I=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/33", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188076" Pubnub::Grant.any_instance.stub(:signature).and_return "kIOeA_hgn6EXXOrDvR4xaT61B4UCSafUssPUxgvAjxk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/34", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188076" Pubnub::Grant.any_instance.stub(:signature).and_return "kIOeA_hgn6EXXOrDvR4xaT61B4UCSafUssPUxgvAjxk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/32", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188077" Pubnub::Grant.any_instance.stub(:signature).and_return "XUqHqwRAmY5d7ftuA6x_aPoKjLYeEzNQHQIPYElRt6k=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/30", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188077" Pubnub::Grant.any_instance.stub(:signature).and_return "XUqHqwRAmY5d7ftuA6x_aPoKjLYeEzNQHQIPYElRt6k=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/31", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188078" Pubnub::Grant.any_instance.stub(:signature).and_return "xHJrW3a25oMwzDSmN0OuDe1Fkg4nEcw1Eg6Fkge3Z5w=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/41", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188078" Pubnub::Grant.any_instance.stub(:signature).and_return "P-ol7w2SrPub6-H0G_wcqepDshpzxK67Ma7BUG28JH4=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/39", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188079" Pubnub::Grant.any_instance.stub(:signature).and_return "OkcRDbTkiEmoEM4PbyhmoUY48ALbCGYFiaBC-kYMSss=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/40", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188079" Pubnub::Grant.any_instance.stub(:signature).and_return "OkcRDbTkiEmoEM4PbyhmoUY48ALbCGYFiaBC-kYMSss=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/38", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188080" Pubnub::Grant.any_instance.stub(:signature).and_return "IHBTIQ5xObXBfl5r6aP3v2XQjMAGlorYHbZCCSiNQ5g=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/36", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188081" Pubnub::Grant.any_instance.stub(:signature).and_return "xdpq-Rr5sSZ4Q7EfPRe_hnxMmDVoh8MExQDpoqAMPgk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/37", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188081" Pubnub::Grant.any_instance.stub(:signature).and_return "xdpq-Rr5sSZ4Q7EfPRe_hnxMmDVoh8MExQDpoqAMPgk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/47", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188082" Pubnub::Grant.any_instance.stub(:signature).and_return "qZBKKv-xjOLGV42je9W-tZZQl1QaTCuTCHZTDYx-wNE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/45", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188082" Pubnub::Grant.any_instance.stub(:signature).and_return "qZBKKv-xjOLGV42je9W-tZZQl1QaTCuTCHZTDYx-wNE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/46", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188083" Pubnub::Grant.any_instance.stub(:signature).and_return "hS_PwqDvY0XUe4u3V2QNMwokZbUTo0-T47RfaQesJaE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/44", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188083" Pubnub::Grant.any_instance.stub(:signature).and_return "hS_PwqDvY0XUe4u3V2QNMwokZbUTo0-T47RfaQesJaE=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/42", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188084" Pubnub::Grant.any_instance.stub(:signature).and_return "i7fco65dr6y4PnX9fP9s84FeWvf0RgRLUFCA_A72Rcw=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/43", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188084" Pubnub::Grant.any_instance.stub(:signature).and_return "i7fco65dr6y4PnX9fP9s84FeWvf0RgRLUFCA_A72Rcw=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/53", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188085" Pubnub::Grant.any_instance.stub(:signature).and_return "0FCEsEN7FK6Kz3vi4c_QHz4vnPKSZWleI7J-spQbpdg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/51", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188085" Pubnub::Grant.any_instance.stub(:signature).and_return "0FCEsEN7FK6Kz3vi4c_QHz4vnPKSZWleI7J-spQbpdg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/52", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188086" Pubnub::Grant.any_instance.stub(:signature).and_return "Av-kv19bu3-yJ8PXRWKbkBiwiBNK9LMvP11FbMiolXQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/50", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188087" Pubnub::Grant.any_instance.stub(:signature).and_return "8zrK8uHRCTYCKblTEofF6-FJrderYziGobGD9naWaug=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/48", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188087" Pubnub::Grant.any_instance.stub(:signature).and_return "8zrK8uHRCTYCKblTEofF6-FJrderYziGobGD9naWaug=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/49", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188088" Pubnub::Grant.any_instance.stub(:signature).and_return "6Thok8KJKYn6mXNxxzgRTQNVyj1Sz0fgdAhAN33SjJg=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/59", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188088" Pubnub::Grant.any_instance.stub(:signature).and_return "ABkAIjSdzMWLHunbymbu2S4SBCEGWuMkwlsil_i0hnc=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/57", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188089" Pubnub::Grant.any_instance.stub(:signature).and_return "_s6QOKJhG9cxFAaFQVC28rn9BA1KQHltoVWIkdvj4aU=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/58", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188089" Pubnub::Grant.any_instance.stub(:signature).and_return "_s6QOKJhG9cxFAaFQVC28rn9BA1KQHltoVWIkdvj4aU=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/56", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188090" Pubnub::Grant.any_instance.stub(:signature).and_return "DdWtshevLGwgpfgzgaYRhS38Al75eyKuSP8UY7Xeq8M=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/54", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188090" Pubnub::Grant.any_instance.stub(:signature).and_return "DdWtshevLGwgpfgzgaYRhS38Al75eyKuSP8UY7Xeq8M=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/55", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188091" Pubnub::Grant.any_instance.stub(:signature).and_return "ApmGB2jQ-UOzQXFEMdxJUqLhxGQEghICpbS0m5MjxTQ=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/65", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188091" Pubnub::Grant.any_instance.stub(:signature).and_return "F0SvctSp46owlBuwyWst9tdd8SRdURH6UdZ-HLXANU8=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/63", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188092" Pubnub::Grant.any_instance.stub(:signature).and_return "Fpl4Nn9IGOqa1wZJo8OZOeiVvwLp6DSz320FEaS2iHo=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/64", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188092" Pubnub::Grant.any_instance.stub(:signature).and_return "Fpl4Nn9IGOqa1wZJo8OZOeiVvwLp6DSz320FEaS2iHo=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/62", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188093" Pubnub::Grant.any_instance.stub(:signature).and_return "p0i476avkv8MjNvIyxTm3x2sDdq95HptDzi3kvG_C5E=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/60", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188094" Pubnub::Grant.any_instance.stub(:signature).and_return "MBBK_2eTD6Jc2ZhQ3HzeTnq44h-gIAoiMPkWeuV-MjI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/61", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188094" Pubnub::Grant.any_instance.stub(:signature).and_return "MBBK_2eTD6Jc2ZhQ3HzeTnq44h-gIAoiMPkWeuV-MjI=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/71", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188095" Pubnub::Grant.any_instance.stub(:signature).and_return "hvDm9hLKLmCQIuVBmhmxgc8qLLZjv1n4k5kriQKagmU=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/69", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188095" Pubnub::Grant.any_instance.stub(:signature).and_return "hvDm9hLKLmCQIuVBmhmxgc8qLLZjv1n4k5kriQKagmU=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/70", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188096" Pubnub::Grant.any_instance.stub(:signature).and_return "0LbHlJLvLf0GQWvxmyAKk5wwBBKPg6md7zH3qNZzgMw=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/68", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188096" Pubnub::Grant.any_instance.stub(:signature).and_return "0LbHlJLvLf0GQWvxmyAKk5wwBBKPg6md7zH3qNZzgMw=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/66", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188097" Pubnub::Grant.any_instance.stub(:signature).and_return "C7EVzCjsi-iyrmNg7f1gmzyFVwPjcPK3wOoDM3x2Isk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/67", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188097" Pubnub::Grant.any_instance.stub(:signature).and_return "C7EVzCjsi-iyrmNg7f1gmzyFVwPjcPK3wOoDM3x2Isk=" envelope = @pubnub.grant(channel: "demo", read: false, write: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/185", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188098" Pubnub::Grant.any_instance.stub(:signature).and_return "HjzXjtm8Q1HQfyTuGzKBNxaiwAAvFL_bfJGtC_6P0r4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/183", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188098" Pubnub::Grant.any_instance.stub(:signature).and_return "HjzXjtm8Q1HQfyTuGzKBNxaiwAAvFL_bfJGtC_6P0r4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/184", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188099" Pubnub::Grant.any_instance.stub(:signature).and_return "BcdTv6-ec6jA10hKhF3gqO2qbYTV6_rUSYoOhZlk4jM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/182", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188099" Pubnub::Grant.any_instance.stub(:signature).and_return "BcdTv6-ec6jA10hKhF3gqO2qbYTV6_rUSYoOhZlk4jM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/180", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188100" Pubnub::Grant.any_instance.stub(:signature).and_return "slIpkHCWjp8oehx3-8hwFCX3fAsAk0NJSLLK6kyuqJI=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/181", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188100" Pubnub::Grant.any_instance.stub(:signature).and_return "slIpkHCWjp8oehx3-8hwFCX3fAsAk0NJSLLK6kyuqJI=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/191", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188101" Pubnub::Grant.any_instance.stub(:signature).and_return "2-wqMYp0EMoGJF6WCS5POokWThz2-7cs36IJkCCrqU0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/189", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188101" Pubnub::Grant.any_instance.stub(:signature).and_return "2-wqMYp0EMoGJF6WCS5POokWThz2-7cs36IJkCCrqU0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/190", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188102" Pubnub::Grant.any_instance.stub(:signature).and_return "swTtFK_oyQAem1g4TYN15YJmecgy7p6XC3yabOWzLII=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/188", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188103" Pubnub::Grant.any_instance.stub(:signature).and_return "n1mdxIrQ4pwNtFmv_me_243agsn5nauXdnYOHCc1l-4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/186", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188103" Pubnub::Grant.any_instance.stub(:signature).and_return "n1mdxIrQ4pwNtFmv_me_243agsn5nauXdnYOHCc1l-4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/187", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188104" Pubnub::Grant.any_instance.stub(:signature).and_return "QqJQglgHHh16MBilj1KoZV6sflKtgPpo2eaFqWahcig=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/197", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188104" Pubnub::Grant.any_instance.stub(:signature).and_return "DKKSLnhhR2XXFsms3mTdzZY0r3xVQFJd8wthaBjwKtY=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/195", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188105" Pubnub::Grant.any_instance.stub(:signature).and_return "BmRFJrU4P-vnN83P2-A3lIVMfZq1uCPQsHG05Gz9V7Y=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/196", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188105" Pubnub::Grant.any_instance.stub(:signature).and_return "BmRFJrU4P-vnN83P2-A3lIVMfZq1uCPQsHG05Gz9V7Y=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/194", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188106" Pubnub::Grant.any_instance.stub(:signature).and_return "b810SyMljXRbFV9dCw_BkzeXiVURRG02gqqd1lXgvjM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/192", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188106" Pubnub::Grant.any_instance.stub(:signature).and_return "b810SyMljXRbFV9dCw_BkzeXiVURRG02gqqd1lXgvjM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/193", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188107" Pubnub::Grant.any_instance.stub(:signature).and_return "47NmRNdaBSeL9BvUG3SlkTl8eSHcrRJmp9rLxuVa058=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/203", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188107" Pubnub::Grant.any_instance.stub(:signature).and_return "MU-Kx_LcjlYIL99nL4E-Q57CIjlZn0L-70gyamgq0sM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/201", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188108" Pubnub::Grant.any_instance.stub(:signature).and_return "g6-2dTqXDuNAyFXWdFTeY2Z8izwaL_Dble83mvaHtf0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/202", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188108" Pubnub::Grant.any_instance.stub(:signature).and_return "g6-2dTqXDuNAyFXWdFTeY2Z8izwaL_Dble83mvaHtf0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/200", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188109" Pubnub::Grant.any_instance.stub(:signature).and_return "srjUZIU0qhRe2QRWCNnzugMXePWxTFCFyjRpsrbuHVQ=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/198", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188109" Pubnub::Grant.any_instance.stub(:signature).and_return "srjUZIU0qhRe2QRWCNnzugMXePWxTFCFyjRpsrbuHVQ=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/199", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188110" Pubnub::Grant.any_instance.stub(:signature).and_return "8Xh_Jw6jzaR53hJ7YhyGHlZoDOviExSW1Qbfhtg09xM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/209", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188110" Pubnub::Grant.any_instance.stub(:signature).and_return "kAOk3PO8i3pK7UTHjnW081j_J-1RzxSqaQVwC-JwQdQ=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/207", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188111" Pubnub::Grant.any_instance.stub(:signature).and_return "eNm443rIgvX8EWmJQxvNIv_rM9-lQzLt3pxYSjqveyM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/208", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188112" Pubnub::Grant.any_instance.stub(:signature).and_return "cjfHp2oN98C8KsyFlZkNQ_mSCiCGonQMtxiaRmrKapw=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/206", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188112" Pubnub::Grant.any_instance.stub(:signature).and_return "cjfHp2oN98C8KsyFlZkNQ_mSCiCGonQMtxiaRmrKapw=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/204", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188113" Pubnub::Grant.any_instance.stub(:signature).and_return "5mxPLF7usF1Ii6Rqbk_dHECKTPIlmP5WaqK1dBlCsCw=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/205", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188113" Pubnub::Grant.any_instance.stub(:signature).and_return "5mxPLF7usF1Ii6Rqbk_dHECKTPIlmP5WaqK1dBlCsCw=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/215", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188114" Pubnub::Grant.any_instance.stub(:signature).and_return "AiWkp39IZ4tQ2pFi8gzbpxNVI2YlDfgrcExfBd0TdT0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/213", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188114" Pubnub::Grant.any_instance.stub(:signature).and_return "AiWkp39IZ4tQ2pFi8gzbpxNVI2YlDfgrcExfBd0TdT0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/214", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188115" Pubnub::Grant.any_instance.stub(:signature).and_return "wTRajBaWF7lhnQsPvR_LNIsVT25tRksEeLlHIVC0zzU=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/212", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188115" Pubnub::Grant.any_instance.stub(:signature).and_return "wTRajBaWF7lhnQsPvR_LNIsVT25tRksEeLlHIVC0zzU=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/210", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188116" Pubnub::Grant.any_instance.stub(:signature).and_return "xF794kakC9l8BzUnwuNzn8A-7yiiSVvr-8I9qqoceL8=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/211", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188116" Pubnub::Grant.any_instance.stub(:signature).and_return "xF794kakC9l8BzUnwuNzn8A-7yiiSVvr-8I9qqoceL8=" envelope = @pubnub.grant(channel: "demo", read: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/113", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188117" Pubnub::Grant.any_instance.stub(:signature).and_return "uPzZIqr5MXAVJSNzSBYr3cba-PF6jzYzPnXmDH6fzhI=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/111", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188118" Pubnub::Grant.any_instance.stub(:signature).and_return "zc6SKdS51QSXPsq_qIfYpnZaEDdUocgEbPi8il4Rst4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/112", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188118" Pubnub::Grant.any_instance.stub(:signature).and_return "zc6SKdS51QSXPsq_qIfYpnZaEDdUocgEbPi8il4Rst4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/110", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188119" Pubnub::Grant.any_instance.stub(:signature).and_return "D5598q2tVPe_qZC_uBynCZ7Y1XJeDpc40NnvItx_ah4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/108", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188119" Pubnub::Grant.any_instance.stub(:signature).and_return "D5598q2tVPe_qZC_uBynCZ7Y1XJeDpc40NnvItx_ah4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/109", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188120" Pubnub::Grant.any_instance.stub(:signature).and_return "zHEeCkdfTOhttube3aD-JQELfmykCzaCxt6NkG4MGG4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/119", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188120" Pubnub::Grant.any_instance.stub(:signature).and_return "_CQNWDuI90uvDm9imS2myKOKF-epftS0NTUVBXF9C9s=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/117", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188121" Pubnub::Grant.any_instance.stub(:signature).and_return "jL-HzimKonWstrWODyeC1cj94VyWQsT0QfNeESTJKJY=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/118", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188121" Pubnub::Grant.any_instance.stub(:signature).and_return "jL-HzimKonWstrWODyeC1cj94VyWQsT0QfNeESTJKJY=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/116", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188122" Pubnub::Grant.any_instance.stub(:signature).and_return "9YdNFUsf2iJYzZZyt3uDFaUnNETgI_zrWqGfBo2Pgbc=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/114", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188122" Pubnub::Grant.any_instance.stub(:signature).and_return "9YdNFUsf2iJYzZZyt3uDFaUnNETgI_zrWqGfBo2Pgbc=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/115", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188123" Pubnub::Grant.any_instance.stub(:signature).and_return "eWfAWZTitF5NKfh-amZLUZLkO0vJ7ccbjvXNb_6NM3o=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/125", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188123" Pubnub::Grant.any_instance.stub(:signature).and_return "OCOl1IRWMKm6QdaacicXGGaHXw3x4JQp4LaWxUxrOeg=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/123", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188124" Pubnub::Grant.any_instance.stub(:signature).and_return "PPp-c-ikqOqvSK8RW97Ni1q9E7uWaVGPPXTXJEtIQqs=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/124", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188125" Pubnub::Grant.any_instance.stub(:signature).and_return "3X-MYYw4eFg4mNyok4fDRWYKcMznPnZp13b39zJun4s=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/122", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188126" Pubnub::Grant.any_instance.stub(:signature).and_return "2CQV6lkRXFL0qCkeYFAqDZa1qyud8biCQec-3BfKBwE=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/120", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188127" Pubnub::Grant.any_instance.stub(:signature).and_return "Chwy8JicsUCZ59j8FKWI90g7uar-ZLHTS1UNZWTek5s=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/121", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188127" Pubnub::Grant.any_instance.stub(:signature).and_return "Chwy8JicsUCZ59j8FKWI90g7uar-ZLHTS1UNZWTek5s=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/131", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188128" Pubnub::Grant.any_instance.stub(:signature).and_return "c4k6OKw2WpqYXW1cgIBcy5XHgAKpqWsVkFGHlPQNkvA=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/129", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188128" Pubnub::Grant.any_instance.stub(:signature).and_return "c4k6OKw2WpqYXW1cgIBcy5XHgAKpqWsVkFGHlPQNkvA=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/130", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188129" Pubnub::Grant.any_instance.stub(:signature).and_return "LZd6KM-j76hbEaRyzozY7Ert5S9Nq8SD_HMM9CwFZIE=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/128", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188130" Pubnub::Grant.any_instance.stub(:signature).and_return "JeVkt376RqhL_5k7axirVFDPJxc_x-ItL45zrO6d8V0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/126", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188130" Pubnub::Grant.any_instance.stub(:signature).and_return "JeVkt376RqhL_5k7axirVFDPJxc_x-ItL45zrO6d8V0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/127", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188131" Pubnub::Grant.any_instance.stub(:signature).and_return "y65JBbezx3phyazoB3B7OWb2tSYoH7m357yH3h61uxg=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/137", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188131" Pubnub::Grant.any_instance.stub(:signature).and_return "ieC62QEilIQGP04ums2PWSUaqo8jNT-JgRlX4kYyYrU=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/135", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188132" Pubnub::Grant.any_instance.stub(:signature).and_return "y-HmtyaW2GLhg6wbANNrVWdmJCesLXjkt-CfZo4cyj4=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/136", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188133" Pubnub::Grant.any_instance.stub(:signature).and_return "xoqOohJ0yRNjfnS-cT7UbMvgtMxfuhfxevGsWPARYRw=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/134", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188133" Pubnub::Grant.any_instance.stub(:signature).and_return "xoqOohJ0yRNjfnS-cT7UbMvgtMxfuhfxevGsWPARYRw=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/132", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188134" Pubnub::Grant.any_instance.stub(:signature).and_return "3mJ_4LrbC-icOM-9tE1W15lL_jvz62aQwG9f4sup1Yo=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/133", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188134" Pubnub::Grant.any_instance.stub(:signature).and_return "3mJ_4LrbC-icOM-9tE1W15lL_jvz62aQwG9f4sup1Yo=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/143", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188135" Pubnub::Grant.any_instance.stub(:signature).and_return "VDJezdhU6HykKfLg5WbsgDJrnd_zlOeHJUC9HxXp7BM=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/141", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188136" Pubnub::Grant.any_instance.stub(:signature).and_return "p3F1-QZfsnWkSb3qr6cIbl7j8jN936Im9qzgkun3II0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/142", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188136" Pubnub::Grant.any_instance.stub(:signature).and_return "p3F1-QZfsnWkSb3qr6cIbl7j8jN936Im9qzgkun3II0=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/140", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188137" Pubnub::Grant.any_instance.stub(:signature).and_return "7l-f9hLqG_ulMdEgEWFsEaEMlAXiGNoUvWIDSd7W29g=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/138", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188138" Pubnub::Grant.any_instance.stub(:signature).and_return "TOsNuBKmZ4bhzqR8hr7bVVC1wUV2X6N5-gz81ef8ExU=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/139", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188138" Pubnub::Grant.any_instance.stub(:signature).and_return "TOsNuBKmZ4bhzqR8hr7bVVC1wUV2X6N5-gz81ef8ExU=" envelope = @pubnub.grant(channel: "demo", read: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/149", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188139" Pubnub::Grant.any_instance.stub(:signature).and_return "eJxeIKFLtiGzKHljrI08tIgoWHVOuL52Ac45osBdQN8=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/147", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188139" Pubnub::Grant.any_instance.stub(:signature).and_return "eJxeIKFLtiGzKHljrI08tIgoWHVOuL52Ac45osBdQN8=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/148", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188140" Pubnub::Grant.any_instance.stub(:signature).and_return "FJTxlj8HhP59RoPcscPRkpTQ8dmgEkh07eDcALtsL9Y=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/146", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188140" Pubnub::Grant.any_instance.stub(:signature).and_return "FJTxlj8HhP59RoPcscPRkpTQ8dmgEkh07eDcALtsL9Y=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/144", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188141" Pubnub::Grant.any_instance.stub(:signature).and_return "bISTyCmlCyW703o5v3oWWdiIFGEncxoUiCFGf5-7MsM=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/145", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188142" Pubnub::Grant.any_instance.stub(:signature).and_return "NGlTROHWWm3HD6QW4YOCw1duLNJ4EEDg5_4CQlfMTYM=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/155", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188142" Pubnub::Grant.any_instance.stub(:signature).and_return "8YRJxh2-PtXXVgpzyiJ3xJPWZhnlnC16sXtYFOBqcaw=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/153", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188143" Pubnub::Grant.any_instance.stub(:signature).and_return "8UCuku1fa0OS5aiIh-kKgmBufGq1476R6qWlk5n3eL4=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/154", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188143" Pubnub::Grant.any_instance.stub(:signature).and_return "8UCuku1fa0OS5aiIh-kKgmBufGq1476R6qWlk5n3eL4=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/152", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188144" Pubnub::Grant.any_instance.stub(:signature).and_return "MY1SKSnLfYTnK82s651qRlGBgsEKGpokQPhi7q6VQ8o=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/150", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188144" Pubnub::Grant.any_instance.stub(:signature).and_return "MY1SKSnLfYTnK82s651qRlGBgsEKGpokQPhi7q6VQ8o=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/151", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188145" Pubnub::Grant.any_instance.stub(:signature).and_return "W-H7TLUpMQ4XhB2JbwMKlS0wISDpP1R_76ZyfKFG6_8=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/161", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188146" Pubnub::Grant.any_instance.stub(:signature).and_return "Ht8btfcnC3CaWVajsoIu5wQfIFPzqQpU-iDqevEGKfA=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/159", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188146" Pubnub::Grant.any_instance.stub(:signature).and_return "Ht8btfcnC3CaWVajsoIu5wQfIFPzqQpU-iDqevEGKfA=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/160", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188147" Pubnub::Grant.any_instance.stub(:signature).and_return "mWws2P4eG9YZ6e2A8UqOE7dSECyHKBlBU-LxU4Z6wao=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/158", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188147" Pubnub::Grant.any_instance.stub(:signature).and_return "mWws2P4eG9YZ6e2A8UqOE7dSECyHKBlBU-LxU4Z6wao=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/156", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188148" Pubnub::Grant.any_instance.stub(:signature).and_return "Fke2P-M-4RyOJ6AxrfsrYn7TcGa9DVmzAh3F1Cl4AmM=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/157", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188149" Pubnub::Grant.any_instance.stub(:signature).and_return "PnevhhbegGaS7HKeFdgAhwA-Xhq5Q0P7buK4Qiq1li4=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/167", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188149" Pubnub::Grant.any_instance.stub(:signature).and_return "UPrJliawc6NJkBprRYpdvNezVxkXU3W6er3WtE8M2Lc=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/165", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188150" Pubnub::Grant.any_instance.stub(:signature).and_return "tYFsG84i5MTc-wmBXNwjz6sUoK30qZANOl9-NrA8RVo=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/166", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188151" Pubnub::Grant.any_instance.stub(:signature).and_return "movrA0D5nJHyShcaFDnbt4wwPp9ggoT-ux_-h-7owsw=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/164", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188151" Pubnub::Grant.any_instance.stub(:signature).and_return "movrA0D5nJHyShcaFDnbt4wwPp9ggoT-ux_-h-7owsw=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/162", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188152" Pubnub::Grant.any_instance.stub(:signature).and_return "aAacL7LXpmzEyhzxe-8htStRO5uW_EAz1yxIXdPpx0U=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/163", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188153" Pubnub::Grant.any_instance.stub(:signature).and_return "ElFDb3VA00spzuXc8ojd40UPyVJp11hyFsoQxDsJQNQ=" envelope = @pubnub.grant(channel: "demo", read: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/173", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188153" Pubnub::Grant.any_instance.stub(:signature).and_return "gMyLVKvV5w-w4bmS8COeHv_ekt_TcfBSg6DrdBVbfk8=" envelope = @pubnub.grant(channel: "demo", read: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/171", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188154" Pubnub::Grant.any_instance.stub(:signature).and_return "etMRzx2Zun9CZUx6gKQAFX_hGhwdXGp-1_D6DyCdJeI=" envelope = @pubnub.grant(channel: "demo", read: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/172", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188154" Pubnub::Grant.any_instance.stub(:signature).and_return "etMRzx2Zun9CZUx6gKQAFX_hGhwdXGp-1_D6DyCdJeI=" envelope = @pubnub.grant(channel: "demo", read: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/170", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188155" Pubnub::Grant.any_instance.stub(:signature).and_return "yRx4Cw4wtO5s_uhhCc1bO4fq1_lYw8nDlDFO_f9t8wk=" envelope = @pubnub.grant(channel: "demo", read: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/168", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188155" Pubnub::Grant.any_instance.stub(:signature).and_return "yRx4Cw4wtO5s_uhhCc1bO4fq1_lYw8nDlDFO_f9t8wk=" envelope = @pubnub.grant(channel: "demo", read: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/169", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188156" Pubnub::Grant.any_instance.stub(:signature).and_return "_Ujiw6dpww3seQcw_NVPPkwJzAwYjQD_SwnHGr8gWe4=" envelope = @pubnub.grant(channel: "demo", read: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/179", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188157" Pubnub::Grant.any_instance.stub(:signature).and_return "UxZX3RrY8s3i1fnjKkcxHdPWhQGeXflTLO6OUiQTZ4A=" envelope = @pubnub.grant(channel: "demo", read: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/177", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188157" Pubnub::Grant.any_instance.stub(:signature).and_return "UxZX3RrY8s3i1fnjKkcxHdPWhQGeXflTLO6OUiQTZ4A=" envelope = @pubnub.grant(channel: "demo", read: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/178", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188158" Pubnub::Grant.any_instance.stub(:signature).and_return "In4_0ABxbSI1MYPczxpPE1am-W2VpYAixk0rbxa3_DI=" envelope = @pubnub.grant(channel: "demo", read: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/176", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188158" Pubnub::Grant.any_instance.stub(:signature).and_return "In4_0ABxbSI1MYPczxpPE1am-W2VpYAixk0rbxa3_DI=" envelope = @pubnub.grant(channel: "demo", read: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/174", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188159" Pubnub::Grant.any_instance.stub(:signature).and_return "nuo_nzdQjLxSpAaOLTlDmDYgWqqAAqBj1CyuKQS7lLY=" envelope = @pubnub.grant(channel: "demo", read: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__false___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/175", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188160" Pubnub::Grant.any_instance.stub(:signature).and_return "aR3hFPzHT4ZJrvfAMCLqEi1caHamtLnliFBZx8-AETo=" envelope = @pubnub.grant(channel: "demo", read: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 0, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/617", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188160" Pubnub::Grant.any_instance.stub(:signature).and_return "_VIeSPCgF9BrmdiVa47iDMaJeN6wJAKggZM93KOQTr4=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/615", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188161" Pubnub::Grant.any_instance.stub(:signature).and_return "rFisaHoIjhtf22xKJTDRx96QxiNMikHAIRFHSjf4UvI=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/616", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188161" Pubnub::Grant.any_instance.stub(:signature).and_return "rFisaHoIjhtf22xKJTDRx96QxiNMikHAIRFHSjf4UvI=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/614", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188162" Pubnub::Grant.any_instance.stub(:signature).and_return "CY4vFAxkCuXiDVxizII7Htuzf1AGlgKPfD5WTnoTRX4=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/612", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188162" Pubnub::Grant.any_instance.stub(:signature).and_return "CY4vFAxkCuXiDVxizII7Htuzf1AGlgKPfD5WTnoTRX4=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/613", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188163" Pubnub::Grant.any_instance.stub(:signature).and_return "LSIKNS9izEjd1w6Yc6U4SUNRvm5kCe_QIjVrZqocywc=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/623", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188164" Pubnub::Grant.any_instance.stub(:signature).and_return "FYKJx-SLLSn0-RAGQKiiGZdykHq7kxHDHNV2mvmCpE8=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/621", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188165" Pubnub::Grant.any_instance.stub(:signature).and_return "O-DkRHTazvdNgsM5cRbz4iAFRcJifLfEMytcZXrLZd0=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/622", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188165" Pubnub::Grant.any_instance.stub(:signature).and_return "O-DkRHTazvdNgsM5cRbz4iAFRcJifLfEMytcZXrLZd0=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/620", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188166" Pubnub::Grant.any_instance.stub(:signature).and_return "zZmHLGy2PWGOb8JgZ58YmFPoHlnYlmm7S8JGOzGqzVs=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/618", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188166" Pubnub::Grant.any_instance.stub(:signature).and_return "zZmHLGy2PWGOb8JgZ58YmFPoHlnYlmm7S8JGOzGqzVs=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/619", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188167" Pubnub::Grant.any_instance.stub(:signature).and_return "FBqFZXPguTpq9sVbkQCvlC6edgXWbVE9LyaJljwoWw0=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/629", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188168" Pubnub::Grant.any_instance.stub(:signature).and_return "Pjdt0Lcf--JabeThSOfhUGcTylZvqbtWbwx05-XhfVg=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/627", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188168" Pubnub::Grant.any_instance.stub(:signature).and_return "Pjdt0Lcf--JabeThSOfhUGcTylZvqbtWbwx05-XhfVg=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/628", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188169" Pubnub::Grant.any_instance.stub(:signature).and_return "4s5og1_idvKlDuFcdO8l6cK9U7J04KQ-mOqZSLO-o7k=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/626", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188169" Pubnub::Grant.any_instance.stub(:signature).and_return "4s5og1_idvKlDuFcdO8l6cK9U7J04KQ-mOqZSLO-o7k=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/624", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188170" Pubnub::Grant.any_instance.stub(:signature).and_return "lqjXdTkXNbmnT7XvoKwVManJDFQHpOhaFEFAtL9DWAQ=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/625", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188171" Pubnub::Grant.any_instance.stub(:signature).and_return "XQhHhqx5I1sCw8KWrhZT7XdAD5-a5jI0PNrlWUgCfWU=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/635", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188171" Pubnub::Grant.any_instance.stub(:signature).and_return "oeUS2V61AXZHnpulOifZ5NF4saBbx-zMDWTYbZnBJEU=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/633", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188172" Pubnub::Grant.any_instance.stub(:signature).and_return "5XOHX5Xr91sTPnxrv7PhiY-7QalrrdYNDvsxo4QUKv4=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/634", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188173" Pubnub::Grant.any_instance.stub(:signature).and_return "X7juCtEXP7UsKbzQ2ffdFH-MWGkBt4tT4TmS7S9Wk1g=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/632", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188174" Pubnub::Grant.any_instance.stub(:signature).and_return "Ihc7daLIaUQAUVHmwrMw_DuGOmT5Ro9bLhV47C3pynM=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/630", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188174" Pubnub::Grant.any_instance.stub(:signature).and_return "Ihc7daLIaUQAUVHmwrMw_DuGOmT5Ro9bLhV47C3pynM=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/631", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188175" Pubnub::Grant.any_instance.stub(:signature).and_return "th53MO5igW5swxizEtTH7FqeIM70rN1ZvnjUwQrgf_M=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/641", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188175" Pubnub::Grant.any_instance.stub(:signature).and_return "x9pVKjVJlIVIk4kZAW6mgoeFWiB4B7DL45KY5udkVNw=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/639", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188176" Pubnub::Grant.any_instance.stub(:signature).and_return "EpF_HUEGZTdmQ94aRpRNVSAq0qSEQj7yU0xDcc5A8VQ=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/640", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188176" Pubnub::Grant.any_instance.stub(:signature).and_return "EpF_HUEGZTdmQ94aRpRNVSAq0qSEQj7yU0xDcc5A8VQ=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/638", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188177" Pubnub::Grant.any_instance.stub(:signature).and_return "rrOCYjP3nW3m0PEk65bmz8nRPFJM-1VnY2HxJWEu6no=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/636", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188178" Pubnub::Grant.any_instance.stub(:signature).and_return "7HpqYR11PrjHAifmLY3pGIp1oBZp8ppVhlInDU15408=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/637", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188178" Pubnub::Grant.any_instance.stub(:signature).and_return "7HpqYR11PrjHAifmLY3pGIp1oBZp8ppVhlInDU15408=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/647", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188179" Pubnub::Grant.any_instance.stub(:signature).and_return "M_bfZXF14bCkF5y9twoV0fa7A-t18Tpv4n6Jqd2fuCs=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/645", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188180" Pubnub::Grant.any_instance.stub(:signature).and_return "ytymleANFemmDlvkLyFye8_SjzibmtiB08rB9QHMQ2M=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/646", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188181" Pubnub::Grant.any_instance.stub(:signature).and_return "IggxQZCUxEfFnXxyrKOTTsjAuIF0YeRBeFWtulvVE2c=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/644", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188181" Pubnub::Grant.any_instance.stub(:signature).and_return "IggxQZCUxEfFnXxyrKOTTsjAuIF0YeRBeFWtulvVE2c=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/642", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188182" Pubnub::Grant.any_instance.stub(:signature).and_return "VaEANDu0eOpJcz4p8DH_iHb9lvtCUoj8fnkQVPCrO5U=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/643", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188183" Pubnub::Grant.any_instance.stub(:signature).and_return "0MayR2QK3vtQxNjHZa8hlWZ8c0uB_a1wb3aIlUr2rsk=" envelope = @pubnub.grant(channel: "demo", write: true, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/545", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188183" Pubnub::Grant.any_instance.stub(:signature).and_return "nfck4-0lx-jwsvQu2S68uTyGKjJ4vg7wbd-PPKCGiNs=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/543", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188184" Pubnub::Grant.any_instance.stub(:signature).and_return "sI1QEPU5kCoyJa9XF3M4olZvEmhapKsOjIhNUVMKLes=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/544", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188184" Pubnub::Grant.any_instance.stub(:signature).and_return "sI1QEPU5kCoyJa9XF3M4olZvEmhapKsOjIhNUVMKLes=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/542", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188185" Pubnub::Grant.any_instance.stub(:signature).and_return "UqiDbOuwNu88-Pog0CnIjq1s2NZ6gu-Pm05TMKrPflw=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/540", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188186" Pubnub::Grant.any_instance.stub(:signature).and_return "kaedbZ13uNVd3Wc2lFe1HJbB9a36wxQlCm_b6ZcHktA=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/541", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188186" Pubnub::Grant.any_instance.stub(:signature).and_return "kaedbZ13uNVd3Wc2lFe1HJbB9a36wxQlCm_b6ZcHktA=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/551", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188189" Pubnub::Grant.any_instance.stub(:signature).and_return "PFY58dYDYyGOdn-CF4rNBX0hiI1h3z2Q9jQ2QO4KWU4=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/549", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188189" Pubnub::Grant.any_instance.stub(:signature).and_return "PFY58dYDYyGOdn-CF4rNBX0hiI1h3z2Q9jQ2QO4KWU4=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/550", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188190" Pubnub::Grant.any_instance.stub(:signature).and_return "BHM8NeaoSTjEhqbWksuHewTprUKMH8AD5FdqYzizpdI=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/548", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188191" Pubnub::Grant.any_instance.stub(:signature).and_return "JgiutMzb1W0kYYmIlnEttloGUReUvpcftGNnQ8ZkNM8=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/546", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188191" Pubnub::Grant.any_instance.stub(:signature).and_return "JgiutMzb1W0kYYmIlnEttloGUReUvpcftGNnQ8ZkNM8=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/547", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188192" Pubnub::Grant.any_instance.stub(:signature).and_return "1oSRbZb7BpvYmwcFOguO8hJlM2RvOjb8_9o1LeyuI9U=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/557", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188192" Pubnub::Grant.any_instance.stub(:signature).and_return "JZ4lO6E6aSGdut2pYmhGTgVC6nvOhWs_z15S7Vf15tY=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/555", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188193" Pubnub::Grant.any_instance.stub(:signature).and_return "ip0-bxRTs4s8DhsHQiL1yCWtlrvpAXDYzho3xeSzB4Y=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/556", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188194" Pubnub::Grant.any_instance.stub(:signature).and_return "IK_8V5l3iP5ioiDpBKRm_PdZe9ql8AbxydCFfTK8Dxo=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/554", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188194" Pubnub::Grant.any_instance.stub(:signature).and_return "IK_8V5l3iP5ioiDpBKRm_PdZe9ql8AbxydCFfTK8Dxo=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/552", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188195" Pubnub::Grant.any_instance.stub(:signature).and_return "2boENVOh_GuPB0SpzI_P1YU53cY_CmTccfxL9UkbG0Q=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/553", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188196" Pubnub::Grant.any_instance.stub(:signature).and_return "VA4TspEUoYsIq1yyLaUyZ_s1NIGrac19I-hN-xkXQ-Q=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/563", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188196" Pubnub::Grant.any_instance.stub(:signature).and_return "oSKcb8doibLMpIQuxGzZwpQrRPNW9NzaghQHYsSPlAc=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/561", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188197" Pubnub::Grant.any_instance.stub(:signature).and_return "GahsAlqbTvD42PWmjocYKOhuMeLxDi1qMCZLHG44ASg=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/562", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188197" Pubnub::Grant.any_instance.stub(:signature).and_return "GahsAlqbTvD42PWmjocYKOhuMeLxDi1qMCZLHG44ASg=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/560", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188198" Pubnub::Grant.any_instance.stub(:signature).and_return "Ipw9sAq_CxcwCaq9nBXKkg0PL6SgNnqrOoh8a_Bb_yc=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/558", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188199" Pubnub::Grant.any_instance.stub(:signature).and_return "ZpEBvQ1DrZWJ6s1CrLl7ce6R5N6opxFhE1NPB0BOX_g=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/559", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188199" Pubnub::Grant.any_instance.stub(:signature).and_return "ZpEBvQ1DrZWJ6s1CrLl7ce6R5N6opxFhE1NPB0BOX_g=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/569", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188200" Pubnub::Grant.any_instance.stub(:signature).and_return "uhNA0VDIbUtcQRsVdqGJ9NG3hO1SEsXKrGb7iC7G8wY=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/567", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188200" Pubnub::Grant.any_instance.stub(:signature).and_return "uhNA0VDIbUtcQRsVdqGJ9NG3hO1SEsXKrGb7iC7G8wY=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/568", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188201" Pubnub::Grant.any_instance.stub(:signature).and_return "7znXMsEIo_LMpzyKMNekeJFka6RITZRATo4OsPLUdkw=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/566", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188202" Pubnub::Grant.any_instance.stub(:signature).and_return "kEGG7UOfatrkfHKO3qY03bk3u6seyEiaJEpSCio82yQ=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/564", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188202" Pubnub::Grant.any_instance.stub(:signature).and_return "kEGG7UOfatrkfHKO3qY03bk3u6seyEiaJEpSCio82yQ=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/565", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188203" Pubnub::Grant.any_instance.stub(:signature).and_return "J3Bs_l0o-JHyAprO1Q6q8xgASyGbHjcVKBEKQcMjBl0=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/575", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188204" Pubnub::Grant.any_instance.stub(:signature).and_return "sg1lx_-8MzVlorzbFMhi41A5szBa28Auh09mKeUMYCU=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/573", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188204" Pubnub::Grant.any_instance.stub(:signature).and_return "sg1lx_-8MzVlorzbFMhi41A5szBa28Auh09mKeUMYCU=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/574", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188205" Pubnub::Grant.any_instance.stub(:signature).and_return "LWvAVb5QWb5cRTLEXhRRgJbxMeChk7m9h2bv_kEoa9c=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/572", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188206" Pubnub::Grant.any_instance.stub(:signature).and_return "68vOJ6lLC2NiFJrVE1Qo12u5GALKkyKWho8UjSGYNzg=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/570", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188207" Pubnub::Grant.any_instance.stub(:signature).and_return "fMSxURY2hCdOz7duvvwCQdIUe3jgAK4gAD2EnIYwvi8=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/571", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188207" Pubnub::Grant.any_instance.stub(:signature).and_return "fMSxURY2hCdOz7duvvwCQdIUe3jgAK4gAD2EnIYwvi8=" envelope = @pubnub.grant(channel: "demo", write: true, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/581", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188208" Pubnub::Grant.any_instance.stub(:signature).and_return "UkHv5uJybH8q5xhR0SI-hA6i9WptZkiu7b8scVXqL-M=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/579", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188208" Pubnub::Grant.any_instance.stub(:signature).and_return "UkHv5uJybH8q5xhR0SI-hA6i9WptZkiu7b8scVXqL-M=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/580", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188209" Pubnub::Grant.any_instance.stub(:signature).and_return "yApPZMwZgL1UpTy6DW0P2LVTbhAWAv6j6rO22MU-mZU=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/578", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188210" Pubnub::Grant.any_instance.stub(:signature).and_return "N4fG1KQDRJh8TxNEt76R3BNzeengtV-GY0hhuAu5l1g=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/576", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188210" Pubnub::Grant.any_instance.stub(:signature).and_return "N4fG1KQDRJh8TxNEt76R3BNzeengtV-GY0hhuAu5l1g=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/577", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188211" Pubnub::Grant.any_instance.stub(:signature).and_return "9jWWT1A27if5b83hjxzonOGo-jJe2S8I26GDh0ag9Jw=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/587", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188212" Pubnub::Grant.any_instance.stub(:signature).and_return "pHUUAENZR_9wCZRAAAvqqfjYPTyJlmgaXrwChVSiwQk=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/585", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188213" Pubnub::Grant.any_instance.stub(:signature).and_return "mSgB6y2hKGjg6-mpkTxb3ivBiUx0ig83Y1B0npW5PgQ=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/586", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188213" Pubnub::Grant.any_instance.stub(:signature).and_return "mSgB6y2hKGjg6-mpkTxb3ivBiUx0ig83Y1B0npW5PgQ=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/584", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188214" Pubnub::Grant.any_instance.stub(:signature).and_return "otZ9smHm8osgHvKHa0PRc7HgSty3tfug8db_qNWXn-0=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/582", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188214" Pubnub::Grant.any_instance.stub(:signature).and_return "otZ9smHm8osgHvKHa0PRc7HgSty3tfug8db_qNWXn-0=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/583", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188215" Pubnub::Grant.any_instance.stub(:signature).and_return "NyeWGdhNGFN89sVWc91e6w0P161n8vGzPS_I9GbpSug=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/593", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188216" Pubnub::Grant.any_instance.stub(:signature).and_return "zxPMSsMhZxvFjWYHuxPgn-fEr-fyUKYZwDWJaZFIQbY=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/591", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188216" Pubnub::Grant.any_instance.stub(:signature).and_return "zxPMSsMhZxvFjWYHuxPgn-fEr-fyUKYZwDWJaZFIQbY=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/592", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188217" Pubnub::Grant.any_instance.stub(:signature).and_return "h5GxPKpgoOSdLK5jawspM3FgPaTi2hFe_teRYZwzxTw=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/590", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188218" Pubnub::Grant.any_instance.stub(:signature).and_return "UH20pMbnUL-ZPHqFpP_mA9l5qydLC6sBIGpx1CXtC2s=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/588", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188218" Pubnub::Grant.any_instance.stub(:signature).and_return "UH20pMbnUL-ZPHqFpP_mA9l5qydLC6sBIGpx1CXtC2s=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/589", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188219" Pubnub::Grant.any_instance.stub(:signature).and_return "TPawbFkJBdusCb-HvyZ0yCkkUc8bh0IrgE-0ZBzx9q8=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/599", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188220" Pubnub::Grant.any_instance.stub(:signature).and_return "bqC8NU9KIaaWspuHk05c6kBzsXyUTRmjwYPK-iv04JU=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/597", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188221" Pubnub::Grant.any_instance.stub(:signature).and_return "YpdefZlQ8G0E67jYWEYNaJj-6hyCWQJDFXroqTHF_HY=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/598", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188221" Pubnub::Grant.any_instance.stub(:signature).and_return "YpdefZlQ8G0E67jYWEYNaJj-6hyCWQJDFXroqTHF_HY=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/596", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188222" Pubnub::Grant.any_instance.stub(:signature).and_return "yGaOgd8BIVfbft5Yn8Phb8wWnMIfq4vfVw_zuZ2zsFA=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/594", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188223" Pubnub::Grant.any_instance.stub(:signature).and_return "Fk8gz6-e9FqoM0C8A_cc2TAUSMv588it3l-g1khKNJg=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/595", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188223" Pubnub::Grant.any_instance.stub(:signature).and_return "Fk8gz6-e9FqoM0C8A_cc2TAUSMv588it3l-g1khKNJg=" envelope = @pubnub.grant(channel: "demo", write: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/605", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188224" Pubnub::Grant.any_instance.stub(:signature).and_return "WIT2QTzPgq2BWeWllodQaqtkeIjRyHxkwPKrc7Z3UZM=" envelope = @pubnub.grant(channel: "demo", write: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/603", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188224" Pubnub::Grant.any_instance.stub(:signature).and_return "WIT2QTzPgq2BWeWllodQaqtkeIjRyHxkwPKrc7Z3UZM=" envelope = @pubnub.grant(channel: "demo", write: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/604", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188225" Pubnub::Grant.any_instance.stub(:signature).and_return "by-ldllygoakxJWFImev5B4-cglEqV_IWxC8i1Xr5gI=" envelope = @pubnub.grant(channel: "demo", write: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/602", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188226" Pubnub::Grant.any_instance.stub(:signature).and_return "d07a15F3T04cbqIGM8iLirGhidgIPAroR7YgcT4Rfhg=" envelope = @pubnub.grant(channel: "demo", write: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/600", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188226" Pubnub::Grant.any_instance.stub(:signature).and_return "d07a15F3T04cbqIGM8iLirGhidgIPAroR7YgcT4Rfhg=" envelope = @pubnub.grant(channel: "demo", write: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/601", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188227" Pubnub::Grant.any_instance.stub(:signature).and_return "dwX-TVQu35vafq0mpDfFvJlFH0OxEgcjCC2vkeeZSCs=" envelope = @pubnub.grant(channel: "demo", write: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/611", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188227" Pubnub::Grant.any_instance.stub(:signature).and_return "MBRC3xofPDf6d8C2ni_u10OrJMV1OH01nyPC7iOF0HA=" envelope = @pubnub.grant(channel: "demo", write: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/609", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188228" Pubnub::Grant.any_instance.stub(:signature).and_return "x_7nuz8-7-fCXbyLFo4-6LZgYnnL0SlsCLuKAl-rM5U=" envelope = @pubnub.grant(channel: "demo", write: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/610", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188229" Pubnub::Grant.any_instance.stub(:signature).and_return "_Waw4Qz9X6cojjovr9OfG-NU4m7CxLfCeXOE1l9GLCQ=" envelope = @pubnub.grant(channel: "demo", write: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/608", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188229" Pubnub::Grant.any_instance.stub(:signature).and_return "_Waw4Qz9X6cojjovr9OfG-NU4m7CxLfCeXOE1l9GLCQ=" envelope = @pubnub.grant(channel: "demo", write: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/606", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188230" Pubnub::Grant.any_instance.stub(:signature).and_return "9FPg5CWeSLmfaIRrRn0Ih0vIhQypL2g0L9fV5bJtdd4=" envelope = @pubnub.grant(channel: "demo", write: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__true___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/607", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188230" Pubnub::Grant.any_instance.stub(:signature).and_return "9FPg5CWeSLmfaIRrRn0Ih0vIhQypL2g0L9fV5bJtdd4=" envelope = @pubnub.grant(channel: "demo", write: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/401", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188231" Pubnub::Grant.any_instance.stub(:signature).and_return "Cgjt3TRzUmPrWRJtrde8lkrDDChKlumOUiY__Vm5Uno=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/399", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188231" Pubnub::Grant.any_instance.stub(:signature).and_return "Cgjt3TRzUmPrWRJtrde8lkrDDChKlumOUiY__Vm5Uno=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/400", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188232" Pubnub::Grant.any_instance.stub(:signature).and_return "2iGMGwrgKNIfhrH1Gv6fo_Gd8mKBCbTqXsjd9kEkbTU=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/398", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188233" Pubnub::Grant.any_instance.stub(:signature).and_return "DB63KXLSjV_dpvXyXHiHh0UZCA_Ht7-cgl1_Zv0eXxc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/396", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188233" Pubnub::Grant.any_instance.stub(:signature).and_return "DB63KXLSjV_dpvXyXHiHh0UZCA_Ht7-cgl1_Zv0eXxc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/397", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188234" Pubnub::Grant.any_instance.stub(:signature).and_return "MldDLAwp7q2l6CZETGWRpMQWc2vzdfaz7ziLUfsunyk=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/407", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188235" Pubnub::Grant.any_instance.stub(:signature).and_return "SDBJovZZ_MUBtfATbuDMu5R5auqvoEYJ5j7tbfEy9TA=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/405", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188235" Pubnub::Grant.any_instance.stub(:signature).and_return "SDBJovZZ_MUBtfATbuDMu5R5auqvoEYJ5j7tbfEy9TA=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/406", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188236" Pubnub::Grant.any_instance.stub(:signature).and_return "KZTHewo298WcSeXuHGCeVhqk6_hHcV-kV3rEk_J6ZDc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/404", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188236" Pubnub::Grant.any_instance.stub(:signature).and_return "KZTHewo298WcSeXuHGCeVhqk6_hHcV-kV3rEk_J6ZDc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/402", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188237" Pubnub::Grant.any_instance.stub(:signature).and_return "_YN7OjKDb1PO7YhG7u2pTZC0hCBmUEpdAXHo500MYs0=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/403", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188238" Pubnub::Grant.any_instance.stub(:signature).and_return "gqdjf9ydsorOGvCGfST97opcMFXcmIzK8mxVM6IPXm8=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/413", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188238" Pubnub::Grant.any_instance.stub(:signature).and_return "gjOp21A3TFWRWxQhWrdRkAQxTMnsZOVpF-iwdblWI00=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/411", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188239" Pubnub::Grant.any_instance.stub(:signature).and_return "z6aGQpX6yyj8P8er4os9xiOBOFAPTnrcCLr6sAgJum0=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/412", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188240" Pubnub::Grant.any_instance.stub(:signature).and_return "WwFtQDLS3C6aPHgTexxSGA1Vbh8DSfF0-x7v87uqlSo=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/410", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188240" Pubnub::Grant.any_instance.stub(:signature).and_return "WwFtQDLS3C6aPHgTexxSGA1Vbh8DSfF0-x7v87uqlSo=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/408", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188241" Pubnub::Grant.any_instance.stub(:signature).and_return "X5cwXW2jXkJ6CkRacI_AGw7SB7IpjgCTiMHiPvzQM-4=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/409", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188241" Pubnub::Grant.any_instance.stub(:signature).and_return "X5cwXW2jXkJ6CkRacI_AGw7SB7IpjgCTiMHiPvzQM-4=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/419", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188242" Pubnub::Grant.any_instance.stub(:signature).and_return "7zWznipDII7wFEZu2tOGlYApd7d5ckTfzekJdJEU_vw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/417", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188243" Pubnub::Grant.any_instance.stub(:signature).and_return "cr1XHd5r21ht9oWLFNz-haV2H--swbc70gtboBgIEDE=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/418", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188243" Pubnub::Grant.any_instance.stub(:signature).and_return "cr1XHd5r21ht9oWLFNz-haV2H--swbc70gtboBgIEDE=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/416", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188244" Pubnub::Grant.any_instance.stub(:signature).and_return "-qzBAMxUxaI5qdA0AxvjE4J6NNh8nslOOaY23wZ3-Vs=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/414", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188244" Pubnub::Grant.any_instance.stub(:signature).and_return "-qzBAMxUxaI5qdA0AxvjE4J6NNh8nslOOaY23wZ3-Vs=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/415", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188245" Pubnub::Grant.any_instance.stub(:signature).and_return "BtTi6EgPr2cbja9nfFmyJkUR2kWzH3dKOiqjrQY799Q=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/425", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188245" Pubnub::Grant.any_instance.stub(:signature).and_return "8Xx0a_kRq2cSCHi31-7tSd__cBaF6oszjUy1v-_7gdM=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/423", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188246" Pubnub::Grant.any_instance.stub(:signature).and_return "sYOaYy4S1Djb8b1Yv9ZuN6BNfyAAHmfPf-Y1AR2_5fY=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/424", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188246" Pubnub::Grant.any_instance.stub(:signature).and_return "sYOaYy4S1Djb8b1Yv9ZuN6BNfyAAHmfPf-Y1AR2_5fY=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/422", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188247" Pubnub::Grant.any_instance.stub(:signature).and_return "e1rB8_kIiFPZcvqTUwR2qKt76TnB0YFdpGABMIMFdJc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/420", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188247" Pubnub::Grant.any_instance.stub(:signature).and_return "e1rB8_kIiFPZcvqTUwR2qKt76TnB0YFdpGABMIMFdJc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/421", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188248" Pubnub::Grant.any_instance.stub(:signature).and_return "bt4enUnqRllKMxyqtS4zv43MkNidl8Gx5DW7i-egcaw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/431", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188248" Pubnub::Grant.any_instance.stub(:signature).and_return "2KoQT9fiF7uVKlVFtfBdkUeGXo_TAEwGry_yDVoF6Ms=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/429", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188249" Pubnub::Grant.any_instance.stub(:signature).and_return "IDfrqbf7uZSjYbnR-j05cy2m_wpqJEdUxfPAoif7a-g=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/430", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188249" Pubnub::Grant.any_instance.stub(:signature).and_return "IDfrqbf7uZSjYbnR-j05cy2m_wpqJEdUxfPAoif7a-g=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/428", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188250" Pubnub::Grant.any_instance.stub(:signature).and_return "WrSrgZ6M5rbawd__NUaDeLp1gIKfs-Ot1vO2uL-veNk=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/426", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188250" Pubnub::Grant.any_instance.stub(:signature).and_return "WrSrgZ6M5rbawd__NUaDeLp1gIKfs-Ot1vO2uL-veNk=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/427", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188251" Pubnub::Grant.any_instance.stub(:signature).and_return "YeGtkFUs5fdA8_DGnsc6Kinp6qHto5k4j_b_LCD4AtQ=" envelope = @pubnub.grant(channel: "demo", write: false, manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/329", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188252" Pubnub::Grant.any_instance.stub(:signature).and_return "O7RvFwLg8Efn9nx_gFoIzifTn6_AjZpRa-CP8WLy6QY=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/327", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188252" Pubnub::Grant.any_instance.stub(:signature).and_return "O7RvFwLg8Efn9nx_gFoIzifTn6_AjZpRa-CP8WLy6QY=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/328", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188253" Pubnub::Grant.any_instance.stub(:signature).and_return "jMZEw3fmS28kRiR3m8CQJrTMVuYX_DTUmwC-viCMlj4=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/326", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188254" Pubnub::Grant.any_instance.stub(:signature).and_return "X1GivpH-xOLxnRn4qr5c4bhkSHvpL1NSXhGsja2nmNc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/324", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188254" Pubnub::Grant.any_instance.stub(:signature).and_return "X1GivpH-xOLxnRn4qr5c4bhkSHvpL1NSXhGsja2nmNc=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/325", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188255" Pubnub::Grant.any_instance.stub(:signature).and_return "2Kf2ZybghszAgGHM0IaSSXv94rJ285OjhUT4xG8E0Ok=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/335", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188255" Pubnub::Grant.any_instance.stub(:signature).and_return "VLAdaBnOsvrkMMx202jQsnv332OcZiOBuOkA66BIxkk=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/333", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188256" Pubnub::Grant.any_instance.stub(:signature).and_return "xnEFPhx-iSNw9zo02j6mHYhUhGExLJyonBhEoLmNkdY=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/334", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188256" Pubnub::Grant.any_instance.stub(:signature).and_return "xnEFPhx-iSNw9zo02j6mHYhUhGExLJyonBhEoLmNkdY=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/332", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188257" Pubnub::Grant.any_instance.stub(:signature).and_return "xZnb8np3OkHv1iDjDct_yrpgXa8BTzmYJu2vje_dTFE=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/330", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188257" Pubnub::Grant.any_instance.stub(:signature).and_return "xZnb8np3OkHv1iDjDct_yrpgXa8BTzmYJu2vje_dTFE=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/331", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188258" Pubnub::Grant.any_instance.stub(:signature).and_return "c_CFElXeBD9CED6yG0u2nOZ1EqE2R93YiGSV9PSgt8c=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/341", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188258" Pubnub::Grant.any_instance.stub(:signature).and_return "W9zqeUc9KAwrHoLm3xMwSm0gEDlWA03nK21vh9j6koo=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/339", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188259" Pubnub::Grant.any_instance.stub(:signature).and_return "UTM0SrGITQifmcSHndhe_fNerlioZkFH2i1TfJkrfN4=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/340", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188259" Pubnub::Grant.any_instance.stub(:signature).and_return "UTM0SrGITQifmcSHndhe_fNerlioZkFH2i1TfJkrfN4=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/338", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188260" Pubnub::Grant.any_instance.stub(:signature).and_return "kSop-wmD7PnuxTIvTr-b1E7GcBH4NAeZGhrN5rW_-eg=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/336", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188261" Pubnub::Grant.any_instance.stub(:signature).and_return "xKAOhS70HvGqwDTf59-m01B5u9SuKHNN9-YXUnkbqZw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/337", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188262" Pubnub::Grant.any_instance.stub(:signature).and_return "4OXDFP_WRePq7UuhAklJF5vqWzJmmqh5bdV3AoZJkIo=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/347", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188262" Pubnub::Grant.any_instance.stub(:signature).and_return "Mu-ycf6QGkcagsmL8FezMCdU6D4wBImBRbePfebFcHQ=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/345", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188263" Pubnub::Grant.any_instance.stub(:signature).and_return "yQI8A3wN9hZEnHz7vFGAJ6eZrJXhrfGF4Vhkset-b7M=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/346", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188263" Pubnub::Grant.any_instance.stub(:signature).and_return "yQI8A3wN9hZEnHz7vFGAJ6eZrJXhrfGF4Vhkset-b7M=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/344", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188264" Pubnub::Grant.any_instance.stub(:signature).and_return "ZLA3go-SARtio7KpFELgU1h9_wkZw-bLI4VqX-Sz7Jw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/342", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188264" Pubnub::Grant.any_instance.stub(:signature).and_return "ZLA3go-SARtio7KpFELgU1h9_wkZw-bLI4VqX-Sz7Jw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/343", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188265" Pubnub::Grant.any_instance.stub(:signature).and_return "GGOa50BKLJMtWqcAgkG5oj96ickL8dyfNH3RXnMOU8c=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/353", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188265" Pubnub::Grant.any_instance.stub(:signature).and_return "uRuf7qGbftGgfnSwWTHGHvzceBt8ICdpsFdoLIlboSE=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/351", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188266" Pubnub::Grant.any_instance.stub(:signature).and_return "mENJa509OEqb5dQMMjhUXw8gdpxb0oj_ZkngS8wN-Jw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/352", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188267" Pubnub::Grant.any_instance.stub(:signature).and_return "HSzXy8DZYgw37MTwNwUxhIk1o1BzVlne4vA6NfIsThw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/350", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188267" Pubnub::Grant.any_instance.stub(:signature).and_return "HSzXy8DZYgw37MTwNwUxhIk1o1BzVlne4vA6NfIsThw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/348", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188268" Pubnub::Grant.any_instance.stub(:signature).and_return "RMlQaKpte4YAqClTsuAMNXXYczxlog6ECifgF9QHZLw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/349", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188268" Pubnub::Grant.any_instance.stub(:signature).and_return "RMlQaKpte4YAqClTsuAMNXXYczxlog6ECifgF9QHZLw=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/359", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188269" Pubnub::Grant.any_instance.stub(:signature).and_return "9M3IaUS6d1e_Nu6j-2uCxgrVnkqmSLttDqG2S9K37j0=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/357", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188269" Pubnub::Grant.any_instance.stub(:signature).and_return "9M3IaUS6d1e_Nu6j-2uCxgrVnkqmSLttDqG2S9K37j0=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/358", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188270" Pubnub::Grant.any_instance.stub(:signature).and_return "V_F8FuDFwGYqz4r-h3_gAD_mIJ0-Xj6mPcte3YHEJFo=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/356", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188270" Pubnub::Grant.any_instance.stub(:signature).and_return "V_F8FuDFwGYqz4r-h3_gAD_mIJ0-Xj6mPcte3YHEJFo=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/354", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188271" Pubnub::Grant.any_instance.stub(:signature).and_return "pUniuqSReHWy_Cvfy__OdHQuSN7NjFvkF0MyhXOHvyI=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/355", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188271" Pubnub::Grant.any_instance.stub(:signature).and_return "pUniuqSReHWy_Cvfy__OdHQuSN7NjFvkF0MyhXOHvyI=" envelope = @pubnub.grant(channel: "demo", write: false, manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/365", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188272" Pubnub::Grant.any_instance.stub(:signature).and_return "IXb3Up87aK37b9Y1msqjt5XthUh3xCDRW64L3fNG-9o=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/363", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188273" Pubnub::Grant.any_instance.stub(:signature).and_return "1xRfaVFglu3rbmDTZ8FJW-yysZhAOfu8JZoc68Y3iqM=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/364", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188273" Pubnub::Grant.any_instance.stub(:signature).and_return "1xRfaVFglu3rbmDTZ8FJW-yysZhAOfu8JZoc68Y3iqM=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/362", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188274" Pubnub::Grant.any_instance.stub(:signature).and_return "izNzLoC9t3n2kfdQVy2YRg-VIlPPV9QVoYKX2hPE4pE=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/360", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188274" Pubnub::Grant.any_instance.stub(:signature).and_return "izNzLoC9t3n2kfdQVy2YRg-VIlPPV9QVoYKX2hPE4pE=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/361", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188275" Pubnub::Grant.any_instance.stub(:signature).and_return "_DkkGpaNumC2I72rslBjlIEAQ0rPk05jc0BA4AeOwF4=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/371", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188275" Pubnub::Grant.any_instance.stub(:signature).and_return "29o2lCyBhGx2bt_Z-vde2ewfGxk7qhM5ms7iyGU2T6M=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/369", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188276" Pubnub::Grant.any_instance.stub(:signature).and_return "ZR7JsP7sa3Kcd26Oz5YrwSQAVwG8mqVk7ezvIYxUIwU=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/370", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188276" Pubnub::Grant.any_instance.stub(:signature).and_return "ZR7JsP7sa3Kcd26Oz5YrwSQAVwG8mqVk7ezvIYxUIwU=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/368", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188277" Pubnub::Grant.any_instance.stub(:signature).and_return "QyIaNlsRcurOtZOMvcLGtQzpziJWgZWQ_FxQAAQYXGY=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/366", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188277" Pubnub::Grant.any_instance.stub(:signature).and_return "QyIaNlsRcurOtZOMvcLGtQzpziJWgZWQ_FxQAAQYXGY=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/367", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188278" Pubnub::Grant.any_instance.stub(:signature).and_return "BzIl9ySdoRjAMTgpRUUUP8jO-BD_J7m9YugjST3Ee2k=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/377", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188278" Pubnub::Grant.any_instance.stub(:signature).and_return "y6as74VW8wjdNKhF-dgQBrgsHjDevLNpiUs6sJylvy4=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/375", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188279" Pubnub::Grant.any_instance.stub(:signature).and_return "q88UWFQ6GeB4I81eTBAP-TC6MnIgVdPmEzpEXj05FBM=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/376", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188279" Pubnub::Grant.any_instance.stub(:signature).and_return "q88UWFQ6GeB4I81eTBAP-TC6MnIgVdPmEzpEXj05FBM=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/374", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188280" Pubnub::Grant.any_instance.stub(:signature).and_return "4PJsKYJmjMgc4cLj7xbO_iZCKF3Av7WROJNas9b58rk=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/372", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188280" Pubnub::Grant.any_instance.stub(:signature).and_return "4PJsKYJmjMgc4cLj7xbO_iZCKF3Av7WROJNas9b58rk=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/373", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188281" Pubnub::Grant.any_instance.stub(:signature).and_return "0CcAwFr1E3lrTwpbiy2RBZXRneRPKET8XNUSU5wDIvk=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/383", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188282" Pubnub::Grant.any_instance.stub(:signature).and_return "eMD03k8nvdp2-0QK8-fSGj3KtaKKZMIeqLmZPXhMec4=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/381", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188282" Pubnub::Grant.any_instance.stub(:signature).and_return "eMD03k8nvdp2-0QK8-fSGj3KtaKKZMIeqLmZPXhMec4=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/382", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188283" Pubnub::Grant.any_instance.stub(:signature).and_return "pnftG-Ipmd7PttUmkVMHo9MkSd9OFOBcKaLsBSgrAU8=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/380", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188283" Pubnub::Grant.any_instance.stub(:signature).and_return "pnftG-Ipmd7PttUmkVMHo9MkSd9OFOBcKaLsBSgrAU8=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/378", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188284" Pubnub::Grant.any_instance.stub(:signature).and_return "JkZBM0x-sVlbjUfKGgJrX0gmT7v45nPsofriN5WUD-w=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/379", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188284" Pubnub::Grant.any_instance.stub(:signature).and_return "JkZBM0x-sVlbjUfKGgJrX0gmT7v45nPsofriN5WUD-w=" envelope = @pubnub.grant(channel: "demo", write: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/389", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188285" Pubnub::Grant.any_instance.stub(:signature).and_return "0GF2hMxegdU61TimeSrkFJi4JwK5N9pAHeIbElvVfhY=" envelope = @pubnub.grant(channel: "demo", write: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/387", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188285" Pubnub::Grant.any_instance.stub(:signature).and_return "0GF2hMxegdU61TimeSrkFJi4JwK5N9pAHeIbElvVfhY=" envelope = @pubnub.grant(channel: "demo", write: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/388", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188286" Pubnub::Grant.any_instance.stub(:signature).and_return "qK_hxIWGmk-YAkWr_WM407gZLIYN3RSGw6oPmZdPwp4=" envelope = @pubnub.grant(channel: "demo", write: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/386", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188286" Pubnub::Grant.any_instance.stub(:signature).and_return "qK_hxIWGmk-YAkWr_WM407gZLIYN3RSGw6oPmZdPwp4=" envelope = @pubnub.grant(channel: "demo", write: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/384", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188287" Pubnub::Grant.any_instance.stub(:signature).and_return "lqOMLbuB4KpIkJgtUfSh_KUtOguAmjc3gu4vzTD4AOk=" envelope = @pubnub.grant(channel: "demo", write: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/385", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188288" Pubnub::Grant.any_instance.stub(:signature).and_return "bWc3xkK9xUs_sJjTfrySCN1ly50SQ90clADxUJPT0Rg=" envelope = @pubnub.grant(channel: "demo", write: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/395", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188288" Pubnub::Grant.any_instance.stub(:signature).and_return "xoPH1EQxhnB0r5kQrRQAA863056KeIALDucwCnmqeuw=" envelope = @pubnub.grant(channel: "demo", write: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/393", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188289" Pubnub::Grant.any_instance.stub(:signature).and_return "qexVfoyC7qPcrXfIXvCdsIrpMQF4lZmx9cZmkNKbkUc=" envelope = @pubnub.grant(channel: "demo", write: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/394", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188289" Pubnub::Grant.any_instance.stub(:signature).and_return "qexVfoyC7qPcrXfIXvCdsIrpMQF4lZmx9cZmkNKbkUc=" envelope = @pubnub.grant(channel: "demo", write: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/392", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188290" Pubnub::Grant.any_instance.stub(:signature).and_return "1WU-SPFaFLpdnReg49AOrIvCLLx9J3sdGPrGh6MV-CU=" envelope = @pubnub.grant(channel: "demo", write: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/390", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188290" Pubnub::Grant.any_instance.stub(:signature).and_return "1WU-SPFaFLpdnReg49AOrIvCLLx9J3sdGPrGh6MV-CU=" envelope = @pubnub.grant(channel: "demo", write: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__false___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/391", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188291" Pubnub::Grant.any_instance.stub(:signature).and_return "NDQ9AqZsm6XgsPpetRi10e3z336fEsjOLmmaJBifIww=" envelope = @pubnub.grant(channel: "demo", write: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 0, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/509", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188291" Pubnub::Grant.any_instance.stub(:signature).and_return "u-iB6HHjr_ANNeCkqguqdFxTUfMwuRHWIInMFM5aZmo=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/507", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188292" Pubnub::Grant.any_instance.stub(:signature).and_return "Z2jd2AhWo1duQMfR0qWif_9EoA_SskSpBtXQDDjcLjc=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/508", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188292" Pubnub::Grant.any_instance.stub(:signature).and_return "Z2jd2AhWo1duQMfR0qWif_9EoA_SskSpBtXQDDjcLjc=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/506", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188293" Pubnub::Grant.any_instance.stub(:signature).and_return "UCWJVwCGAXLGeWvak5eElrUVPScbev9SllIY9QVPudw=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/504", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188294" Pubnub::Grant.any_instance.stub(:signature).and_return "BWH7XPcAcWN3rDJ47Lz0OATkNLbrdpqQg5sm9VLECXM=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/505", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188294" Pubnub::Grant.any_instance.stub(:signature).and_return "BWH7XPcAcWN3rDJ47Lz0OATkNLbrdpqQg5sm9VLECXM=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/515", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188295" Pubnub::Grant.any_instance.stub(:signature).and_return "ZdupY1kLZfyO3xiRC9WOPZ_ccwoS00YfVNuB1kXBGYY=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/513", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188295" Pubnub::Grant.any_instance.stub(:signature).and_return "ZdupY1kLZfyO3xiRC9WOPZ_ccwoS00YfVNuB1kXBGYY=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/514", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188296" Pubnub::Grant.any_instance.stub(:signature).and_return "NkECJTYW6HFVILmrHKLuWN3B6d24vSpEFBnSLotJzQA=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/512", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188296" Pubnub::Grant.any_instance.stub(:signature).and_return "NkECJTYW6HFVILmrHKLuWN3B6d24vSpEFBnSLotJzQA=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/510", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188297" Pubnub::Grant.any_instance.stub(:signature).and_return "CjxflTMd-gqOC_ft-vY4dLKUGW5mbk0AJ8Qaauus6Sk=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/511", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188297" Pubnub::Grant.any_instance.stub(:signature).and_return "CjxflTMd-gqOC_ft-vY4dLKUGW5mbk0AJ8Qaauus6Sk=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/521", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188298" Pubnub::Grant.any_instance.stub(:signature).and_return "qvQfA_XfaoAzJcd-hm8BsGL6sUy0nt1TczX6xhnaHZo=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/519", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188298" Pubnub::Grant.any_instance.stub(:signature).and_return "qvQfA_XfaoAzJcd-hm8BsGL6sUy0nt1TczX6xhnaHZo=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/520", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188299" Pubnub::Grant.any_instance.stub(:signature).and_return "vKSlamFht7yoHrkc2UI1S8OgUjWrUJB8Dr6BU0uXqZc=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/518", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188299" Pubnub::Grant.any_instance.stub(:signature).and_return "vKSlamFht7yoHrkc2UI1S8OgUjWrUJB8Dr6BU0uXqZc=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/516", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188300" Pubnub::Grant.any_instance.stub(:signature).and_return "H68T7cgOE6rLWhFKDFFTxvy1KIYvBMH2sQtU8L4fzko=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/517", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188300" Pubnub::Grant.any_instance.stub(:signature).and_return "H68T7cgOE6rLWhFKDFFTxvy1KIYvBMH2sQtU8L4fzko=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/527", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188301" Pubnub::Grant.any_instance.stub(:signature).and_return "8de3AwhAqAZyJaZUo2XtWnhpkYaB3rR-2bt7ycIHgv8=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/525", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188302" Pubnub::Grant.any_instance.stub(:signature).and_return "02pHKdFbOWZc3vvHaCisWskEgAM0Y9OCgM4s-LmR9Xw=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/526", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188302" Pubnub::Grant.any_instance.stub(:signature).and_return "02pHKdFbOWZc3vvHaCisWskEgAM0Y9OCgM4s-LmR9Xw=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/524", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188303" Pubnub::Grant.any_instance.stub(:signature).and_return "bR8IprrS1n1rwAOrNiSVGIoeN9t_ClO94iiqFWzF8xA=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/522", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188303" Pubnub::Grant.any_instance.stub(:signature).and_return "bR8IprrS1n1rwAOrNiSVGIoeN9t_ClO94iiqFWzF8xA=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/523", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188304" Pubnub::Grant.any_instance.stub(:signature).and_return "BVN-gYrVpq7MfWaQ3yO81hl9PtP9MS44aVXXql9zvYc=" envelope = @pubnub.grant(channel: "demo", manage: true, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/533", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188304" Pubnub::Grant.any_instance.stub(:signature).and_return "RkNW5yMwEyJwbM3JRLT0PUYrlAjAesak1riLzy7WHvQ=" envelope = @pubnub.grant(channel: "demo", manage: true, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/531", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188305" Pubnub::Grant.any_instance.stub(:signature).and_return "K40jV7N4XDYM691j3KQptVd7AutydyVFgGnfGFswjt0=" envelope = @pubnub.grant(channel: "demo", manage: true, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/532", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188305" Pubnub::Grant.any_instance.stub(:signature).and_return "K40jV7N4XDYM691j3KQptVd7AutydyVFgGnfGFswjt0=" envelope = @pubnub.grant(channel: "demo", manage: true, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/530", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188306" Pubnub::Grant.any_instance.stub(:signature).and_return "sUd5o2UQ0Tirn98kQemO1wtG16z6fwGlktQrZHEGAvk=" envelope = @pubnub.grant(channel: "demo", manage: true, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/528", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188306" Pubnub::Grant.any_instance.stub(:signature).and_return "sUd5o2UQ0Tirn98kQemO1wtG16z6fwGlktQrZHEGAvk=" envelope = @pubnub.grant(channel: "demo", manage: true, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/529", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188307" Pubnub::Grant.any_instance.stub(:signature).and_return "bmdH3OL5UwUBGL8KWjAkfovDs-oc3y9KegaCMglo5dU=" envelope = @pubnub.grant(channel: "demo", manage: true, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/539", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188308" Pubnub::Grant.any_instance.stub(:signature).and_return "hns5Ykff4xyMRgFaq5wteK5VoDd3YrwZkZ5XlEAJhys=" envelope = @pubnub.grant(channel: "demo", manage: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/537", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188308" Pubnub::Grant.any_instance.stub(:signature).and_return "hns5Ykff4xyMRgFaq5wteK5VoDd3YrwZkZ5XlEAJhys=" envelope = @pubnub.grant(channel: "demo", manage: true, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/538", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188309" Pubnub::Grant.any_instance.stub(:signature).and_return "Yt2IuPvN1v7EY-8UPb1OchQyzlDXQnvtaAY-0COquUc=" envelope = @pubnub.grant(channel: "demo", manage: true, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/536", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188310" Pubnub::Grant.any_instance.stub(:signature).and_return "7LiE-x5-Hc3vVbZjbetgl3Ksv8g3qYjbZ2reEXVPvaU=" envelope = @pubnub.grant(channel: "demo", manage: true, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/534", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188310" Pubnub::Grant.any_instance.stub(:signature).and_return "7LiE-x5-Hc3vVbZjbetgl3Ksv8g3qYjbZ2reEXVPvaU=" envelope = @pubnub.grant(channel: "demo", manage: true, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__true___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/535", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188311" Pubnub::Grant.any_instance.stub(:signature).and_return "Rr1YHvHbb-LIGScYFmDhOC7ngM1nX9t_mIDoaduEDNY=" envelope = @pubnub.grant(channel: "demo", manage: true, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/437", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188311" Pubnub::Grant.any_instance.stub(:signature).and_return "59LulR5xSkNx2SyIrRYRb9JcxNDchTteD2lxUYIGHto=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/435", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188312" Pubnub::Grant.any_instance.stub(:signature).and_return "5g5nQBdCdIr66y7qHs1xE5t_p0fcQlvSHoYlGU2V_lQ=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/436", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188313" Pubnub::Grant.any_instance.stub(:signature).and_return "Yhck_OuW_zLGYqkxYVmUVZVFh0XzcEaItQ_RKGGDZYQ=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/434", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188313" Pubnub::Grant.any_instance.stub(:signature).and_return "Yhck_OuW_zLGYqkxYVmUVZVFh0XzcEaItQ_RKGGDZYQ=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/432", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188314" Pubnub::Grant.any_instance.stub(:signature).and_return "C3qKvMgHgdXSHiKeZMH40-2kv78s6xMlhwP9FZSdZ2g=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/433", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188314" Pubnub::Grant.any_instance.stub(:signature).and_return "C3qKvMgHgdXSHiKeZMH40-2kv78s6xMlhwP9FZSdZ2g=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/443", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188315" Pubnub::Grant.any_instance.stub(:signature).and_return "k1UEa7e366cj02rVKXkBt-55HUO6i6eirkHc4yziNvA=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/441", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188315" Pubnub::Grant.any_instance.stub(:signature).and_return "k1UEa7e366cj02rVKXkBt-55HUO6i6eirkHc4yziNvA=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/442", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188316" Pubnub::Grant.any_instance.stub(:signature).and_return "PEKqpbCBttlTHywa7xKPbSQ2NiXYrMBzV-tZ18B_3S4=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/440", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188316" Pubnub::Grant.any_instance.stub(:signature).and_return "PEKqpbCBttlTHywa7xKPbSQ2NiXYrMBzV-tZ18B_3S4=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/438", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188317" Pubnub::Grant.any_instance.stub(:signature).and_return "hA_vprJRWwga4WNcywuCKGFXRtxoQqNTbSPdEzqBuPQ=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/439", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188318" Pubnub::Grant.any_instance.stub(:signature).and_return "6zxoqpyrKF-K2_d0hsDr5NSAeSDKnHYIg7NAESVABVQ=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/449", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188318" Pubnub::Grant.any_instance.stub(:signature).and_return "2LgiWu-FSQS7RTKJrHU8RovLlFi58q_1r3hYj2TzesA=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/447", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188319" Pubnub::Grant.any_instance.stub(:signature).and_return "dbsiydTGpuex5F1xvcFYChphpgPwRXOMA7hcL_daaS4=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/448", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188319" Pubnub::Grant.any_instance.stub(:signature).and_return "dbsiydTGpuex5F1xvcFYChphpgPwRXOMA7hcL_daaS4=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/446", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188320" Pubnub::Grant.any_instance.stub(:signature).and_return "V1T2dzLk0fgMqgZ-TNJdKhyUHrWloomLkB0mmM5NxWE=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/444", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188320" Pubnub::Grant.any_instance.stub(:signature).and_return "V1T2dzLk0fgMqgZ-TNJdKhyUHrWloomLkB0mmM5NxWE=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/445", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188321" Pubnub::Grant.any_instance.stub(:signature).and_return "dL6h-Fjt8wwgpMhMe1upQ1rYsOlf5TqxSaCoZPxubMw=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/455", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188322" Pubnub::Grant.any_instance.stub(:signature).and_return "9GT9B8kOrbWUQUo7IzfthRw2K3nQ5-i3RPMBXQugysM=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/453", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188324" Pubnub::Grant.any_instance.stub(:signature).and_return "DwCHMXkBuPbSbxSmML-1z-f2henXtp7DGk7rE7PPz1M=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/454", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188325" Pubnub::Grant.any_instance.stub(:signature).and_return "gbnsF5MiT07LRzhG4B7VVuLywSOo0BxdTG_w1HR0T4s=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/452", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188325" Pubnub::Grant.any_instance.stub(:signature).and_return "gbnsF5MiT07LRzhG4B7VVuLywSOo0BxdTG_w1HR0T4s=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/450", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188326" Pubnub::Grant.any_instance.stub(:signature).and_return "GSoDnI5Ehv8YxGnorUPQPBH1j42LWf_8j9GY5O2m_3A=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/451", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188326" Pubnub::Grant.any_instance.stub(:signature).and_return "GSoDnI5Ehv8YxGnorUPQPBH1j42LWf_8j9GY5O2m_3A=" envelope = @pubnub.grant(channel: "demo", manage: false, ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/461", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188327" Pubnub::Grant.any_instance.stub(:signature).and_return "YpIAhdEvJ2fc7gE0IENb6Lar4n1KAnX1V8_SyR06ikA=" envelope = @pubnub.grant(channel: "demo", manage: false, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/459", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188327" Pubnub::Grant.any_instance.stub(:signature).and_return "YpIAhdEvJ2fc7gE0IENb6Lar4n1KAnX1V8_SyR06ikA=" envelope = @pubnub.grant(channel: "demo", manage: false, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/460", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188328" Pubnub::Grant.any_instance.stub(:signature).and_return "KfQm-hDVxTbCj28QAGf14zC-YZ6lyGanplOp1eryZJ0=" envelope = @pubnub.grant(channel: "demo", manage: false, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/458", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188329" Pubnub::Grant.any_instance.stub(:signature).and_return "Ko3nsNgtSe4IbcJyrePaT50Gf7OKcBPTHcMbLBcT7r0=" envelope = @pubnub.grant(channel: "demo", manage: false, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/456", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188329" Pubnub::Grant.any_instance.stub(:signature).and_return "Ko3nsNgtSe4IbcJyrePaT50Gf7OKcBPTHcMbLBcT7r0=" envelope = @pubnub.grant(channel: "demo", manage: false, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/457", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188330" Pubnub::Grant.any_instance.stub(:signature).and_return "ZQ8pnzbGnZtdrDyqJraeHeq9GOzgaWhOuXBrlsJ5CK8=" envelope = @pubnub.grant(channel: "demo", manage: false, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/467", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188330" Pubnub::Grant.any_instance.stub(:signature).and_return "HqSzJWRo5xZGB-TKEt6CIzXmeMOWi1Z6srKk231z5JA=" envelope = @pubnub.grant(channel: "demo", manage: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/465", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188331" Pubnub::Grant.any_instance.stub(:signature).and_return "Py2zNh30YKc3TOKzGmFlC1LGCRofDHHdnbEG8BtUKJQ=" envelope = @pubnub.grant(channel: "demo", manage: false, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/466", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188331" Pubnub::Grant.any_instance.stub(:signature).and_return "Py2zNh30YKc3TOKzGmFlC1LGCRofDHHdnbEG8BtUKJQ=" envelope = @pubnub.grant(channel: "demo", manage: false, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/464", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188332" Pubnub::Grant.any_instance.stub(:signature).and_return "me81aGOGfD3UHECsrqr5LqnkTiVimeHTiQbg9KoKXFs=" envelope = @pubnub.grant(channel: "demo", manage: false, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/462", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188333" Pubnub::Grant.any_instance.stub(:signature).and_return "15WUGMtJGPKE6NMOzjpL_HQQY0vz53AetYJKPa8gVao=" envelope = @pubnub.grant(channel: "demo", manage: false, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__false___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/463", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188334" Pubnub::Grant.any_instance.stub(:signature).and_return "cSImww4Doq-RLwWwltO_jkEaJeASBfvHWhq7NRvlRkQ=" envelope = @pubnub.grant(channel: "demo", manage: false, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 0}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/473", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188334" Pubnub::Grant.any_instance.stub(:signature).and_return "TyNx6NN4weprNLS0nQBZHVyS4eW86SsB1X3Aqj6FGlE=" envelope = @pubnub.grant(channel: "demo", ttl: 0, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/471", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188335" Pubnub::Grant.any_instance.stub(:signature).and_return "RYU-fqaXVUclFyZcXu3WoAH2_rTvzifpqp1ipTIZZ9Y=" envelope = @pubnub.grant(channel: "demo", ttl: 0, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/472", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188335" Pubnub::Grant.any_instance.stub(:signature).and_return "RYU-fqaXVUclFyZcXu3WoAH2_rTvzifpqp1ipTIZZ9Y=" envelope = @pubnub.grant(channel: "demo", ttl: 0, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/470", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188336" Pubnub::Grant.any_instance.stub(:signature).and_return "EpbVZMvpSOoY4LA7Ir-K2bGLwSVTW93Btgs5YJCUPQE=" envelope = @pubnub.grant(channel: "demo", ttl: 0, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/468", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188336" Pubnub::Grant.any_instance.stub(:signature).and_return "EpbVZMvpSOoY4LA7Ir-K2bGLwSVTW93Btgs5YJCUPQE=" envelope = @pubnub.grant(channel: "demo", ttl: 0, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/469", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188337" Pubnub::Grant.any_instance.stub(:signature).and_return "3GfqIhkJsXyeuoi3y9CQx5i92tR2NooHW6gDiVkTUHw=" envelope = @pubnub.grant(channel: "demo", ttl: 0, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/479", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188338" Pubnub::Grant.any_instance.stub(:signature).and_return "r-RR5WV79V4Jzi1a4mlR0KuJDULfV8VXD9fQi1LgNMI=" envelope = @pubnub.grant(channel: "demo", ttl: 0, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/477", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188338" Pubnub::Grant.any_instance.stub(:signature).and_return "r-RR5WV79V4Jzi1a4mlR0KuJDULfV8VXD9fQi1LgNMI=" envelope = @pubnub.grant(channel: "demo", ttl: 0, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/478", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188339" Pubnub::Grant.any_instance.stub(:signature).and_return "MLFrCbv6FUXnkl9A1j2pvf1K7SQUfWpQ-7bcLImjKZU=" envelope = @pubnub.grant(channel: "demo", ttl: 0, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/476", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188339" Pubnub::Grant.any_instance.stub(:signature).and_return "MLFrCbv6FUXnkl9A1j2pvf1K7SQUfWpQ-7bcLImjKZU=" envelope = @pubnub.grant(channel: "demo", ttl: 0, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/474", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188340" Pubnub::Grant.any_instance.stub(:signature).and_return "pqop-QimLAUHiK28rzUywIW_AWZi_ZMT5dNALIKZH-4=" envelope = @pubnub.grant(channel: "demo", ttl: 0, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__0___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/475", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188341" Pubnub::Grant.any_instance.stub(:signature).and_return "rNuCPOp0ciR7E9_SrHvevBC8T8cUbS8ON5Dk0ytkTng=" envelope = @pubnub.grant(channel: "demo", ttl: 0, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 0, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/485", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188341" Pubnub::Grant.any_instance.stub(:signature).and_return "E410CzNWVwoBD13Qc6pjHlKld8dBVKVPlVbpdT6mPvM=" envelope = @pubnub.grant(channel: "demo", ttl: 300, auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/483", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188342" Pubnub::Grant.any_instance.stub(:signature).and_return "-z47vc9A3-7bGUMJNkrnY0CEAzZ0ub5uZkqHk5DQNaI=" envelope = @pubnub.grant(channel: "demo", ttl: 300, auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/484", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188342" Pubnub::Grant.any_instance.stub(:signature).and_return "-z47vc9A3-7bGUMJNkrnY0CEAzZ0ub5uZkqHk5DQNaI=" envelope = @pubnub.grant(channel: "demo", ttl: 300, auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/482", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188343" Pubnub::Grant.any_instance.stub(:signature).and_return "-7ubyWEz0K8c4qB8RKVlYk6fqoeG7FhizF3DWq6rAwo=" envelope = @pubnub.grant(channel: "demo", ttl: 300, auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/480", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188343" Pubnub::Grant.any_instance.stub(:signature).and_return "-7ubyWEz0K8c4qB8RKVlYk6fqoeG7FhizF3DWq6rAwo=" envelope = @pubnub.grant(channel: "demo", ttl: 300, auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/481", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188344" Pubnub::Grant.any_instance.stub(:signature).and_return "7KEMTG4QMEOOcclxJ7w3Q7aUebD1SNmqas7CsF27q9g=" envelope = @pubnub.grant(channel: "demo", ttl: 300, auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/491", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188345" Pubnub::Grant.any_instance.stub(:signature).and_return "CkOgQLQupCdOC5x-yg78QhzcSnqc8zGClKGtEAtMm54=" envelope = @pubnub.grant(channel: "demo", ttl: 300, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/489", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188345" Pubnub::Grant.any_instance.stub(:signature).and_return "CkOgQLQupCdOC5x-yg78QhzcSnqc8zGClKGtEAtMm54=" envelope = @pubnub.grant(channel: "demo", ttl: 300, http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/490", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188346" Pubnub::Grant.any_instance.stub(:signature).and_return "1pVxZoL0dHIrXeYewhJuJAzsQ9vvoU9BbQ-y4d9InoE=" envelope = @pubnub.grant(channel: "demo", ttl: 300, http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/488", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188346" Pubnub::Grant.any_instance.stub(:signature).and_return "1pVxZoL0dHIrXeYewhJuJAzsQ9vvoU9BbQ-y4d9InoE=" envelope = @pubnub.grant(channel: "demo", ttl: 300, http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/486", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188347" Pubnub::Grant.any_instance.stub(:signature).and_return "5Ub9K_wLLuwxAg5RNTZ9ZcN39zJ2roL7G_VemfrrOaQ=" envelope = @pubnub.grant(channel: "demo", ttl: 300, http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__300___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/487", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188347" Pubnub::Grant.any_instance.stub(:signature).and_return "5Ub9K_wLLuwxAg5RNTZ9ZcN39zJ2roL7G_VemfrrOaQ=" envelope = @pubnub.grant(channel: "demo", ttl: 300, http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 300, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/497", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188348" Pubnub::Grant.any_instance.stub(:signature).and_return "PSI4S9NkWvyig80KmhqKZSEVqXKS04mXJjnqHogv8JY=" envelope = @pubnub.grant(channel: "demo", auth_key: "ruby-authkey", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/495", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188349" Pubnub::Grant.any_instance.stub(:signature).and_return "KxRg5HKMX-wILufW6kTo0YFh1MKJKIVBkSrVW2JoUSw=" envelope = @pubnub.grant(channel: "demo", auth_key: "ruby-authkey", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/496", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188350" Pubnub::Grant.any_instance.stub(:signature).and_return "761WWuxje14o6vXdm4YR9KP2cy16HrjtyO5wQOgA2vs=" envelope = @pubnub.grant(channel: "demo", auth_key: "ruby-authkey", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/494", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188350" Pubnub::Grant.any_instance.stub(:signature).and_return "761WWuxje14o6vXdm4YR9KP2cy16HrjtyO5wQOgA2vs=" envelope = @pubnub.grant(channel: "demo", auth_key: "ruby-authkey", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/492", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188351" Pubnub::Grant.any_instance.stub(:signature).and_return "9P8B-ywLibZ1S_p4kRQCAc9FYmrZRLeYZrQaVlogCsE=" envelope = @pubnub.grant(channel: "demo", auth_key: "ruby-authkey", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key___ruby-authkey____http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/493", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188351" Pubnub::Grant.any_instance.stub(:signature).and_return "9P8B-ywLibZ1S_p4kRQCAc9FYmrZRLeYZrQaVlogCsE=" envelope = @pubnub.grant(channel: "demo", auth_key: "ruby-authkey", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "user", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channel" => "demo", "auths" => {"ruby-authkey" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/503", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188352" Pubnub::Grant.any_instance.stub(:signature).and_return "e31WH3Eu92BvD7h5Mei-qIkhLcJxWwyQCACzu5SEBjE=" envelope = @pubnub.grant(channel: "demo", http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___block_" do VCR.use_cassette("examples/grant/501", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188352" Pubnub::Grant.any_instance.stub(:signature).and_return "e31WH3Eu92BvD7h5Mei-qIkhLcJxWwyQCACzu5SEBjE=" envelope = @pubnub.grant(channel: "demo", http_sync: true, &@callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__true___callback___lambda_" do VCR.use_cassette("examples/grant/502", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188353" Pubnub::Grant.any_instance.stub(:signature).and_return "sAhM-d54QE6w9Ec2o-eATBilzb8-9ubFTNpMREjE3Ao=" envelope = @pubnub.grant(channel: "demo", http_sync: true, callback: @callback) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback__nil_" do VCR.use_cassette("examples/grant/500", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188354" Pubnub::Grant.any_instance.stub(:signature).and_return "OwDgAkVa1FT-Qq7e_n1JbN2pKroc54Hh3GVa-u_PbFQ=" envelope = @pubnub.grant(channel: "demo", http_sync: false) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___block_" do VCR.use_cassette("examples/grant/498", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188354" Pubnub::Grant.any_instance.stub(:signature).and_return "OwDgAkVa1FT-Qq7e_n1JbN2pKroc54Hh3GVa-u_PbFQ=" envelope = @pubnub.grant(channel: "demo", http_sync: false, &@callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo____group__nil___read__nil___write__nil___manage__nil___ttl__nil___auth_key__nil___http_sync__false___callback___lambda_" do VCR.use_cassette("examples/grant/499", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1464188355" Pubnub::Grant.any_instance.stub(:signature).and_return "by7RQiKOzsMVl82qiEAWa0XteLk-isH0gYhGJ9L15oo=" envelope = @pubnub.grant(channel: "demo", http_sync: false, callback: @callback) envelope = envelope.value expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___delete__true___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1944", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1601665764" Pubnub::Grant.any_instance.stub(:signature).and_return "6_P9JKXY2G7gIdjuRsAhAgcHOcp5tgZt1VUiILsyim8=" envelope = @pubnub.grant(channel: :demo, read: true, write: true, delete: true, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1, "d" => 1, "g" => 0, "u" => 0, "j" => 0}}}) end end it "__channel___demo___group__nil___read__true___write__true___manage__nil___delete__false___ttl__nil___auth_key__nil___http_sync__true___callback__nil_" do VCR.use_cassette("examples/grant/1945", record: :none) do Pubnub::Grant.any_instance.stub(:current_time).and_return "1602781742" Pubnub::Grant.any_instance.stub(:signature).and_return "v2.e1xGxWqMtgai9T7lewHA0A3LiTaBHM7keT6L6sw0F08" envelope = @pubnub.grant(channel: :demo, read: true, write: true, delete: false, http_sync: true) expect(envelope.is_a?(Pubnub::Envelope)).to eq true expect(envelope.error?).to eq false expect(envelope.status[:code]).to eq(200) expect(envelope.status[:category]).to eq(:ack) expect(envelope.status[:config]).to eq({:tls => false, :uuid => "ruby-test-uuid-client-one", :auth_key => "ruby-test-auth-client-one", :origin => "ps.pndsn.com"}) expect(envelope.result[:code]).to eq(200) expect(envelope.result[:operation]).to eq(:grant) expect(envelope.result[:data]).to eq({"level" => "channel", "subscribe_key" => "sub-a-mock-key", "ttl" => 1440, "channels" => {"demo" => {"r" => 1, "w" => 1, "m" => 1, "d" => 0, "g" => 0, "u" => 0, "j" => 0}}}) end end end