NAME
Asynapse.REST - Asynapse REST Client
VERSION
This document describes Asynapse.REST version 0.10
SYNOPSIS
# Define Your own AsynapseRecord Class.
Person = new AsynapseRecord('person')
# Use it
var p = Person.find(1)
DESCRIPTION
Asynapse.REST is the namespace for being a general REST client in Asynapse framework. Under this namespace, so far we arrange Asynapse.REST.Model for Asynapse Model Classes. It means to provide an abstration layer for data existing at given REST server(s).
With many flavours of data abstration layer in the world, we choose to emulate ActiveRecord as our first target, which has a plain simple object semantics, and very compatible to javascript. The implementation of it called AsynapseRecord.
To use it, you must first create your own record classes, like this:
Person = new AsynapseRecord('person')
After this, Person becomes your Person model class, and then you can do:
var p = Person.find(1)
To find a person by its id. Besides find, create, update, and delete are also implemented.
Here's more detail about how to use these interfaces. They are all "class methods".
- find( id )
-
Retrieve a record from this model with given id.
- create( attr )
-
Create a new with attributes specified in attr hash.
- update( id, attr )
-
Update the record with primary key id with new sets of attributes specified in attr hash.
- delete( id )
-
Remove the record with given id.
CONFIGURATION AND ENVIRONMENT
AsynapseRecord requires no configuration files or environment variables. However, you need a Jifty instance with REST plugin (which is given by default now.)
Since JavaScript cannot do XSS, it assumed the your Jifty instance's URL resides at /, and entry points of REST servces starts from /=/. It should be made possible to change this assumption in the future to match more presets in different frameworks.
BUGS AND LIMITATIONS
The asynapse project is hosted at http://code.google.com/p/asynapse/. You may contact the authors or submit issues using the web interface.
AUTHOR
Kang-min Liu <gugod@gugod.org>
LICENCE AND COPYRIGHT
Copyright (c) 2007, Kang-min Liu <gugod@gugod.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.