visoft/ruby_odata — Issue #11: Support for introspecting collection EntityType
Author: tardate
Created: 2011-11-13 03:11:28+00:00
State: open

I am using ruby_odata for generalised data discovery (see http://rgovdata.com), so ideally I want to rely 100% on metadata for access.

Perhaps I have missed something, or don't know the OData spec well enough, but while I can access the collections (@collections) and the entity types (@classes) and entity metadata (@class_metadata), it seems only a matter of convention that relates the collection to the associated entity. i.e. using just ruby_odata, I can't know in advance what entity will be returned from a given collection (but I can make a good guess).

e.g.
Given the following (a simplified version of [this](http://api.projectnimbus.org/snbodataservice.svc/$metadata)):

..

..then @collections is the array of EntitySet names from the EntityContainer collection, and @classes is the array of EntityType names with associated @class_metadata. In this example, "ATMSet" is a collection of "ATM" entities, but I only know that by linguistic inference.

There are two parts to what I'd like to be able to do:

* given an OData::Service instance
* then I can get the collections it offers (i.e. @collections, but exposed with a public getter)
* given a collection
* then I can get the entity type it contains / will return

The collection information is in the EntitySet definition (EntityType) but is currently not pulled/exposed by ruby_odata. I currently hack around these limitations, but it would be nice to have this formally supported by ruby_odata.