Class: ResoTransport::EntityType

Inherits:
Struct
  • Object
show all
Defined in:
lib/reso_transport/entity_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_typeObject

Returns the value of attribute base_type

Returns:

  • (Object)

    the current value of base_type



2
3
4
# File 'lib/reso_transport/entity_type.rb', line 2

def base_type
  @base_type
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



2
3
4
# File 'lib/reso_transport/entity_type.rb', line 2

def name
  @name
end

#primary_keyObject

Returns the value of attribute primary_key

Returns:

  • (Object)

    the current value of primary_key



2
3
4
# File 'lib/reso_transport/entity_type.rb', line 2

def primary_key
  @primary_key
end

#schemaObject

Returns the value of attribute schema

Returns:

  • (Object)

    the current value of schema



2
3
4
# File 'lib/reso_transport/entity_type.rb', line 2

def schema
  @schema
end

Class Method Details

.from_stream(args) ⇒ Object



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

def self.from_stream(args)
  new(args["Name"], args["BaseType"])
end

Instance Method Details

#enumerationsObject



42
43
44
# File 'lib/reso_transport/entity_type.rb', line 42

def enumerations
  @enumerations ||= []
end


38
39
40
# File 'lib/reso_transport/entity_type.rb', line 38

def navigation_properties
  @navigation_properties ||= []
end


34
35
36
# File 'lib/reso_transport/entity_type.rb', line 34

def navigation_property_map
  @navigation_property_map ||= navigation_properties.inject({}) {|hsh, p| hsh[p.name] = p; hsh }
end

#parse(record) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/reso_transport/entity_type.rb', line 8

def parse(record)
  record.each_pair do |k,v|
    next if v.nil?
    if property = (property_map[k] || navigation_property_map[k])
      record[k] = property.parse(v)
    end
  end
end

#parse_value(record) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/reso_transport/entity_type.rb', line 17

def parse_value(record)
  record.each_pair do |k,v|
    next if v.nil?
    if property = (property_map[k] || navigation_property_map[k])
      record[k] = property.parse(v)
    end
  end
end

#propertiesObject



30
31
32
# File 'lib/reso_transport/entity_type.rb', line 30

def properties
  @properties ||= []
end

#property_mapObject



26
27
28
# File 'lib/reso_transport/entity_type.rb', line 26

def property_map
  @property_map ||= properties.inject({}) {|hsh, p| hsh[p.name] = p; hsh }
end