consumer

consumer.rubyforge.org

DESCRIPTION:

Consumer is a library for consuming xml resources via Builder, libxml, and some request sending / response marshaling glue. It comes with an app generator that creates an empty ready-for-rails gem that itself comes with a generator for making the request/response classes, config files, and specs (see script/generate after creating a new Consumer project).

FEATURES:

A Consumer request class’s features include required variable checks, a place for in-class and yaml defaults, a ready to use builder object for creating the xml, and a method for sending the xml to the class’s request url that returns Consumer response objects.

Consumer response classes get their features via mixin instead of inheritance (unlike the request classes), so it can return instances of models that already exist in your project. The main feature here is a mapping method that specifies attribute-xpath pairs to map object attributes to an xml response. Multiple mappings can exist for a class, so it can be created from a variety of xml sources. It can return a single response object or an array of response objects, and can set attributes of a response object to other response objects (i.e. it can handle associations).

SYNOPSIS:

FIX (code sample of usage)

REQUIREMENTS:

libxml-ruby builder activesupport

INSTALL:

  • if you haven’t already, gem sources -a http://gems.github.com

  • sudo gem install woahdae-consumer

LICENSE:

(The MIT License)

Copyright © 2008 Woody Peterson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.