module CarrierInfo class Carrier class << self attr_accessor :sources end def self.load_sources self.sources = [] Dir.new(File.dirname(__FILE__) + "/sources").each do |file| unless File.directory?(file) self.sources << ("CarrierInfo::Sources::" + file.split(".")[0].camelize).constantize end end end load_sources attr_accessor :docket_prefix, :docket_number, :usdot_number, :legal_name, :dba_name, :phone, :power_units, :drivers, :duns_number, :state_id_number, :mcs_150_form_date, :mcs_150_mileage, :mcs_150_mileage_year, :out_of_service_date, :safer_active, :operating_status, :entity_type, :physical_street, :physical_city, :physical_state, :physical_postal_code, :mailing_street, :mailing_city, :mailing_state, :mailing_postal_code, :safer_last_updated # Operation Classification (http://safer.fmcsa.dot.gov/saferhelp.aspx#Class) attr_accessor :classification_authorized_for_hire, :classification_exempt_for_hire, :classification_private_property, :classification_private_passenger_business, :classification_private_passenger_non_business, :classification_migrant, :classification_us_mail, :classification_federal_government, :classification_state_government, :classification_local_government, :classification_indian_tribe, :classification_other # Carrier Operation (http://safer.fmcsa.dot.gov/saferhelp.aspx#CarrierOP) attr_accessor :interstate, :instrastate_non_hazardous, :intrastate_hazardous # Equipment Type attr_accessor :equipment_vans, :equipment_household_vans, :equipment_flatbeds, :equipment_car_carriers, :equipment_tow_trucks, :equipment_mobile_homes, :equipment_reefers, :equipment_tanks, :equipment_intermodal_containers, :equipment_buses, :equipment_livestock_rack, :equipment_hopper_bottom, :equipment_coal_trailers, :equipment_garbage_trucks, :equipment_beverage_trucks, :equipment_utility_trucks, :equipment_well_trucks def initialize(args={}) self.docket_number = args[:docket_number] self.usdot_number = args[:usdot_number] end def equipment_names self.methods.select { |var| var =~ /equipment_.+[^=]\Z/ && var != :equipment_names } end def classification_names self.methods.select { |var| var =~ /classification_.+[^=]\Z/ && var != :classification_names } end def sources self.class.sources.collect { |source| source.new(self) } end def research! sources.each(&:parse!) self end end end