decision-labs / gcm

A gem that helps developers send data from ruby backend servers to their Mobile applications on devices via Google Cloud Messaging (GCM).
MIT License
385 stars 61 forks source link

fix for #17 - #18

Closed ghost closed 9 years ago

ghost commented 9 years ago

fix for #17 - There is a bug in Google documentation. The request should include the notification key like this

to: <notification_key>

rather than

notification_key: <notification_key>

The request will also fail if it includes a registration_ids array, even if it is empty.

See this StackOverflow post for more - http://stackoverflow.com/questions/19720767/gcm-user-notifications-missing-registration-ids-field/25183892#25183892

This pull request adds a method #send_with_notification_key which formats the request correctly.

I haven't added any further tests as I'm not that familar with how you are mocking the requests, but the few existing tests are passing ok. I'll try to get a chance to add some tests at some stage.

kashif commented 9 years ago

looks great! Just came back after a long day, I will check in the morning and cut a new version hopefully! :gem: thank you!