Skip to content

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

Open

Description

@richardwan

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

Activity

  1. adamvduke commented on May 10, 2015

    @adamvduke
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions