diff --git a/app/controllers/api/v0/guidance_groups_controller.rb b/app/controllers/api/v0/guidance_groups_controller.rb index ce2ac72..65899b9 100644 --- a/app/controllers/api/v0/guidance_groups_controller.rb +++ b/app/controllers/api/v0/guidance_groups_controller.rb @@ -4,12 +4,6 @@ before_action :authenticate #after_action :verify_authorized - def show - @guidance_group = GuidanceGroup.find(params[:id]) - raise Pundit::NotAuthorizedError unless Api::V0::GuidanceGroupPolicy.new(@user, @guidance_group).show? - respond_with @guidance_group - end - def index raise Pundit::NotAuthorizedError unless Api::V0::GuidanceGroupPolicy.new(@user, :guidance_group).index? @all_viewable_groups = GuidanceGroup.all_viewable(@user) diff --git a/app/controllers/api/v0/guidances_controller.rb b/app/controllers/api/v0/guidances_controller.rb deleted file mode 100644 index b6866d2..0000000 --- a/app/controllers/api/v0/guidances_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -module Api - module V0 - class GuidancesController < Api::V0::BaseController - before_action :authenticate - #after_action :verify_authorized - - ## - # returns the specified guidance - def show - @guidance = Guidance.find(params[:id]) - raise Pundit::NotAuthorizedError unless Api::V0::GuidancePolicy.new(@user, @guidance).show? - respond_with get_resource - end - - ## - # returns all guidances viewable to a user - def index - authorize Guidance - raise Pundit::NotAuthorizedError unless Api::V0::GuidancePolicy.new(@user, :guidance).index? - respond_with @all_viewable_guidances - end - - ## - # defines the default pundit user (overwrites current_user) - def pundit_user - @user - end - - - private - def query_params - params.permit(:id) - end - end - end -end diff --git a/app/views/api/v0/guidance_groups/show.json.jbuilder b/app/views/api/v0/guidance_groups/show.json.jbuilder deleted file mode 100644 index d1b0a2e..0000000 --- a/app/views/api/v0/guidance_groups/show.json.jbuilder +++ /dev/null @@ -1,14 +0,0 @@ -# builds a json response to api query for a list of guidance groups -json.prettify! - -json.guidance_group do - json.name @guidance_group.name - json.id @guidance_group.id - - json.guidances @guidance_group.guidances do |guidance| - json.text guidance.text - json.id guidance.id - end - json.optional @guidance_group.optional_subset - json.updated @guidance_group.updated_at -end diff --git a/app/views/api/v0/guidances/index.json.jbuilder b/app/views/api/v0/guidances/index.json.jbuilder deleted file mode 100644 index ac98f0a..0000000 --- a/app/views/api/v0/guidances/index.json.jbuilder +++ /dev/null @@ -1,22 +0,0 @@ -# builds a json response to api querry for all guidances - -json.prettify! - -json.guidance @all_viewable_guidances do |guidance| - json.id guidance.id - json.text guidance.text - json.updated_at guidance.updated_at - - # each guidance may be associated with many guidance groups - guidance_group = guidance.guidance_group - unless guidance_group.nil? - json.guidance_group do - json.name guidance_group.name - json.id guidance_group.id - - json.optional guidance_group.optional_subset - json.updated guidance_group.updated_at - end - end - -end diff --git a/app/views/api/v0/guidances/show.json.jbuilder b/app/views/api/v0/guidances/show.json.jbuilder deleted file mode 100644 index 67d3385..0000000 --- a/app/views/api/v0/guidances/show.json.jbuilder +++ /dev/null @@ -1,22 +0,0 @@ -# builds a json response to api querry for a specific guidance - -json.prettify! - -json.guidance do - json.id @guidance.id - json.text @guidance.text - json.updated_at @guidance.updated_at - - # each guidance may be associated with one guidance group - guidance_group = @guidance.guidance_group - - unless guidance_group.nil? - json.guidance_group do - json.name guidance_group.name - json.id guidance_group.id - - json.optional guidance_group.optional_subset - json.updated guidance_group.updated_at - end - end -end \ No newline at end of file