README.markdown in c2dm-0.1.6 vs README.markdown in c2dm-0.2.0
- old
+ new
@@ -10,46 +10,57 @@
An Android device running 2.2 or newer, its registration token, and a google account registered for c2dm.
##Usage
+*Important*: Version 0.2.0+ decouples auth from sending so the API changed. Please update your code.
+
There are two ways to use c2dm.
Sending many notifications:
-```notifications = [
- {
- :registration_id => "...",
- :data => {
- :some_message => "Some payload"
- :another_message => 10
- },
- :collapse_key => "foobar" #optional
- }
-]
-C2DM.send_notifications("someone@gmail.com", "and_their_password", notifications, "MyCompany-MyApp-1.0.0")```
+ notifications = [
+ {
+ :registration_id => "...",
+ :data => {
+ :some_message => "Some payload"
+ :another_message => 10
+ },
+ :collapse_key => "foobar" #optional
+ }
+ ]
+
+ C2DM.authenticate!("your@googleuser.com", "somepassword", "YourCo-App-1.0.0")
+ C2DM.send_notifications(notifications)
...or one at a time:
-```c2dm = C2DM.new("someone@gmail.com", "and_their_password", "MyCompany-MyApp-1.0")
-notification = {
- :registration_id => "...",
- :data => {
- :some_message => "Some payload",
- :another_message => 10
- },
- :collapse_key => "foobar" #optional
-}
+ C2DM.authenticate!("your@googleuser.com", "somepassword", "YourCo-App-1.0.0")
+ c2dm = C2DM.new
-c2dm.send_notification(notification)```
+ notification = {
+ :registration_id => "...",
+ :data => {
+ :some_message => "Some payload",
+ :another_message => 10
+ },
+ :collapse_key => "foobar" #optional
+ }
+ c2dm.send_notification(notification)
+
+Note that calling *authenticate!* will authenticate all new instances of C2DM. You can override this by passing in your own auth_token:
+
+ c2dm = C2DM.new(auth_token)
+
##Copyrights
-* Copyright (c) 2010-2011 Amro Mousa, Shawn Veader. See LICENSE.txt for details.
+* Copyright (c) 2010-2012 Amro Mousa, Shawn Veader. See LICENSE.txt for details.
##Thanks
* [Paul Chun](https://github.com/sixofhearts)
+* [gowalla](https://github.com/gowalla)
##Other stuff
You might want to checkout GroupMe's fork of this gem as well.
\ No newline at end of file