Class: OData::EntityType

Inherits:
Type
  • Object
show all
Defined in:
lib/odata/types/entity_type.rb

Instance Attribute Summary collapse

Attributes inherited from Type

#name

Instance Method Summary collapse

Methods inherited from Type

#coerce, #collection?

Constructor Details

#initialize(options = {}) ⇒ EntityType


6
7
8
9
10
11
12
13
# File 'lib/odata/types/entity_type.rb', line 6

def initialize(options = {})
  super
  @abstract   = options[:abstract]
  @base_type  = options[:base_type]
  @open_type  = options[:open_type]
  @has_stream = options[:has_stream]
  @service    = options[:service]
end

Instance Attribute Details

#abstractObject (readonly)

Returns the value of attribute abstract


4
5
6
# File 'lib/odata/types/entity_type.rb', line 4

def abstract
  @abstract
end

#base_typeObject (readonly)

Returns the value of attribute base_type


3
4
5
# File 'lib/odata/types/entity_type.rb', line 3

def base_type
  @base_type
end

Instance Method Details


19
20
21
# File 'lib/odata/types/entity_type.rb', line 19

def navigation_properties
  @navigation_properties ||= @service.navigation_properties_for_type(name)
end

23
24
25
26
27
# File 'lib/odata/types/entity_type.rb', line 23

def navigation_property_by_name(name)
  navigation_properties.find do |navigation_property|
    navigation_property.name == name
  end
end

#propertiesObject


15
16
17
# File 'lib/odata/types/entity_type.rb', line 15

def properties
  @properties ||= @service.properties_for_type(name)
end

#valid_value?(value) ⇒ Boolean


29
30
31
# File 'lib/odata/types/entity_type.rb', line 29

def valid_value?(value)
  value.respond_to?(:odata_type) && (name == value.odata_type || name == value.class.superclass.odata_type.name)
end