class RGovData::OdataDataSet

This is the catalog class that describes an OData Service DataSet

Public Instance Methods

attributes() click to toggle source

Returns the attribute names based on class meta-data

> overrides RGovData::Dn.attributes

# File lib/rgovdata/service/dataset/odata_dataset.rb, line 6
def attributes
  @attributes ||= native_service.class_metadata[entity_name].keys
end
entity_name() click to toggle source

Returns the reated OData entity name for this DataSet TODO: currently, this is a hack, as ruby_odata doesn’t yet return the collection EntityType

# File lib/rgovdata/service/dataset/odata_dataset.rb, line 12
def entity_name
  dataset_key.gsub(/Set$/,'')
end

Protected Instance Methods

load_instance() click to toggle source

Loads the native OData::QueryBuilder

> overrides RGovData::DataSet.load_instance

# File lib/rgovdata/service/dataset/odata_dataset.rb, line 18
def load_instance
  native_service.send(native_dataset_key)
end
load_records() click to toggle source

Loads the native record set

> overrides RGovData::DataSet.load_records

# File lib/rgovdata/service/dataset/odata_dataset.rb, line 25
def load_records
  native_instance(true)
  native_instance.top(limit) if limit.present?
  Array(service.native_instance.execute)
end