Class: OData::Association

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_odata/association.rb

Overview

Internal class used to represent object associations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nav_prop_element, edmx) ⇒ Association



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby_odata/association.rb', line 7

def initialize(nav_prop_element, edmx)
  @edmx = edmx

  # Get the edm namespace because it varies by version
  root = @edmx.xpath("/edmx:Edmx").first
  @version = root['Version'].to_i
  edmxurl = root.namespaces['xmlns:edmx']
  ds = @edmx.xpath("edmx:Edmx/edmx:DataServices/*", "edmx" => edmxurl).first
  edm_ns = ds.namespaces['xmlns'].to_s
  @edmx_namespaces = { "edmx" => edmxurl, "edm" => edm_ns }
  parse_nav_prop(nav_prop_element)
end

Instance Attribute Details

#from_roleObject (readonly)

Returns the value of attribute from_role



5
6
7
# File 'lib/ruby_odata/association.rb', line 5

def from_role
  @from_role
end

#nameObject (readonly)

Returns the value of attribute name



5
6
7
# File 'lib/ruby_odata/association.rb', line 5

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace



5
6
7
# File 'lib/ruby_odata/association.rb', line 5

def namespace
  @namespace
end

#relationshipObject (readonly)

Returns the value of attribute relationship



5
6
7
# File 'lib/ruby_odata/association.rb', line 5

def relationship
  @relationship
end

#to_roleObject (readonly)

Returns the value of attribute to_role



5
6
7
# File 'lib/ruby_odata/association.rb', line 5

def to_role
  @to_role
end