Class: RealPage::DocumentParser::GuestCards::Amenities

Inherits:
Base
  • Object
show all
Defined in:
lib/real_page/document_parser/guest_cards/amenities.rb

Overview

Parse the Amenities from a GuestCards response. RealPage spells everything “amentities”, so we also correct for that.

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(amenities_hash) ⇒ Array<RealPage::Model::Amenity>

Returns the amenities contained in this amenities_hash.

Parameters:

  • amenities_hash (Array<Hash<String, Object>>)

    an ‘Amentities’ 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
# File 'lib/real_page/document_parser/guest_cards/amenities.rb', line 16

def parse(amenities_hash)
  amenities(amenities_hash).map do |amenity|
    attrs = amenity.dup
    # RealPage spells AmenityID wrong
    attrs['AmenityID'] = attrs.delete('AmentityID')
    Model::Amenity.new(attrs)
  end
end