class RealPage::DocumentParser::RentMatrices

Parse the GetRentMatrix response

Private Instance Methods

matrices(body) click to toggle source
# File lib/real_page/document_parser/rent_matrices.rb, line 25
def matrices(body)
  result = body['getrentmatrixResponse']['getrentmatrixResult']
  matrices = result['GetRentMatrix']['RentMatrices']
  Utils::ArrayFetcher.new(hash: matrices, key: 'RentMatrix').fetch
end
parse_body(body) click to toggle source

@param body [Hash<String, Object>] the body of the XML response parsed

into a Hash

@return [Array<RealPage::Model::RentMatrix>] the rent matrices contained

in the response

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

# File lib/real_page/document_parser/rent_matrices.rb, line 16
def parse_body(body)
  row_parser = Rows.new
  matrices(body).map do |matrix|
    rows = row_parser.parse(matrix['Rows'])
    attrs = matrix.merge('Rows' => rows)
    Model::RentMatrix.new(attrs)
  end
end