Skip to content
Browse files

added timeZone and channels installations

  • Loading branch information...
1 parent 4fb3ad6 commit 8451d77b2275d5b7ea80d527462634a4d422a914 @Leveton committed Dec 13, 2012
Showing with 72 additions and 2 deletions.
  1. +36 −1 lib/Parse.js
  2. +36 −1 readme.md
View
37 lib/Parse.js
@@ -87,7 +87,42 @@ Parse.prototype = {
// upload installation data
insertInstallationData: function (deviceType, deviceToken, callback) {
- data = { deviceType: deviceType, deviceToken: deviceToken}
+ if (deviceType === 'ios'){
+ data = { deviceType: deviceType, deviceToken: deviceToken }
+ }
+ else {
+ data = { deviceType: deviceType, installationId: deviceToken }
+ }
+ parseRequest.call(this, 'POST', '/1/installations/', data, callback);
+ },
+
+ insertInstallationDataWithTimeZone: function (deviceType, deviceToken, timeZone, callback) {
+ if (deviceType === 'ios'){
+ data = { deviceType: deviceType, deviceToken: deviceToken, timeZone: timeZone }
+ }
+ else {
+ data = { deviceType: deviceType, installationId: deviceToken, timeZone: timeZone }
+ }
+ parseRequest.call(this, 'POST', '/1/installations/', data, callback);
+ },
+
+ insertInstallationDataWithChannels: function (deviceType, deviceToken, channels, callback) {
+ if (deviceType === 'ios'){
+ data = { deviceType: deviceType, deviceToken: deviceToken, channels: channels }
+ }
+ else {
+ data = { deviceType: deviceType, installationId: deviceToken, channels: channels }
+ }
+ parseRequest.call(this, 'POST', '/1/installations/', data, callback);
+ },
+
+ insertInstallationDataWithTimeZoneAndChannels: function (deviceType, deviceToken, timeZone, channels, callback) {
+ if (deviceType === 'ios'){
+ data = { deviceType: deviceType, deviceToken: deviceToken, timeZone: timeZone, channels: channels }
+ }
+ else {
+ data = { deviceType: deviceType, installationId: deviceToken, timeZone: timeZone, channels: channels }
+ }
parseRequest.call(this, 'POST', '/1/installations/', data, callback);
}
};
View
37 readme.md
@@ -80,11 +80,46 @@ examples
### insert installation data
- //first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. The other args are optional
+ //first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId.
app.insertInstallationData("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", function(err, response){
if (err) {
console.log(err);
} else {
console.log(response);
}
+ });
+
+### insert installation data with timeZone
+
+ //first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. Third arg is the timezone string.
+ app.insertInstallationDataWithTimeZone("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "EST", function(err, response){
+ if (err) {
+ console.log(err);
+ } else {
+ console.log(response);
+ }
+ });
+
+### insert installation data with channels
+
+ //first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. Third arg is the channels array.
+ arr = ["news", "sports"];
+ app.insertInstallationDataWithChannels("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", arr, function(err, response){
+ if (err) {
+ console.log(err);
+ } else {
+ console.log(response);
+ }
+ });
+
+### insert installation data with timeZone and channels
+
+ //first arg is either 'ios' or 'android'. second arg is either the Apple deviceToken or the Android installationId. Third arg is the timezone string. 4th is the channels array.
+ arr = ["news", "sports"];
+ app.insertInstallationDataWithTimeZoneAndChannels("ios", "0123456784abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "EST", arr, function(err, response){
+ if (err) {
+ console.log(err);
+ } else {
+ console.log(response);
+ }
});

0 comments on commit 8451d77

Please sign in to comment.
Something went wrong with that request. Please try again.