A ruby gem to communicate with Microsoft Push Notification Service.
From the commande line:
gem install ruby-mpns
Or in your gemfile:
gem 'ruby-mpns'
To use it just use the singleton MicrosoftPushNotificationService
like the following:
uri = "http://my-uri.com/to/the-windows-phone-i-am-targetting"
options = {
title: "Hello !",
content: "Hello Push Notification.",
params: {
any_data: 2,
another_key: "Hum..."
}
}
# response is an Net::HTTP object
reponse = MicrosoftPushNotificationService.send_notification uri, :toast, options
See sample/sample_usage.rb
for more samples.
The following notification parameters can be defined in the options hash for :toast
:
title
- the titlecontent
- the contentparams
- a hash that will be transformed intokey1=value1&key2=value2...
You can pass whatever hash you want and an XML will be generated, like the following:
<root>
<key1>value1</key1>
<key2>value2</key2>
<subtree>
<subkey>value</subkey>
</subtree>
</root>
The following notification parameters can be defined in the options hash for :tile
:
title
- the titlecount
- the badge to display on the app tilebackground_image
- the path to a local image embedded in the app or an image accessible via HTTP (.jpg or .png, 173x137px, max 80kb)back_title
- the title when the tile is flippedback_background_image
- the path to a local image embedded in the app or an image accessible via HTTP (.jpg or .png, 173x137px, max 80kb)back_content
- the content when the tile is flippednavigation_uri
(optional) - the exact navigation URI for the tile to update, only needed if you wish to update a secondary tile
For general information about Push Notification on Windows Phone check the MSDN.
- Support HTTPS
- Support sending raw notification data in other formats like text, bytes or JSON
- Add an ActiveRecord extension (acts_as_microsoft_pushable)
Copyright (c) 2012 Nicolas VERINAUD. Released under the MIT license.