Class: BookFinder::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/bookfinder/client.rb

Constant Summary collapse

BASE_URI =
"https://www.googleapis.com/books/v1/"

Instance Method Summary collapse

Constructor Details

#initializeClient

this will only make requests to the public variation of the google books api



9
10
# File 'lib/bookfinder/client.rb', line 9

def initialize
end

Instance Method Details

#books(name) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/bookfinder/client.rb', line 12

def books(name)
  response = http_get(
    endpoint: "volumes?q=",
    query: name.sub(" ","")
  )

  response.map { |book| BookFinder::Book.new(book["volumeInfo"]) }
end