class RealPage::DocumentParser::RentMatrices::Options

Parse the options from a GetRentMatrix response

Public Instance Methods

parse(options_array) click to toggle source

@param options_array [Array<Hash>] a 'Options' entry of the XML

response parsed into an array

@return [Array<RealPage::Model::RentMatrix::Option>] the options

contained in this row

@raise [RealPage::Error::Base] if the response is invalid

# File lib/real_page/document_parser/rent_matrices/options.rb, line 13
def parse(options_array)
  options_array.map do |option_hash|
    options = option_hash['Option']
    options = [options] unless options.is_a?(Array)
    options.map do |option|
      concessions =
        Model::RentMatrix::Concessions.new(option['Concessions'])
      attrs = option.merge(
        'Concessions' => concessions,
        'LeaseStartDate' => option_hash['LeaseStartDate']
      )
      Model::RentMatrix::Option.new(attrs)
    end
  end.flatten
end