Changeset 5888 for sandbox/2.4-expresso-api/prototype/api
- Timestamp:
- 04/05/12 17:00:04 (12 years ago)
- Location:
- sandbox/2.4-expresso-api
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4-expresso-api
- Property svn:ignore
-
old new 2 2 header.inc.php 3 3 ._header.inc.php 4 .htaccess.swp
-
- Property svn:ignore
-
sandbox/2.4-expresso-api/prototype/api
-
Property
svn:ignore
set to
.datalayer.js.kate-swp
-
Property
svn:ignore
set to
-
sandbox/2.4-expresso-api/prototype/api/config.php
r5764 r5888 20 20 21 21 static function me($config) 22 { 23 22 { 24 23 return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; 25 24 } -
sandbox/2.4-expresso-api/prototype/api/datalayer.js
r5724 r5888 221 221 222 222 return( result ); 223 }, 224 225 /** 226 * This method is used to read resources from the server. 227 * 228 * @param uri Uri of the resource that gonna be readed. 229 * @param callback A function that is called when the resource is loaded successfully. When the parameter is ignored the request is made synchrounsly. 230 * @param accept The attribute accept that is used to ask the target format to the server 231 * @return The target resource when the callback is ommitted ( made it synchronous ) 232 */ 233 234 read: function( uri, callback, accept ){ 235 //return this.send( this.dispatchPath + 'rest' + uri, [ 'get', accept || 'json' ], false, callback ); 236 //http://expressodev.prognus.com.br/cristiano/expresso-api/rest/maillast 237 238 return this.send( ('rest' + uri), [ 'get', accept || 'json' ], true, callback, !!!callback, 239 {'beforeSend' : function (xhr){ 240 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 241 }); 242 243 }, 244 245 /** 246 * This method is used to create resources from the server. 247 * 248 * @param uri Uri of the resource that gonna be readed. 249 * @param callback A function that is called when the resource is created on the server successfully. When the parameter is ignored the request is made synchrounsly. 250 * @param accept The attribute accept that is used to ask the target format to the server. 251 * @return The result response of the create from the server when the callback is ommitted ( made it synchronous ) 252 */ 253 254 create: function( uri, data, callback, accept ){ 255 256 return this.send( this.dispatchPath + 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback, 257 {'beforeSend' : function (xhr){ 258 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 259 }); 260 261 }, 262 263 /** 264 * This method is used to update resources from the server. 265 * 266 * @param uri Uri of the resource that gonna be readed. 267 * @param callback A function that is called when the resource is update on the server successfully. When the parameter is ignored the request is made synchrounsly. 268 * @param accept The attribute accept that is used to ask the target format to the server 269 * @return The result response of the update from the server when the callback is ommitted ( made it synchronous ) 270 */ 271 272 update: function( uri, data, callback, accept ){ 273 274 return this.send( this.dispatchPath + 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback, 275 {'beforeSend' : function (xhr){ 276 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 277 }); 278 279 }, 280 281 /** 282 * This method is used to delete resources from the server. 283 * 284 * @param uri Uri of the resource that gonna be readed. 285 * @param callback A function that is called when the resource is deleted successfully in the server. When the parameter is ignored the request is made synchrounsly. 286 * @param accept The attribute accept that is used to ask the target format to the server 287 * @return The result response of the delete from the server when the callback is ommitted ( made it synchronous ) 288 */ 289 290 "delete": function( uri, callback, accept ){ 291 292 return this.send( this.dispatchPath + 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback, 293 {'beforeSend' : function (xhr){ 294 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 295 }); 296 223 297 }, 224 298 … … 1991 2065 1992 2066 if( !this.dispatchPath ) 1993 this.dispatchPath = " ../../";2067 this.dispatchPath = "prototype/"; 1994 2068 1995 2069 if( !this.templatePath ) … … 2006 2080 2007 2081 this.start(); 2082 this.me = this.dispatch( "me" ); 2008 2083 } 2009 2084 }
Note: See TracChangeset
for help on using the changeset viewer.