lib/cli_application/cli_interface.rb
#returns 5 books only if books contain title, author, and publisher
returns 5 books only if books contain title, author, and publisher
returns 5 books only if books contain title author and publisher
def return_user_books(input)
    @books =  GoogleBooks::API.search(@input, :count => 5)
    @books.each do |book|
    if !(book.title.nil? || book.authors.nil? || book.publisher.nil?)
      puts book.title, book.authors, book.publisher, "\n"
    end
  end
  def save_book_title
    puts "If you would like to save a book to your reading list, please type the title of the book you'd like to save." .blue
    get_user_book_input(@input)
    book_input = @input
    if book_to_save = @books.find{|book| book.title == book_input }
      GoogleLib::Google_library.all << book_input
    else
      puts "Please enter a valid title"
      save_book_title
      end
    end
  end
def return_user_books ( input ) @books = GoogleBooks :: API . search ( @input , :count => 5 ) @books . each do | book | if ! ( book . title . nil? || book . authors . nil? || book . publisher . nil? ) puts book . title , book . authors , book . publisher , "\n" end end def save_book_title puts "If you would like to save a book to your reading list, please type the title of the book you'd like to save." . blue get_user_book_input ( @input ) book_input = @input if book_to_save = @books . find { | book | book . title == book_input } GoogleLib :: Google_library . all << book_input else puts "Please enter a valid title" save_book_title end end end
returns 5 books only if books contain title, author, and publisher
returns 5 books only if books contain title author and publisher
input