Sha256: 9ca2d38072763af6aedac0fe3f0b635cce595e6216895acf28ad5d45f585e0a6
Contents?: true
Size: 1.21 KB
Versions: 6
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'yardi/utils/phone_parser' module Yardi module Model class Resident attr_reader :status, :lease_id, :lease_lead_id, :first_name, :last_name, :email, :phones, :unit_name, :move_in_date, :lease_from_date, :lease_to_date, :type, :roommates, :import_resident_id def initialize(resident, type:, roommates: nil) @status = resident['Status'] @lease_id = resident['tCode'] @lease_lead_id = resident['pCode'] @first_name = resident['FirstName'] @last_name = resident['LastName'] @email = resident['Email'] @unit_name = resident['UnitCode'] @phones = Utils::PhoneParser.parse(resident['Phone']) @move_in_date = parse_date(resident['MoveInDate']) @lease_from_date = parse_date(resident['LeaseFromDate']) @lease_to_date = parse_date(resident['LeaseToDate']) @type = type @roommates = roommates || [] @import_resident_id = resident['import_resident_id'] end private # Residents may not have LeaseFromDate or LeaseToDate. def parse_date(date) date && Date.strptime(date, '%m/%d/%Y') end end end end
Version data entries
6 entries across 6 versions & 1 rubygems