# File lib/mits/v3.0/mapper/property_mapper.rb, line 42 def primary_id(tags) find_in_tags(tags, 'primaryid') end
module MITS::V3_0::Mapper::PropertyMapper
Public Instance Methods
property(tag)
click to toggle source
# File lib/mits/v3.0/mapper/property_mapper.rb, line 5 def property(tag) basics = property_basics(tag) details = property_details(tag) Property.new(basics.merge(details)) end
Private Instance Methods
company_id(*tags)
click to toggle source
# File lib/mits/v3.0/mapper/property_mapper.rb, line 46 def company_id(*tags) find_in_tags(tags.flatten, 'managementid') end
primary_id(tags)
click to toggle source
property_basics(tag)
click to toggle source
# File lib/mits/v3.0/mapper/property_mapper.rb, line 13 def property_basics(tag) propId = tag[:PropertyID] { company_id: company_id(tag[:Identification], propId[:Identification]), description: tag[:Information][:LongDescription], id: primary_id(propId[:Identification]), name: propId[:MarketingName], summary: tag[:Information][:ShortDescription], type: tag[:ILS_Identification][:ILS_IdentificationType], website: propId[:WebSite] } end
property_details(tag)
click to toggle source
# File lib/mits/v3.0/mapper/property_mapper.rb, line 26 def property_details(tag) details = {} # Optional fields details[:address] = address(tag[:PropertyID][:Address], tag[:ILS_Identification]) if tag[:PropertyID][:Address] details[:amenities] = try(tag[:Amenity], :amenities) details[:deposit] = try(tag[:Deposit], :deposits) details[:fees] = try(tag[:Fee], :fees) details[:files] = try(tag[:File], :files) details[:phones] = try(tag[:PropertyID][:Phone], :phones) details[:policy] = try(tag[:Policy], :policy) details[:floorplans] = try(tag[:Floorplan], :floorplans) details end