Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RALLY.JsonApi.prototype.capitalize = function(o) {
- if (typeof o == "string") {
- return o.charAt(0).toUpperCase() + o.substr(1).toLowerCase();
- } else {
- return o;
- }
- };
- RALLY.JsonApi.prototype.capitalizedKeys = function(data) {
- var newData = {};
- for(var k in data) {
- newData[this.capitalize(k)] = data[k];
- }
- return newData;
- };
- RALLY.JsonApi.prototype.update = function(typeName, oid, params, processor) {
- var callback = { success: function(o) { processor(o); } };
- var location = this.getRefUrl(typeName, oid);
- var objectName = this.capitalize(typeName)
- var body = {};
- body[objectName] = this.capitalizedKeys(params);
- for (key in this.integrationInfo.headers) { YAHOO.util.Connect.initHeader(key, this.integrationInfo.headers[key]); }
- YAHOO.util.Connect.setDefaultPostHeader('text/json');
- YAHOO.util.Connect.asyncRequest('POST', this.getRefUrl(typeName, oid), callback, YAHOO.lang.JSON.stringify(body));
- };
Add Comment
Please, Sign In to add comment