diff --git a/.env.example b/.env.example index 33a03cd..e69de29 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +0,0 @@ -NEXMO_API_KEY='' -NEXMO_API_SECRET='' diff --git a/README.md b/README.md index 3f67d59..0fa1454 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,10 @@ cp .env.example .env Next you will need to sign up for a Nexmo account and get your API credentials from the API dashboard and put them in your `.env` file. -Finally all that's left is to start the server. +Finally all that's left is to migrate the database and start the server. ```sh +rake db:migrate rails server ``` diff --git a/app/controllers/verifications_controller.rb b/app/controllers/verifications_controller.rb index 013c697..bfff25f 100644 --- a/app/controllers/verifications_controller.rb +++ b/app/controllers/verifications_controller.rb @@ -5,12 +5,12 @@ def new end def create - response = client.check_verification( - session[:verification_id], + response = client.verify.check( + request_id: session[:verification_id], code: params[:code] ) - if response['status'] == '0' + if response.status == '0' session[:verified] = true redirect_to :root else @@ -22,14 +22,14 @@ def create private def send_verification_request - response = client.start_verification( + response = client.verify.request( number: current_user.number, brand: 'MyApp' ) - if response['status'] == '0' + if response.status == '0' session[:verification_id] = - response['request_id'] + response.request_id end end