Module: MITS::V4_1::Mapper::UnitsMapper

Included in:
MITS::V4_1::Mapper
Defined in:
lib/mits/v4.1/mapper/units_mapper.rb

Instance Method Summary collapse

Instance Method Details

#units(tags) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/mits/v4.1/mapper/units_mapper.rb', line 5

def units(tags)
  tags = [tags] unless tags.is_a? Array
  tags.map do |tag|
    Unit.new(bathrooms: try(tag[:UnitBathrooms], :to_f),
             bedrooms:  try(tag[:UnitBedrooms], :to_f),
             name:      tag[:MarketingName],
             rent:      try(tag[:UnitRent], :to_f),
             sqft:      unit_sqft(tag))
  end
end