Class: BookwormBuddy::CLI
- Inherits:
-
Object
- Object
- BookwormBuddy::CLI
- Defined in:
- lib/bookworm_buddy/cli.rb
Instance Method Summary collapse
- #bestsellers ⇒ Object
- #call ⇒ Object
- #description ⇒ Object
- #exit ⇒ Object
- #list ⇒ Object
- #main_menu ⇒ Object
Instance Method Details
#bestsellers ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/bookworm_buddy/cli.rb', line 45 def bestsellers input = gets.strip if input.to_i.between?(1, 50) BookwormBuddy::Scraper.get_books_by_category(input) BookwormBuddy::Book.list_books_by_category(input) puts "\n""----------------------------------------".colorize(:cyan) puts "\n""To see the summary of a title that interests you, enter that number below. Otherwise, enter 'list' to return to the list of categories, or 'exit' to exit.".colorize(:green) puts "\n""----------------------------------------""\n".colorize(:cyan) description elsif input == "list" list elsif input == "exit" exit else puts "\n"".... I am not sure what you meant (neither are the gnomes). Try again?".colorize(:red) bestsellers end end |
#call ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bookworm_buddy/cli.rb', line 3 def call puts "\n""--------------------------------------------".colorize(:cyan) puts "\n"" Welcome to the Bookworm Buddy! ".colorize(:green) puts "\n""--------------------------------------------".colorize(:cyan) puts " .--. .---. " puts " .---|__| .-. |~~~| " puts " .--|===|--| _ |_| |~~~|--. " puts " | |===| | / .---!~| .--| |--| " puts " |%%| | | / |===| |--|%%| | | " puts " |%%| | | /.'/| | |__| | | | " puts " | | | | / / |===| |==| | | | " puts " | | |__| /.'/ | |_|__| |~~~|__| " puts " | |===|--|/.'/ |===|~|--|%%|~~~|--| " puts " ^--^---'--^`-^ ^---^-^--^--^---'--' " puts "\n""--------------------------------------------" puts "\n""We bring you the top 20 Barnes & Noble bestselling books in the category of your choice," "\n" "so you can spend less time searching and more time reading!".colorize(:green) puts "\n""Give us one moment to awaken the book gnomes.".colorize(:magenta) BookwormBuddy::Scraper.get_categories end |
#description ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/bookworm_buddy/cli.rb', line 64 def description input = gets.strip if input.to_i.between?(1, 20) BookwormBuddy::Scraper.get_description(input) puts "\n""----------------------------------------".colorize(:cyan) puts "\n""To see another book, enter that number below. Otherwise, enter 'list' to return to the list of categories, or 'exit' to exit.".colorize(:green) puts "\n""----------------------------------------""\n".colorize(:cyan) description elsif input == "list" list elsif input == "exit" exit else puts ".... I am not sure what you meant (neither are the gnomes). Try again?".colorize(:red) description end end |
#exit ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bookworm_buddy/cli.rb', line 82 def exit puts "We hope you found what you were looking for.".colorize(:yellow) puts "\n"" , , " puts " /////| " puts " ///// | " puts " |~~~| | " puts " |===| | " puts " |b | | " puts " | y | | " puts " | e| / " puts " |===|/ " puts " '---' " puts "\n""Happy reading!".colorize(:yellow) end |
#list ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/bookworm_buddy/cli.rb', line 37 def list BookwormBuddy::Category.list_categories puts "\n""----------------------------------------".colorize(:cyan) puts "\n""To see the top 20 bestsellers in a category, enter the category number below.".colorize(:green) puts "\n""----------------------------------------""\n".colorize(:cyan) bestsellers end |
#main_menu ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bookworm_buddy/cli.rb', line 24 def puts "\n""To see the list of book categories, enter 'list,' to exit enter 'exit.'".colorize(:green) input = gets.strip if input == "list" list elsif input == "exit" exit else puts "\n"".... I am not sure what you meant (neither are the gnomes). Try again?".colorize(:red) end end |