Class: RealPage::DocumentParser::RentMatrices::Options

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

Overview

Parse the options 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(options_array) ⇒ Array<RealPage::Model::RentMatrix::Option>

Returns the options contained in this row.

Parameters:

  • options_array (Array<Hash>)

    a ‘Options’ entry of the XML response parsed into an array

Returns:

Raises:

  • (RealPage::Error::Base)

    if the response is invalid



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