require 'real_page/document_parser/leases' require 'real_page/request_section/parameter' require_relative 'base' module RealPage module Request # Retrieve current resident leases for a given traffic source that begin # within the specified date range. # # Required intializer parameters: # # @param pmc_id [String] the unique identifier for the property management # company in RealPage # @param site_id [String] the unique identifier for the property in RealPage # @param traffic_source_id [String] the identifier for the # marketing/traffic source used to query leases # @param start_date [Date] the start of the date range for the query # @param end_date [Date] the end of the date range for the query class GetLeasesByTrafficSource < Base private attr_reader :traffic_source_id, :start_date, :end_date, :request_params def after_initialize(params) %i[traffic_source_id start_date end_date].each do |required_param| unless params[required_param] raise ArgumentError, "Params must include :#{required_param}" end end @traffic_source_id = params[:traffic_source_id] @start_date = params[:start_date] @end_date = params[:end_date] @request_params = params end def parser DocumentParser::Leases.new( request_params: request_params, request_name: request_name ) end def request_name self.class.name.split('::').last end def sections [ RequestSection::Parameter.new( traffic_source_id: traffic_source_id, start_date: start_date, end_date: end_date ) ] end end end end