diff --git a/README.md b/README.md index 17af575..9a2f2c8 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,10 @@ For examples below, the Resource ID is `5980ea98-ce00-4f7d-9ee3-114006f78f59` an 1. `load 'app/data_saver.rb'` 1. `DataSaver.save_all('5980ea98-ce00-4f7d-9ee3-114006f78f59', 'gas_well_inspections')` +In Code + +1. Add Dataset Endpoint + Files 1. Stage `app/app.rb` and `schema.rb` diff --git a/app/app.rb b/app/app.rb index 359518c..7aacf14 100644 --- a/app/app.rb +++ b/app/app.rb @@ -25,7 +25,6 @@ VoterDistrict.import Billboard.import School.import - WellInspection.import DentonHouse.import HomelessnessSurvey.import Demographic.import @@ -42,7 +41,6 @@ VoterDistrict.delete_all Billboard.delete_all School.delete_all - WellInspection.delete_all DentonHouse.delete_all HomelessnessSurvey.destroy_all Demographic.destroy_all @@ -84,13 +82,16 @@ end.to_json end -################### -# Well Inspection # -################### +####################### +# Gas Well Inspection # +####################### + +get '/gas-well-inspections' do + GasWellInspection.all.select( 'id, x, y, siteaddres, fullname, lastinspectiondate, status' ).to_json +end -get '/well-inspections' do - inspections = WellInspection.order(objectid: :asc) - "Number of entries: #{inspections.count}
#{inspections.map { |i| i.objectid }}!" +get '/gas-well-inspections/:id' do + GasWellInspection.where(id: params[:id]).to_json end ################ diff --git a/app/models/well_inspection.rb b/app/models/well_inspection.rb deleted file mode 100644 index 4decc83..0000000 --- a/app/models/well_inspection.rb +++ /dev/null @@ -1,11 +0,0 @@ -class WellInspection < ActiveRecord::Base - RESOURCE_ID = 'e8024ac8-ea92-4dc9-99f7-8d58de3e1473' - - def self.import - DataSaver.save_resources(RESOURCE_ID, 'well_inspections') - end - - def self.clean_data(data) - data - end -end diff --git a/db/migrate/20170304180000_delete_well_inspections.rb b/db/migrate/20170304180000_delete_well_inspections.rb new file mode 100644 index 0000000..43986bc --- /dev/null +++ b/db/migrate/20170304180000_delete_well_inspections.rb @@ -0,0 +1,9 @@ +class DeleteWellInspections < ActiveRecord::Migration[5.0] + def up + drop_table :well_inspections + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end \ No newline at end of file