Class: RequestGoogleBooks
- Inherits:
-
Object
- Object
- RequestGoogleBooks
- Defined in:
- lib/requestgooglebooks.rb
Class Method Summary collapse
-
.requestCoverURL(title, key) ⇒ Object
calling Google Books API endpoint to request info on the book title.
Class Method Details
.requestCoverURL(title, key) ⇒ Object
calling Google Books API endpoint to request info on the book title
5 6 7 8 9 10 11 12 |
# File 'lib/requestgooglebooks.rb', line 5 def self.requestCoverURL(title, key) @url = "https://www.googleapis.com/books/v1/volumes?q=#{title}&maxResults=1&key=#{key}" response = HTTParty.get(@url) @response = JSON.parse(response.body) @coverURL = @response["items"][0]["volumeInfo"]["imageLinks"]["thumbnail"] end |