app/models/caboose_rets/property.rb in caboose-rets-0.1.36 vs app/models/caboose_rets/property.rb in caboose-rets-0.1.37
- old
+ new
@@ -1,204 +1,207 @@
class CabooseRets::Property <ActiveRecord::Base
self.table_name = "rets_properties"
- attr_accessible :id, :matrix_unique_id
+ attr_accessible :id, :matrix_unique_id, :mls_number
- def url() return "/property/#{self.id}" end
+ def url() return "/properties/#{self.mls_number}/details" end
def images() return CabooseRets::Media.where(:media_mui => self.matrix_unique_id, :media_type => 'Photo').reorder(:media_order).all end
def files() return CabooseRets::Media.where(:media_mui => self.matrix_unique_id, :media_type => 'File' ).reorder(:media_order).all end
def virtual_tour
return nil if !CabooseRets::Media.where(:mls => self.mls.to_s).where(:media_type => 'Virtual Tour').exists?
media = CabooseRets::Media.where(:mls => self.mls.to_s, :media_type => 'Virtual Tour').first
return media.url
end
def self.geolocatable() all(conditions: "latitude IS NOT NULL AND longitude IS NOT NULL") end
def refresh_from_mls
- CabooseRets::RetsImporter.import_properties(self.matrix_unique_id, false)
+ CabooseRets::RetsImporter.import_properties(self.mls_number, false)
end
def parse(data)
- self.access = data['Access']
- self.acreage = data['Acreage'].blank? ? nil : data['Acreage'].to_f
- self.acreage_source = data['AcreageSource']
- self.active_open_house_count = data['ActiveOpenHouseCount']
- self.adjoining_land_use = data['AdjoiningLandUse']
- self.age = data['Age']
- self.annual_taxes = data['AnnualTaxes']
+ # puts(data.to_s)
+ # self.access = nil
+ self.acreage = data['LotSizeAcres'].blank? ? nil : data['LotSizeAcres'].to_f
+ self.acreage_source = data['LotSizeSource']
+ # self.active_open_house_count = data['ActiveOpenHouseCount']
+ # self.adjoining_land_use = data['AdjoiningLandUse']
+ # self.age = data['Age']
+ self.annual_taxes = data['TaxAnnualAmount']
self.appliances = data['Appliances']
- self.area = data['Area']
- self.attic = data['Attic']
- self.available_date = data['AvailableDate']
+ self.area = data['MLSAreaMajor']
+ # self.attic = data['Attic']
+ self.available_date = data['AvailabilityDate']
self.basement = data['Basement']
- self.basement_yn = data['BasementYN']
- self.baths_full = data['BathsFull'].blank? ? nil : data['BathsFull'].to_i
- self.baths_half = data['BathsHalf'].blank? ? nil : data['BathsHalf'].to_i
- self.baths_total = data['BathsTotal'].blank? ? nil : data['BathsTotal'].to_f
- self.beds_total = data['BedsTotal'].blank? ? nil : data['BedsTotal'].to_i
- self.book_number = data['BookNumber']
- self.book_page = data['BookPage']
- self.book_type = data['BookType']
- self.building_type = data['BuildingType']
- self.business_included_yn = data['BusinessIncludedYN']
- self.buyer_name = data['BuyerName']
+ # self.basement_yn = data['BasementYN']
+ self.baths_full = data['BathroomsFull'].blank? ? nil : data['BathroomsFull'].to_i
+ self.baths_half = data['BathroomsHalf'].blank? ? nil : data['BathroomsHalf'].to_i
+ self.baths_total = data['BathroomsTotalInteger'].blank? ? nil : data['BathroomsTotalInteger'].to_f
+ self.beds_total = data['BedroomsTotal'].blank? ? nil : data['BedroomsTotal'].to_i
+ self.book_number = data['TaxBookNumber']
+ # self.book_page = data['BookPage']
+ # self.book_type = data['BookType']
+ # self.building_type = data['BuildingType']
+ self.business_included_yn = data['BusinessName']
+ self.buyer_name = data['BuyerAgentFullName']
self.city = data['City']
- self.city_community = data['CityCommunity']
- self.closing = data['Closing']
- self.co_list_agent_mui = data['CoListAgent_MUI']
- self.co_list_agent_direct_work_phone = data['CoListAgentDirectWorkPhone']
+ self.city_community = data['CityRegion']
+ self.closing = data['CloseDate']
+ self.co_list_agent_mui = data['CoListAgentMlsId']
+ self.co_list_agent_direct_work_phone = data['CoListAgentDirectPhone']
self.co_list_agent_email = data['CoListAgentEmail']
self.co_list_agent_full_name = data['CoListAgentFullName']
- self.co_list_agent_mls_id = data['CoListAgentMLSID']
- self.co_list_office_mui = data['CoListOffice_MUI']
- self.co_list_office_mls_id = data['CoListOfficeMLSID']
+ self.co_list_agent_mls_id = data['CoListAgentMlsId']
+ self.co_list_office_mui = data['CoListOfficeMlsId']
+ self.co_list_office_mls_id = data['CoListOfficeMlsId']
self.co_list_office_name = data['CoListOfficeName']
self.co_list_office_phone = data['CoListOfficePhone']
- self.completion_date = data['CompletionDate']
- self.comp_tenant_rep = data['CompTenantRep']
- self.construction = data['Construction']
- self.construction_status = data['ConstructionStatus']
+ # self.completion_date = data['CompletionDate']
+ # self.comp_tenant_rep = data['CompTenantRep']
+ self.construction = data['ConstructionMaterials']
+ self.construction_status = data['DevelopmentStatus']
self.cooling = data['Cooling']
self.county_or_parish = data['CountyOrParish']
- self.deposit = data['Deposit']
- self.dining_room = data['DiningRoom']
+ # self.deposit = data['Deposit']
+ # self.dining_room = data['DiningRoom']
self.directions = data['Directions']
- self.display_address_on_internet_yn = data['DisplayAddressOnInternetYN']
- self.dom = data['DOM']
- self.driveway = data['Driveway']
+ self.display_address_on_internet_yn = data['InternetAddressDisplayYN']
+ # self.dom = data['DOM']
+ # self.driveway = data['Driveway']
self.elementary_school = data['ElementarySchool']
- self.exists_struct = data['ExistStruct']
- self.expenses_association = data['ExpensesAssociation']
- self.expenses_insurance = data['ExpensesInsurance']
- self.expenses_maintenance = data['ExpensesMaintenance']
- self.expenses_management = data['ExpensesManagement']
- self.expenses_other = data['ExpensesOther']
- self.expenses_tax = data['ExpensesTax']
- self.expenses_utility = data['ExpensesUtility']
+ self.exists_struct = data['StructureType']
+ # self.expenses_association = data['ExpensesAssociation']
+ self.expenses_insurance = data['InsuranceExpense']
+ self.expenses_maintenance = data['MaintenanceExpense']
+ self.expenses_management = data['ProfessionalManagementExpense']
+ self.expenses_other = data['OtherExpense']
+ self.expenses_tax = data['NewTaxesExpense']
+ # self.expenses_utility = data['ExpensesUtility']
self.exterior_features = data['ExteriorFeatures']
- self.fireplace = data['Fireplace']
- self.flood_plain = data['FloodPlain']
+ self.fireplace = data['FireplaceYN']
+ # self.flood_plain = data['FloodPlain']
self.flooring = data['Flooring']
- self.foreclosure_sale_date = data['ForeclosureSaleDate']
- self.foreclosure_yn = data['ForeclosureYN']
- self.fsboyn = data['FSBOYN']
- self.garage = data['Garage']
+ # self.foreclosure_sale_date = data['ForeclosureSaleDate']
+ # self.foreclosure_yn = data['ForeclosureYN']
+ # self.fsboyn = data['FSBOYN']
+ self.garage = data['GarageYN']
self.heating = data['Heating']
self.high_school = data['HighSchool']
- self.hoa_amenities = data['HOAAmenities']
- self.hoa_fee = data['HOAFee']
- self.hoa_included_in_rent_yn = data['HOAIncludedInRentYN']
- self.hoa_term = data['HOATerm']
- self.hoa_term_mandatory_yn = data['HOATermMandatoryYN']
- self.homestead_yn = data['HomesteadYN']
- self.idx_opt_in_yn = data['IDXOptInYN']
- self.income_other = data['IncomeOther']
- self.income_rental = data['IncomeRental']
+ self.hoa_amenities = data['AssociationAmenities']
+ self.hoa_fee = data['AssociationFee']
+ self.hoa_included_in_rent_yn = data['AssociationFeeIncludes']
+ self.hoa_term = data['AssociationFeeFrequency']
+ self.hoa_term_mandatory_yn = data['AssociationYN']
+ # self.homestead_yn = data['HomesteadYN']
+ # self.idx_opt_in_yn = data['IDXOptInYN']
+ self.income_other = data['GrossIncome']
+ # self.income_rental = data['GrossIncome']
self.interior_features = data['InteriorFeatures']
- self.land_features_extras = data['LandFeaturesExtras']
- self.landscaping = data['Landscaping']
- self.laundry = data['Laundry']
- self.legal_description = data['LegalDescription']
- self.legal_lot = data['LegalLot']
- self.legal_section = data['LegalSection']
+ self.land_features_extras = data['LotFeatures']
+ self.latitude = data['Latitude'].blank? ? nil : data['Latitude'].to_f
+ # self.landscaping = data['Landscaping']
+ self.laundry = data['LaundryFeatures']
+ self.legal_description = data['TaxLegalDescription']
+ self.legal_lot = data['TaxLot']
+ self.legal_section = data['PublicSurveySection']
self.levels = data['Levels']
- self.list_agent_mui = data['ListAgent_MUI']
- self.list_agent_direct_work_phone = data['ListAgentDirectWorkPhone']
+ self.list_agent_mui = data['ListAgentMlsId']
+ self.list_agent_direct_work_phone = data['ListAgentOfficePhone']
self.list_agent_email = data['ListAgentEmail']
self.list_agent_full_name = data['ListAgentFullName']
- self.list_agent_mls_id = data['ListAgentMLSID']
+ self.list_agent_mls_id = data['ListAgentMlsId']
self.listing_contract_date = data['ListingContractDate']
- self.list_office_mui = data['ListOffice_MUI']
- self.list_office_mls_id = data['ListOfficeMLSID']
+ self.list_office_mui = data['ListOfficeMlsId']
+ self.list_office_mls_id = data['ListOfficeMlsId']
self.list_office_name = data['ListOfficeName']
self.list_office_phone = data['ListOfficePhone']
self.list_price = data['ListPrice'].blank? ? nil : data['ListPrice'].to_i
- self.lot_description = data['LotDescription']
- self.lot_dimensions = data['LotDimensions']
- self.lot_dim_source = data['LotDimSource']
- self.management = data['Management']
- self.master_bed_level = data['MasterBedLevel']
- self.matrix_unique_id = data['Matrix_Unique_ID']
- self.matrix_modified_dt = data['MatrixModifiedDT']
- self.max_sqft = data['MaxSqft']
+ self.longitude = data['Longitude'].blank? ? nil : data['Longitude'].to_f
+ self.lot_description = data['LotFeatures']
+ self.lot_dimensions = data['LotSizeDimensions']
+ self.lot_dim_source = data['LotDimensionsSource']
+ # self.management = data['Management']
+ # self.master_bed_level = data['MasterBedLevel']
+ self.matrix_unique_id = data['ListingKey']
+ self.matrix_modified_dt = data['ModificationTimestamp']
+ self.max_sqft = data['LivingArea']
self.middle_school = data['MiddleSchool']
- self.mineral_rights = data['MineralRights']
- self.min_sqft = data['MinSqft']
- self.misc_indoor_featuresa = data['MiscIndoorFeatures']
- self.mls = data['MLS']
- self.mls_number = data['MLSNumber']
- self.municipality = data['Municipality']
- self.net_op_inc = data['NetOpInc']
- self.open_house_count = data['OpenHouseCount']
- self.open_house_public_count = data['OpenHousePublicCount']
- self.open_house_public_upcoming = data['OpenHousePublicUpcoming']
- self.open_house_upcoming = data['OpenHouseUpcoming']
- self.original_entry_timestamp = data['OriginalEntryTimestamp'].blank? ? data['ListingContractDate'] : data['OriginalEntryTimestamp']
+ # self.mineral_rights = data['MineralRights']
+ self.min_sqft = data['LivingArea']
+ self.misc_indoor_featuresa = data['BuildingFeatures']
+ self.mls = data['ListingService']
+ self.mls_number = data['ListingId']
+ # self.municipality = data['Municipality']
+ self.net_op_inc = data['NetOperatingIncome']
+ # self.open_house_count = data['OpenHouseCount']
+ # self.open_house_public_count = data['OpenHousePublicCount']
+ # self.open_house_public_upcoming = data['OpenHousePublicUpcoming']
+ # self.open_house_upcoming = data['OpenHouseUpcoming']
+ self.original_entry_timestamp = data['OriginalEntryTimestamp'].blank? ? data['OnMarketDate'] : data['OriginalEntryTimestamp']
self.parcel_number = data['ParcelNumber']
- self.pending_date = data['PendingDate']
- self.pets_allowed_yn = data['PetsAllowedYN']
- self.photo_count = data['PhotoCount']
- self.photo_modification_timestamp = data['PhotoModificationTimestamp']
- self.pool = data['Pool']
- self.porch_patio = data['PorchPatio']
+ self.pending_date = data['PendingTimestamp']
+ self.pets_allowed_yn = data['PetsAllowed']
+ self.photo_count = data['PhotosCount']
+ self.photo_modification_timestamp = data['PhotosChangeTimestamp']
+ self.pool = data['PoolFeatures']
+ self.porch_patio = data['PatioAndPorchFeatures']
self.possession = data['Possession']
- self.possible_uses = data['PossibleUses']
+ self.possible_uses = data['PossibleUse']
self.postal_code = data['PostalCode']
self.postal_code_plus4 = data['PostalCodePlus4']
- self.price_per_acre = data['PricePerAcre']
- self.price_sqft = data['PriceSqft']
- self.property_name = data['PropertyName']
+ # self.price_per_acre = data['PricePerAcre']
+ # self.price_sqft = data['PriceSqft']
+ # self.property_name = data['PropertyName']
self.property_subtype = data['PropertySubType']
self.property_type = data['PropertyType']
- self.property_use = data['PropertyUse']
- self.prop_mgmt_comp = data['PropMgmtComp']
+ self.property_use = data['CurrentUse']
+ self.prop_mgmt_comp = data['ParkManagerName']
self.public_remarks = data['PublicRemarks']
- self.refrigerator_included_yn = data['RefrigeratorIncludedYN']
- self.rental_rate_type = data['RentalRateType']
- self.rent_incl = data['RentIncl']
- self.res_style = data['ResStyle']
- self.restrictions = data['Restrictions']
- self.road_frontage = data['RoadFrontage']
+ # self.refrigerator_included_yn = data['RefrigeratorIncludedYN']
+ self.rental_rate_type = data['RentControlYN']
+ self.rent_incl = data['RentIncludes']
+ self.res_style = data['ArchitecturalStyle']
+ # self.restrictions = data['Restrictions']
+ self.road_frontage = data['RoadFrontageType']
self.roof = data['Roof']
- self.roofage = data['Roofage']
- self.room_count = data['RoomCount']
- self.service_type = data['ServiceType']
+ # self.roofage = data['Roofage']
+ self.room_count = data['RoomsTotal']
+ # self.service_type = data['ServiceType']
self.sewer = data['Sewer']
- self.sold_terms = data['SoldTerms']
- self.sprinkler = data['Sprinkler']
- self.sqft_source = data['SqftSource']
- self.sqft_total = data['SqFtTotal'].blank? ? nil : data['SqFtTotal'].to_f
+ self.sold_terms = data['ListingTerms']
+ # self.sprinkler = data['Sprinkler']
+ self.sqft_source = data['LivingAreaSource']
+ self.sqft_total = data['LivingArea'].blank? ? nil : data['LivingArea'].to_f
self.state_or_province = data['StateOrProvince']
- self.status = data['Status']
- self.status_contractual_search_date = data['StatusContractualSearchDate']
+ self.status = data['MlsStatus']
+ self.status_contractual_search_date = data['ContractStatusChangeDate']
self.street_dir_prefix = data['StreetDirPrefix']
self.street_dir_suffix = data['StreetDirSuffix']
self.street_name = data['StreetName']
self.street_number = data['StreetNumber']
self.street_number_numeric = data['StreetNumberNumeric']
self.street_suffix = data['StreetSuffix']
- self.street_view_param = data['StreetViewParam']
- self.style = data['Style']
- self.subdivision = data['Subdivision']
+ # self.street_view_param = data['StreetViewParam']
+ self.style = data['BodyType']
+ self.subdivision = data['SubdivisionName']
self.topography = data['Topography']
- self.total_num_units = data['TotalNumOfUnits']
- self.total_num_units_occupied = data['TotalNumOfUnitsOccupied']
- self.transaction_type = data['TransactionType']
- self.unit_count = data['UnitCount']
+ self.total_num_units = data['NumberOfUnitsTotal']
+ self.total_num_units_occupied = data['NumberOfUnitsLeased']
+ self.transaction_type = data['TransactionBrokerCompensationType']
+ self.unit_count = data['NumberOfUnitsInCommunity']
self.unit_number = data['UnitNumber']
self.utilities = data['Utilities']
- self.virtual_tour1 = data['VirtualTour1']
- self.vow_allowed_avmyn = data['VOWAllowAVMYN']
- self.vow_allowed_third_party_comm_yn = data['VOWAllowThirdPartyCommYN']
- self.washer_dryer_included = data['WasherDryerIncludedYN']
- self.water = data['Water']
- self.waterfronts = data['Waterfronts']
+ self.virtual_tour1 = data['VirtualTourURLBranded'].blank? ? data['VirtualTourURLUnbranded'] : data['VirtualTourURLBranded']
+ # self.vow_allowed_avmyn = data['VOWAllowAVMYN']
+ # self.vow_allowed_third_party_comm_yn = data['VOWAllowThirdPartyCommYN']
+ # self.washer_dryer_included = data['WasherDryerIncludedYN']
+ self.water = data['WaterSource']
+ self.waterfronts = data['WaterBodyName']
self.waterfront_yn = data['WaterfrontYN']
- self.water_heater = data['WaterHeater']
- self.windows = data['Windows']
- self.window_treatments = data['WindowTreatments']
+ # self.water_heater = data['WaterHeater']
+ self.windows = data['WindowFeatures']
+ # self.window_treatments = data['WindowTreatments']
self.year_built = data['YearBuilt']
- self.yr_blt_source = data['YrBltSource']
+ self.yr_blt_source = data['YearBuiltSource']
self.zoning = data['Zoning']
- self.zoning_northport = data['ZoningNorthPort']
- self.zoning_tusc = data['ZoningTusc']
+ # self.zoning_northport = data['ZoningNorthPort']
+ # self.zoning_tusc = data['ZoningTusc']
end
end