Changes

ServiceResponse data structures and generation

678 bytes added, 19:57, 9 February 2009
The handle method
The service can create one or more ServiceResponses. A ServiceResponse normally represents a discrete package of data that will be displayed on some part of the resolve menu. ServiceResponses should generally be created with the convenience method [http://umlaut.rubyforge.org/api/classes/Request.html Request]#add_service_response.
The add_service_response call has you specify the particular service class, the ServiceTypeValue, and arbitrary key value pairs as appropriate/conventional for the given time. For conventions on these key/value pairs, see [http://umlaut.rubyforge.org/api/classes/ServiceResponse.html ServiceResponse]. For example: <pre>request.add_service_response(:service=>self, :service_type_value => :cover_image, :display_text => 'Cover Image', :key=>size, :url => img.inner_html, :asin => asin, :size => size )</pre> The Service code is also responsible for registering a DispatchedService object with the completion state of the service. This should be done with the convenience method [http://umlaut.rubyforge.org/api/classes/Request.html Request]#dispatched . If the service throws an uncaught exception, Umlaut itself will register a DispatchedService with status FailedFatal. But otherwise, the service is responsible for registering a completion status, or Umlaut may not realize the service is complete and continue running it over and over again, or reporting it as timed out.
===callback methods===
Anonymous user