Created
April 7, 2017 12:15
-
-
Save vixus0/f3b7194edace3e0c71ddcf206de84d3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IdpController < ApplicationController | |
layout 'application' | |
def initialize | |
@init_form = IdpInitForm.new({}) | |
end | |
def idp_init | |
render 'idp/init' | |
end | |
def idp_init_post | |
@init_form = IdpInitForm.new(params.fetch('idp_init_form', {})) | |
if @init_form.valid? | |
init_test_run(@init_form) | |
else | |
render 'idp/init' | |
end | |
end | |
def test_run | |
@test_run = fetch_test_run(session[:test_run_location]) | |
render 'idp/test_run' | |
end | |
private | |
def init_test_run(form) | |
test_run_location = ComplianceToolClient.confirm_idp_post(form.params) | |
if test_run_location | |
session[:test_run_location] = test_run_location | |
redirect_to idp_tests_path | |
else | |
flash[:error] = response.body | |
redirect_to error_path | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment