class RealPage::DocumentParser::RentMatrices::Rows

Parse the rows from a GetRentMatrix response

Public Instance Methods

parse(rows_hash) click to toggle source

@param rows_hash [Hash<String, Object>] a 'Rows' entry of the XML

response parsed into a Hash

@return [Array<RealPage::Model::RentMatrix::Row>] the rows contained

in this rows_hash

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

# File lib/real_page/document_parser/rent_matrices/rows.rb, line 16
def parse(rows_hash)
  rows = Utils::ArrayFetcher.new(hash: rows_hash, key: 'Row').fetch
  options_parser = Options.new
  rows.map do |row|
    options_hash =
      Utils::ArrayFetcher.new(hash: row, key: 'Options').fetch
    options = options_parser.parse(options_hash)
    attrs = row.merge('Options' => options)
    Model::RentMatrix::Row.new(attrs)
  end
end