Class: OData::Association::End

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ End

Returns a new instance of End.

Raises:

  • (ArgumentError)


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

def initialize(options)
  @entity_type = options[:entity_type]
  @multiplicity = self.class.multiplicity_map[options[:multiplicity].to_s]

  raise ArgumentError, ':entity_type option is required' if entity_type.nil? || entity_type == ''
  raise ArgumentError, ':multiplicity option is required' if multiplicity.nil?
  raise ArgumentError, ':multiplicity option must be one of [1, *, 0..1]' unless valid_multiplicities.include?(multiplicity)
end

Instance Attribute Details

#entity_typeObject (readonly)

Returns the value of attribute entity_type.



4
5
6
# File 'lib/odata/association/end.rb', line 4

def entity_type
  @entity_type
end

#multiplicityObject (readonly)

Returns the value of attribute multiplicity.



4
5
6
# File 'lib/odata/association/end.rb', line 4

def multiplicity
  @multiplicity
end

Class Method Details

.multiplicity_mapObject



15
16
17
18
19
20
21
# File 'lib/odata/association/end.rb', line 15

def self.multiplicity_map
  {
      '1'     => :one,
      '*'     => :many,
      '0..1'  => :zero_to_one
  }
end