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

send_notification (single notification!) is returning an array of responses #9

Open
LucasLMartini opened this issue Jun 20, 2013 · 0 comments

Comments

@LucasLMartini
Copy link

This is really minor, but I cracked my head here for half an hour figuring this out:

In gcm/core.rb, you use send_notifications (plural) inside send_notification (singular).

Problem is, the plural form expects multiple responses, and, rightly so, it delivers an array of responses.

But in send_notification (singular), the user would be expecting a single response object, in this method there's no reason to return an array, because there will be a single response for a single notification.

Change send_notification like so below and problem SHOULD be solved (didn't test):

def self.send_notification(device_tokens, data = {}, options = {})
  n = GCM::Notification.new(device_tokens, data, options)
  self.send_notifications([n])[0]
end

This might also apply to APNS and Microsoft, but I've only delved in GCM so far!

Thanks for the great gem!

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

1 participant