class Frodo::EntityContainer
Attributes
metadata[R]
The EntityContainer's metadata
service[R]
The EntityContainer's parent service
Public Class Methods
new(service)
click to toggle source
Creates a new EntityContainer
@param service [Frodo::Service] The entity container's parent service
# File lib/frodo/entity_container.rb, line 11 def initialize(service) @metadata = service.metadata.xpath('//EntityContainer').first @service = service end
Public Instance Methods
[](entity_set_name)
click to toggle source
Retrieves the EntitySet
associated with a specific EntityType by name
@param entity_set_name [to_s] the name of the EntitySet
desired @return [Frodo::EntitySet] an Frodo::EntitySet
to query
# File lib/frodo/entity_container.rb, line 49 def [](entity_set_name) xpath_query = "//EntitySet[@Name='#{entity_set_name}']" entity_set_node = metadata.xpath(xpath_query).first raise ArgumentError, "Unknown Entity Set: #{entity_set_name}" if entity_set_node.nil? entity_type = entity_set_node.attributes['EntityType'].value Frodo::EntitySet.new( name: entity_set_name, namespace: namespace, type: entity_type, service_name: service.name, container: name ) end
actions()
click to toggle source
# File lib/frodo/entity_container.rb, line 67 def actions # TODO return action imports exposed by this EntityContainer end
entity_sets()
click to toggle source
Returns a hash of EntitySet
names and their respective EntityTypes. @return [Hash<String, String>]
# File lib/frodo/entity_container.rb, line 36 def entity_sets @entity_sets ||= metadata.xpath('//EntitySet').map do |entity| [ entity.attributes['Name'].value, entity.attributes['EntityType'].value ] end.to_h end
functions()
click to toggle source
# File lib/frodo/entity_container.rb, line 71 def functions # TODO return function imports exposed by this EntityContainer end
name()
click to toggle source
Returns the EntityContainer's name. @return [String]
# File lib/frodo/entity_container.rb, line 30 def name @name ||= metadata.attributes['Name'].value end
namespace()
click to toggle source
Returns the EntityContainer's namespace. @return [String]
# File lib/frodo/entity_container.rb, line 24 def namespace @namespace ||= schema.attributes['Namespace'].value end
schema()
click to toggle source
The EntityContainer's surrounding Schema
@return [Nokogiri::XML]
# File lib/frodo/entity_container.rb, line 18 def schema @schema ||= metadata.ancestors('Schema').first end
singletons()
click to toggle source
# File lib/frodo/entity_container.rb, line 63 def singletons # TODO return singletons exposed by this EntityContainer end