Method: GoogleBookSearch#find_thumbnail_url
- Defined in:
- app/service_adaptors/google_book_search.rb
#find_thumbnail_url(data) ⇒ Object
Not all responses have a thumbnail_url. We look for them and return the 1st.
439 440 441 442 443 444 445 446 447 448 449 |
# File 'app/service_adaptors/google_book_search.rb', line 439 def find_thumbnail_url(data) entries = data["items"].collect do |entry| entry["volumeInfo"]["imageLinks"]["thumbnail"] if entry["volumeInfo"] && entry["volumeInfo"]["imageLinks"] end # removenill values entries.compact! # pick the first of the available thumbnails, or nil return entries[0] end |