Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client#broadcast has no support for optional channel described in the api #8

Open
richardwan opened this issue May 8, 2015 · 1 comment

Comments

@richardwan
Copy link

https://zeropush.readme.io/v1.5/docs/broadcast
says there is an optional channel with a broadcast. but the client.rb file looks like it does not supply a channel. I could monkey-patch my code or take a stab at making a PR for this

@adamvduke
Copy link
Member

Hey @richardwan,

The broadcast method on the client takes a hash of params and does the 'right' thing with them. If you pass a channel in the params it will get encoded correctly and the API will broadcast to only those devices. Your code should look something like the following:

require 'zero_push'

ZeroPush.auth_token = 'auth-token'
response = ZeroPush.broadcast(
  channel: 'channel-name',
  alert: "You've got mail!"
)
puts response.body
# => {"sent_count"=>2}

Does that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants