module BookFinder
Public Class Methods
search(api: nil, params: {})
click to toggle source
# File lib/book_finder.rb, line 9 def self.search(api: nil, params: {}) @result = [] return :PARAMS_MISSING if params.empty? if api.nil? || api.downcase == "libgen" @result += @libgen.search(params) end if api.nil? || api.downcase == "bok" @result += @bok.search(params) end @result = @result.map do |book| book.map { |key, value| [key.to_s.downcase.chomp, value.to_s.downcase.chomp] }.to_h end @result.uniq { |book| {authors: book["authors"], title: book["title"], year: book["year"], language: book["language"], size: book["size"], extension: book["extension"]} } end