From 6f028b9885e748371b866cae645cfeb38b1a3dc2 Mon Sep 17 00:00:00 2001 From: sivancie Date: Sun, 21 Feb 2016 15:26:57 -0500 Subject: [PATCH] Completed Admin Exercise --- admin.rb | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/admin.rb b/admin.rb index c751799..c2687f2 100644 --- a/admin.rb +++ b/admin.rb @@ -1,7 +1,9 @@ require 'pry' -#you run a site that offers a matching service between vendors selling laptops and customers -#..looking to purchase; you charge a fee to be listed as a vendor +def user_permission? + +#you run a site that offers a matching service between vendors selling laptops and customers +#..looking to purchase; you charge a fee to be listed as a vendor #your site's users must sign in and if they are an admin they are able to make changes to the site ####################################################### @@ -13,19 +15,34 @@ #if the user is not signed in, show "you can't see any of the pages, please sign in!" #ask the user if they pay their bills (yes/no) - +puts("Have you paid your bills? yes/no") +user_bills = gets.strip.downcase #store their answer in a variable #ask the user if they have canceled a deal (yes/no) - +puts("Have you cancelled a deal? yes/no") +user_deal = gets.strip.downcase #store their answer in a variable #ask the user if they are an admin (yes/no) - +puts("Are you an admin? yes/no") +user_admin = gets.strip.downcase #store their answer in a variable #ask the user if they are signed in (yes/no) - +puts("Are you signed in? yes/no") +user_signed_in = gets.strip.downcase #store their answer in a variable - -#call the function + if user_deal == "yes" or user_bills == "no" + puts("Go Away!") + elsif user_admin == "yes" + puts("you can see and change all of the pages!") + elsif user_signed_in == "yes" + puts("you can see all of the pages!") + elsif user_signed_in == "no" + puts("you can't see any of the pages. Please sign in.") +end +end + +#call the function +user_permission?