On Wed, Dec 06, 2006 at 10:08:08AM -0500, Christopher Heschong wrote: > Hi, I've created a simple library to make calls to REST services, along > with an associated Catalyst model, and wanted to get some feedback. The > class itself is called CRUST and basically it's just some very simple glue > for URI, LWP, XML::Simple (although any other serialization formatters are > supported). GET and POST are supported of course.
My first thought is that you are going to need to support the full range of HTTP Methods. At the very least, you will need: GET, POST, PUT and DELETE. You probably want to support OPTIONS and HEAD as well. > Here's an example of how I might use it to talk to Yahoo! Answers: > > # Create a CRUST model > package MyApp::Model::Amazon; > use base 'Catalyst::Model::CRUST'; > > __PACKAGE__->config( > base => 'http://answers.yahooapis.com/AnswersService/V1/', > query => { appid => 'YahooDemo' } > ); The query part might be better named "params", since that's what Catalyst uses. > # Meanwhile in a controller nearby > $c->stash->{answers} = $c->model('YahooAnswers')->get( 'questionSearch', > query => $c->req->param('query') > ); Ew! Do they really have URLs like questionSearch and getByCategory? Very un-RESTful. > Does anyone find this useful? SVN snapshot is available: > http://svn.screwdriver.net/repos/code/CRUST > > Should this sort of thing being uploaded to CPAN? Anyone want to review > the code beforehand? Something like this is both useful and good. I'm not certain what the best way to implement it is. I'll try and find some time to look at your code soon. Adam _______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
