Class: RealPage::DocumentParser::RentMatrices::Rows

Inherits:
Base
  • Object
show all
Defined in:
lib/real_page/document_parser/rent_matrices/rows.rb

Overview

Parse the rows from a GetRentMatrix response

Instance Attribute Summary

Attributes inherited from Base

#request_name, #request_params

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RealPage::DocumentParser::Base

Instance Method Details

#parse(rows_hash) ⇒ Array<RealPage::Model::RentMatrix::Row>

Returns the rows contained in this rows_hash.

Parameters:

  • rows_hash (Hash<String, Object>)

    a ‘Rows’ entry of the XML response parsed into a Hash

Returns:

Raises:

  • (RealPage::Error::Base)

    if the response is invalid



16
17
18
19
20
21
22
23
24
25
26
# 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