/*!
 * node-gcm
 * Copyright(c) 2013 Marcus Farkas <toothlessgear@finitebox.com>
 * MIT Licensed
 */


function Message(obj) {
    if (!(this instanceof Message)) {
        return new Message(obj);
    }

    if (!obj) {
        obj = {};
    }

    this.collapseKey = obj.collapseKey || undefined;
    this.delayWhileIdle = obj.delayWhileIdle || undefined;
    this.timeToLive = obj.timeToLive || undefined;
    this.dryRun = obj.dryRun || undefined;
    this.data = obj.data || {};
    this.notification = obj.notification || {};
}

Message.prototype.addNotification = function() {
    if(arguments.length == 1) {
        var obj = arguments[0];
        if (typeof obj === 'object' && Object.keys(obj).length > 0) {
            this.notification = obj;
        }
        return;
    }
    if(arguments.length == 2) {
        var key = arguments[0], value = arguments[1];
        return this.notification[key] = value;
    }
    throw new Error("Invalid number of arguments given to addNotification ("+arguments.length+")");
};

Message.prototype.addData = function() {
    if(arguments.length == 1) {
        var obj = arguments[0];
        if (typeof obj === 'object' && Object.keys(obj).length > 0) {
            this.data = obj;
        }
        return;
    }
    if(arguments.length == 2) {
        var key = arguments[0], value = arguments[1];
        return this.data[key] = value;
    }
    throw new Error("Invalid number of arguments given to addData ("+arguments.length+")");
};

Message.prototype.addDataWithKeyValue = function (key, value) {
    console.warn("Message#addDataWithKeyValue has been deprecated. Please use Message#addData instead.");
    this.addData(key, value);
};

Message.prototype.addDataWithObject = function (obj) {
    console.warn("Message#addDataWithObject has been deprecated. Please use Message#addData instead.");
    this.addData(obj);
};

module.exports = Message;

@@ -113,19 +113,19 @@
 Message(
-obj
+raw
 ) %7B%0A    
@@ -185,19 +185,19 @@
 Message(
-obj
+raw
 );%0A    %7D
@@ -207,19 +207,19 @@
    if (!
-obj
+raw
 ) %7B%0A    
@@ -222,19 +222,19 @@
         
-obj
+raw
  = %7B%7D;%0A 
@@ -262,19 +262,19 @@
 seKey = 
-obj
+raw
 .collaps
@@ -318,19 +318,19 @@
 eIdle = 
-obj
+raw
 .delayWh
@@ -373,19 +373,19 @@
 oLive = 
-obj
+raw
 .timeToL
@@ -420,19 +420,19 @@
 ryRun = 
-obj
+raw
 .dryRun 
@@ -461,19 +461,19 @@
 .data = 
-obj
+raw
 .data %7C%7C
@@ -501,19 +501,19 @@
 ation = 
-obj
+raw
 .notific

rename obj->raw