Class: FrOData::NavigationProperty
- Inherits:
-
Object
- Object
- FrOData::NavigationProperty
- Defined in:
- lib/frodata/navigation_property.rb,
lib/frodata/navigation_property/proxy.rb
Defined Under Namespace
Classes: Proxy
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nullable ⇒ Object
readonly
Returns the value of attribute nullable.
-
#partner ⇒ Object
readonly
Returns the value of attribute partner.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #entity_type ⇒ Object
-
#initialize(options) ⇒ NavigationProperty
constructor
A new instance of NavigationProperty.
- #nav_type ⇒ Object
Constructor Details
#initialize(options) ⇒ NavigationProperty
Returns a new instance of NavigationProperty.
7 8 9 10 11 12 |
# File 'lib/frodata/navigation_property.rb', line 7 def initialize() @name = [:name] or raise ArgumentError, 'Name is required' @type = [:type] or raise ArgumentError, 'Type is required' @nullable = [:nullable] || true @partner = [:partner] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/frodata/navigation_property.rb', line 5 def name @name end |
#nullable ⇒ Object (readonly)
Returns the value of attribute nullable.
5 6 7 |
# File 'lib/frodata/navigation_property.rb', line 5 def nullable @nullable end |
#partner ⇒ Object (readonly)
Returns the value of attribute partner.
5 6 7 |
# File 'lib/frodata/navigation_property.rb', line 5 def partner @partner end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/frodata/navigation_property.rb', line 5 def type @type end |
Class Method Details
.build(nav_property_xml) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/frodata/navigation_property.rb', line 22 def self.build(nav_property_xml) = nav_property_xml.attributes.map do |name, attr| [name.downcase.to_sym, attr.value] end.to_h new() end |
Instance Method Details
#entity_type ⇒ Object
18 19 20 |
# File 'lib/frodata/navigation_property.rb', line 18 def entity_type @entity_type ||= type.split(/[()]/).last end |
#nav_type ⇒ Object
14 15 16 |
# File 'lib/frodata/navigation_property.rb', line 14 def nav_type @nav_type ||= type =~ /^Collection/ ? :collection : :entity end |