/*!
 * 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 || {};
}

Message.prototype.addData = function() {
    if(arguments.length == 1) {
        var obj = arguments[0];
        if (typeof obj === 'object' && Object.keys(obj).length > 0) {
            this.data = obj;
        }
    }
    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) {
    this.addData(key, value);
};

Message.prototype.addDataWithObject = function (obj) {
    this.addData(obj);
};

module.exports = Message;

@@ -999,92 +999,302 @@
     
-this.addData(key, value);%0A%7D;%0A%0AMessage.prototype.addDataWithObject = function (obj) %7B
+console.warn(%22Message#addDataWithKeyValue has been deprecated. Please use Message#addData instead.%22);%0A    this.addData(key, value);%0A%7D;%0A%0AMessage.prototype.addDataWithObject = function (obj) %7B%0A    console.warn(%22Message#addDataWithObject has been deprecated. Please use Message#addData instead.%22);
 %0A   

print deprecation message when using Message#addDataWith*