Module: OData::AbstractSchema::Serializable::EntityTypeInstanceMethods

Defined in:
lib/o_data/abstract_schema/serializable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



32
33
34
35
36
# File 'lib/o_data/abstract_schema/serializable.rb', line 32

def self.included(base)
  base.instance_eval do
    attr_reader *OData::AbstractSchema::Serializable.atom_element_names.collect { |atom_element_name| :"atom_#{atom_element_name}_property" }
  end
end

Instance Method Details

#atom_summary_for(one) ⇒ Object



43
44
45
46
# File 'lib/o_data/abstract_schema/serializable.rb', line 43

def atom_summary_for(one)
  return nil if self.atom_summary_property.blank?
  self.atom_summary_property.value_for(one)
end

#atom_summary_property=(property) ⇒ Object



60
61
62
63
64
65
# File 'lib/o_data/abstract_schema/serializable.rb', line 60

def atom_summary_property=(property)
  return nil unless property.is_a?(Property)
  return nil unless property.return_type.to_s == 'Edm.String'
  return nil unless self.properties.find { |p| p.name == property.name }
  @atom_summary_property = property
end

#atom_title_for(one) ⇒ Object



38
39
40
41
# File 'lib/o_data/abstract_schema/serializable.rb', line 38

def atom_title_for(one)
  return href_for(one) if self.atom_title_property.blank?
  self.atom_title_property.value_for(one)
end

#atom_title_property=(property) ⇒ Object



53
54
55
56
57
58
# File 'lib/o_data/abstract_schema/serializable.rb', line 53

def atom_title_property=(property)
  return nil unless property.is_a?(Property)
  return nil unless property.return_type.to_s == 'Edm.String'
  return nil unless self.properties.find { |p| p.name == property.name }
  @atom_title_property = property
end

#atom_updated_at_for(one) ⇒ Object



48
49
50
51
# File 'lib/o_data/abstract_schema/serializable.rb', line 48

def atom_updated_at_for(one)
  return nil if self.atom_updated_at_property.blank?
  self.atom_updated_at_property.value_for(one)
end

#atom_updated_at_property=(property) ⇒ Object



67
68
69
70
71
72
# File 'lib/o_data/abstract_schema/serializable.rb', line 67

def atom_updated_at_property=(property)
  return nil unless property.is_a?(Property)
  return nil unless %w{Edm.Date Edm.DateTime Edm.Time}.include?(property.return_type.to_s)
  return nil unless self.properties.find { |p| p.name == property.name }
  @atom_updated_at_property = property
end