lib/rentlinx/modules/amenity_client_methods.rb
# Submits amenities to the batch endpoint on Rentlinx
#
# @param amenities [Array] an array of amenity objects
Submits amenities to the batch endpoint on Rentlinx
Submits amenities to the batch endpoint on Rentlinx
def post_amenities(amenities)
      return if amenities.nil?
      raise(Rentlinx::InvalidObject, amenities.find { |a| !a.valid? }) unless amenities.all?(&:valid?)
      raise(Rentlinx::IncompatibleGroupOfObjectsForPost, 'propertyID') unless amenities.all? { |p| p.propertyID == amenities.first.propertyID }
      property_amenities = amenities.select { |p| p.class == Rentlinx::PropertyAmenity }
      unit_amenities = amenities - property_amenities
      post_property_amenities(property_amenities) unless property_amenities.empty?
      post_unit_amenities(unit_amenities) unless unit_amenities.empty?
    end
def post_amenities ( amenities ) return if amenities . nil? raise ( Rentlinx :: InvalidObject , amenities . find { | a | ! a . valid? } ) unless amenities . all? ( & :valid? ) raise ( Rentlinx :: IncompatibleGroupOfObjectsForPost , 'propertyID' ) unless amenities . all? { | p | p . propertyID == amenities . first . propertyID } property_amenities = amenities . select { | p | p . class == Rentlinx :: PropertyAmenity } unit_amenities = amenities - property_amenities post_property_amenities ( property_amenities ) unless property_amenities . empty? post_unit_amenities ( unit_amenities ) unless unit_amenities . empty? end
Submits amenities to the batch endpoint on Rentlinx
Submits amenities to the batch endpoint on Rentlinx
amenities
an array of amenity objects
an array of amenity objects