visoft/ruby_odata — Issue #7: Next pointer
Author: arienmalec
Created: 2011-10-29 00:17:20+00:00
State: open

Atom-based OData supports a next pointer ( The return value of a svc.execute call is an Array of values. The functional programmer in me wants to put the continuation test and query in the return value but that would require changing the data type of the return value (to something enumerable).

=> Alternately, the service itself could contain the next test and pointer

The latter model is probably cleaner with the existing design, but puts the work on the programmer to manage expanding the array, etc.

Here's how I'd like to use the service:

Model #1 (implicit):
svc. Category.filter(foo)
data = svc.execute # automatically traverses all next pointers

Model #2 (explicit):
svc.Category.filter(foo).options(:auto_next => false)
while svc.more?
data.concat(svc.Category.next(svc.next))
end