class OData::AbstractSchema::Base
Attributes
entity_types[RW]
namespace[RW]
Public Class Methods
new(namespace = "OData")
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 7 def initialize(namespace = "OData") @namespace = namespace @entity_types = [] end
Public Instance Methods
Association(*args)
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 13 def Association(*args) Association.new(self, *args) end
EntityType(*args)
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 17 def EntityType(*args) entity_type = EntityType.new(self, *args) @entity_types << entity_type entity_type end
Query(*args)
click to toggle source
# File lib/o_data/abstract_query/base.rb, line 128 def Query(*args) OData::AbstractQuery::Base.new(self, *args) end
associations()
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 23 def associations @entity_types.collect(&:navigation_properties).flatten.collect(&:association).uniq end
find_entity_type(options = {})
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 27 def find_entity_type(options = {}) if options[:name] self.entity_types.find { |et| et.name == options[:name].to_s } else nil end end
inspect()
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 39 def inspect "#<< #{namespace.to_s}(#{@entity_types.collect(&:name).join(', ')}) >>" end
qualify(str)
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 35 def qualify(str) namespace.to_s + '.' + str.to_s end
to_json()
click to toggle source
# File lib/o_data/abstract_schema/base.rb, line 43 def to_json { "d" => { "EntitySets" => @entity_types.collect(&:plural_name).sort } }.to_json end