class CabooseRets::CommercialProperty < ActiveRecord::Base self.table_name = "rets_commercial" def agent() return CabooseRets::Agent.where(:la_code => self.la_code).first end def office() return CabooseRets::Office.where(:lo_code => self.lo_code).first end def images() return CabooseRets::Media.where(:mls_acct => self.mls_acct).order(:media_order).all end def self.geolocatable() all(conditions: "latitude IS NOT NULL AND longitude IS NOT NULL") end #def self.property_types() self.pucs("prop_type" ).reject(&:empty?).sort end #def self.statuses() self.pucs("status" ).reject(&:empty?).sort end #def self.zips() self.pucs("zip" ).reject(&:empty?).sort end #def self.cities() self.pucs("city" ).reject(&:empty?).sort end #def self.counties() self.pucs("county" ).reject(&:empty?).sort end #def self.subdivisions() self.pucs("subdivision" ).reject(&:empty?).sort end #def self.elem_schools() self.pucs("elem_school" ).reject(&:empty?).sort end #def self.middle_schools() self.pucs("middle_school" ).reject(&:empty?).sort end #def self.high_schools() self.pucs("high_school" ).reject(&:empty?).sort end def parse(data) self.acreage = data['ACREAGE'] self.adjoining_land_use = data['ADJOINING_LAND_USE'] self.agent_notes = data['AGENT_NOTES'] self.agent_other_contact_desc = data['AGENT_OTHER_CONTACT_DESC'] self.agent_other_contact_phone = data['AGENT_OTHER_CONTACT_PHONE'] self.annual_taxes = data['ANNUAL_TAXES'] self.approx_age = data['APPROX_AGE'] self.area = data['AREA'] self.baths = data['BATHS'] self.baths_full = data['BATHS_FULL'] self.baths_half = data['BATHS_HALF'] self.bedrooms = data['BEDROOMS'] self.bom_date = data['BOM_DATE'] self.book_number = data['BOOK_NUMBER'] self.book_page = data['BOOK_PAGE'] self.book_type = data['BOOK_TYPE'] self.box_on_unit = data['BOX_ON_UNIT'] self.box_on_unit_yn = data['BOX_ON_UNIT_YN'] self.business_included_yn = data['BUSINESS_INCLUDED_YN'] self.buyer_broker = data['BUYER_BROKER'] self.buyer_broker_type = data['BUYER_BROKER_TYPE'] self.buyer_city = data['BUYER_CITY'] self.buyer_name = data['BUYER_NAME'] self.buyer_state = data['BUYER_STATE'] self.buyer_zip = data['BUYER_ZIP'] self.category = data['CATEGORY'] self.city = data['CITY'] self.city_code = data['CITY_CODE'] self.co_la_code = data['CO_LA_CODE'] self.co_lo_code = data['CO_LO_CODE'] self.co_sa_code = data['CO_SA_CODE'] self.co_so_code = data['CO_SO_CODE'] self.contacts = data['CONTACTS'] self.contr_broker = data['CONTR_BROKER'] self.contr_broker_type = data['CONTR_BROKER_TYPE'] self.county = data['COUNTY'] self.current_price = data['CURRENT_PRICE'] self.date_created = data['DATE_CREATED'] self.date_leased = data['DATE_LEASED'] self.date_modified = data['DATE_MODIFIED'] self.df_yn = data['DF_YN'] self.directions = data['DIRECTIONS'] self.display_address_yn = data['DISPLAY_ADDRESS_YN'] self.dom = data['DOM'] self.elem_school = data['ELEM_SCHOOL'] self.expenses_assoc = data['EXPENSES_ASSOC'] self.expenses_ins = data['EXPENSES_INS'] self.expenses_maint = data['EXPENSES_MAINT'] self.expenses_mgmt = data['EXPENSES_MGMT'] self.expenses_other = data['EXPENSES_OTHER'] self.expenses_tax = data['EXPENSES_TAX'] self.expenses_utility = data['EXPENSES_UTILITY'] self.expire_date = data['EXPIRE_DATE'] self.flood_plain = data['FLOOD_PLAIN'] self.ftr_building = data['FTR_BUILDING'] self.ftr_building_type = data['FTR_BUILDING_TYPE'] self.ftr_closing = data['FTR_CLOSING'] self.ftr_cooling = data['FTR_COOLING'] self.ftr_docs_on_file = data['FTR_DOCS_ON_FILE'] self.ftr_exterior = data['FTR_EXTERIOR'] self.ftr_financing = data['FTR_FINANCING'] self.ftr_flooring = data['FTR_FLOORING'] self.ftr_heating = data['FTR_HEATING'] self.ftr_interior = data['FTR_INTERIOR'] self.ftr_internet = data['FTR_INTERNET'] self.ftr_lease_terms = data['FTR_LEASE_TERMS'] self.ftr_property_desc = data['FTR_PROPERTY_DESC'] self.ftr_roof = data['FTR_ROOF'] self.ftr_sale_terms = data['FTR_SALE_TERMS'] self.ftr_sewer = data['FTR_SEWER'] self.ftr_showing = data['FTR_SHOWING'] self.ftr_sprinkler = data['FTR_SPRINKLER'] self.ftr_style = data['FTR_STYLE'] self.ftr_utilities = data['FTR_UTILITIES'] self.ftr_utilities_rental = data['FTR_UTILITIES_RENTAL'] self.ftr_water = data['FTR_WATER'] self.geo_precision = data['GEO_PRECISION'] self.georesult = data['GEORESULT'] self.high_school = data['HIGH_SCHOOL'] self.hoa_fee = data['HOA_FEE'] self.hoa_fee_yn = data['HOA_FEE_YN'] self.hoa_term = data['HOA_TERM'] self.income_gross = data['INCOME_GROSS'] self.income_net = data['INCOME_NET'] self.income_other = data['INCOME_OTHER'] self.income_rental = data['INCOME_RENTAL'] self.internet_yn = data['INTERNET_YN'] self.la_code = data['LA_CODE'] self.leased_through = data['LEASED_THROUGH'] self.legal_block = data['LEGAL_BLOCK'] self.legal_lot = data['LEGAL_LOT'] self.legals = data['LEGALS'] self.list_date = data['LIST_DATE'] self.list_price = data['LIST_PRICE'] self.listing_type = data['LISTING_TYPE'] self.lo_code = data['LO_CODE'] self.lockbox_yn = data['LOCKBOX_YN'] self.lot_dimensions = data['LOT_DIMENSIONS'] self.lot_dimensions_source = data['LOT_DIMENSIONS_SOURCE'] self.media_flag = data['MEDIA_FLAG'] self.middle_school = data['MIDDLE_SCHOOL'] self.mls_acct = data['MLS_ACCT'] self.municipality = data['MUNICIPALITY'] self.num_units = data['NUM_UNITS'] self.num_units_occupied = data['NUM_UNITS_OCCUPIED'] self.off_mkt_date = data['OFF_MKT_DATE'] self.off_mkt_days = data['OFF_MKT_DAYS'] self.office_notes = data['OFFICE_NOTES'] self.orig_lp = data['ORIG_LP'] self.other_fee = data['OTHER_FEE'] self.other_fee_type = data['OTHER_FEE_TYPE'] self.owner_name = data['OWNER_NAME'] self.owner_phone = data['OWNER_PHONE'] self.parcel_id = data['PARCEL_ID'] self.pending_date = data['PENDING_DATE'] self.photo_count = data['PHOTO_COUNT'] self.photo_date_modified = data['PHOTO_DATE_MODIFIED'] self.photo_description = data['PHOTO_DESCRIPTION'] self.photo_instr = data['PHOTO_INSTR'] self.posession = data['POSESSION'] self.price_change_date = data['PRICE_CHANGE_DATE'] self.price_sqft = data['PRICE_SQFT'] self.proj_close_date = data['PROJ_CLOSE_DATE'] self.prop_desc = data['PROP_DESC'] self.prop_id = data['PROP_ID'] self.prop_type = data['PROP_TYPE'] self.remarks = data['REMARKS'] self.road_frontage_ft = data['ROAD_FRONTAGE_FT'] self.sa_code = data['SA_CODE'] self.sale_lease = data['SALE_LEASE'] self.sale_notes = data['SALE_NOTES'] self.so_code = data['SO_CODE'] self.sold_date = data['SOLD_DATE'] self.sold_price = data['SOLD_PRICE'] self.sold_terms = data['SOLD_TERMS'] self.sqft_source = data['SQFT_SOURCE'] self.state = data['STATE'] self.status = data['STATUS'] self.status_date = data['STATUS_DATE'] self.status_flag = data['STATUS_FLAG'] self.street = data['STREET'] self.street_dir = data['STREET_DIR'] self.street_name = data['STREET_NAME'] self.street_num = data['STREET_NUM'] self.sub_agent = data['SUB_AGENT'] self.sub_agent_type = data['SUB_AGENT_TYPE'] self.sub_area = data['SUB_AREA'] self.subdivision = data['SUBDIVISION'] self.take_photo_yn = data['TAKE_PHOTO_YN'] self.third_party_comm_yn = data['THIRD_PARTY_COMM_YN'] self.tot_heat_sqft = data['TOT_HEAT_SQFT'] self.tour_date = data['TOUR_DATE'] self.tour_submit_date = data['TOUR_SUBMIT_DATE'] self.type_detailed = data['TYPE_DETAILED'] self.u1_dims = data['U1_DIMS'] self.u1_free_standing_yn = data['U1_FREE_STANDING_YN'] self.u1_sqft_manuf = data['U1_SQFT_MANUF'] self.u1_sqft_office = data['U1_SQFT_OFFICE'] self.u1_sqft_retail = data['U1_SQFT_RETAIL'] self.u1_sqft_total = data['U1_SQFT_TOTAL'] self.u1_sqft_warehouse = data['U1_SQFT_WAREHOUSE'] self.u1_year_built = data['U1_YEAR_BUILT'] self.u2_dims = data['U2_DIMS'] self.u2_free_standing_yn = data['U2_FREE_STANDING_YN'] self.u2_sqft_manuf = data['U2_SQFT_MANUF'] self.u2_sqft_office = data['U2_SQFT_OFFICE'] self.u2_sqft_retail = data['U2_SQFT_RETAIL'] self.u2_sqft_total = data['U2_SQFT_TOTAL'] self.u2_sqft_warehouse = data['U2_SQFT_WAREHOUSE'] self.u2_year_built = data['U2_YEAR_BUILT'] self.u3_dims = data['U3_DIMS'] self.u3_free_standing_yn = data['U3_FREE_STANDING_YN'] self.u3_sqft_manuf = data['U3_SQFT_MANUF'] self.u3_sqft_office = data['U3_SQFT_OFFICE'] self.u3_sqft_retail = data['U3_SQFT_RETAIL'] self.u3_sqft_total = data['U3_SQFT_TOTAL'] self.u3_sqft_warehouse = data['U3_SQFT_WAREHOUSE'] self.u3_year_built = data['U3_YEAR_BUILT'] self.unit_num = data['UNIT_NUM'] self.upload_source = data['UPLOAD_SOURCE'] self.vacancy_rate = data['VACANCY_RATE'] self.vacant_yn = data['VACANT_YN'] self.valuation_yn = data['VALUATION_YN'] self.vt_yn = data['VT_YN'] self.waterfront_yn = data['WATERFRONT_YN'] self.withdrawn_date = data['WITHDRAWN_DATE'] self.year_built = data['YEAR_BUILT'] self.zip = data['ZIP'] self.zoning_northport = data['ZONING_NORTHPORT'] self.zoning_tusc = data['ZONING_TUSC'] self.virtual_tour = data['VIRTUAL_TOUR'] end end