class CabooseRets::Property 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) 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'] self.appliances = data['Appliances'] self.area = data['Area'] self.attic = data['Attic'] self.available_date = data['AvailableDate'] 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.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.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_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.cooling = data['Cooling'] self.county_or_parish = data['CountyOrParish'] 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.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.exterior_features = data['ExteriorFeatures'] self.fireplace = data['Fireplace'] 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.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.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.levels = data['Levels'] self.list_agent_mui = data['ListAgent_MUI'] self.list_agent_direct_work_phone = data['ListAgentDirectWorkPhone'] self.list_agent_email = data['ListAgentEmail'] self.list_agent_full_name = data['ListAgentFullName'] 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_name = data['ListOfficeName'] self.list_office_phone = data['ListOfficePhone'] self.list_price = data['ListPrice'].blank? ? nil : data['ListPrice'].to_f 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.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.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.possession = data['Possession'] self.possible_uses = data['PossibleUses'] 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.property_subtype = data['PropertySubType'] self.property_type = data['PropertyType'] self.property_use = data['PropertyUse'] self.prop_mgmt_comp = data['PropMgmtComp'] 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.roof = data['Roof'] self.roofage = data['Roofage'] self.room_count = data['RoomCount'] 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.state_or_province = data['StateOrProvince'] self.status = data['Status'] self.status_contractual_search_date = data['StatusContractualSearchDate'] 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.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.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.waterfront_yn = data['WaterfrontYN'] self.water_heater = data['WaterHeater'] self.windows = data['Windows'] self.window_treatments = data['WindowTreatments'] self.year_built = data['YearBuilt'] self.yr_blt_source = data['YrBltSource'] self.zoning = data['Zoning'] self.zoning_northport = data['ZoningNorthPort'] self.zoning_tusc = data['ZoningTusc'] end end