Class: ResoTransport::EntityType
- Inherits:
-
Struct
- Object
- Struct
- ResoTransport::EntityType
- Defined in:
- lib/reso_transport/entity_type.rb
Instance Attribute Summary collapse
-
#base_type ⇒ Object
Returns the value of attribute base_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#primary_key ⇒ Object
Returns the value of attribute primary_key.
-
#schema ⇒ Object
Returns the value of attribute schema.
Class Method Summary collapse
Instance Method Summary collapse
- #enumerations ⇒ Object
- #navigation_properties ⇒ Object
- #navigation_property_map ⇒ Object
- #parse(record) ⇒ Object
- #parse_value(record) ⇒ Object
- #properties ⇒ Object
- #property_map ⇒ Object
Instance Attribute Details
#base_type ⇒ Object
Returns the value of attribute base_type
2 3 4 |
# File 'lib/reso_transport/entity_type.rb', line 2 def base_type @base_type end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/reso_transport/entity_type.rb', line 2 def name @name end |
#primary_key ⇒ Object
Returns the value of attribute primary_key
2 3 4 |
# File 'lib/reso_transport/entity_type.rb', line 2 def primary_key @primary_key end |
#schema ⇒ Object
Returns the value of attribute 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
#enumerations ⇒ Object
42 43 44 |
# File 'lib/reso_transport/entity_type.rb', line 42 def enumerations @enumerations ||= [] end |
#navigation_properties ⇒ Object
38 39 40 |
# File 'lib/reso_transport/entity_type.rb', line 38 def @navigation_properties ||= [] end |
#navigation_property_map ⇒ Object
34 35 36 |
# File 'lib/reso_transport/entity_type.rb', line 34 def @navigation_property_map ||= .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] || [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] || [k]) record[k] = property.parse(v) end end end |
#properties ⇒ Object
30 31 32 |
# File 'lib/reso_transport/entity_type.rb', line 30 def properties @properties ||= [] end |
#property_map ⇒ Object
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 |