sosedoff / goodreads

Goodreads API wrapper

Home Page:https://www.goodreads.com/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some internal hashie broken (known: book.title, book.id) and solution(?)

jumpluff opened this issue · comments

search = client.search_books("The Lord Of The Rings")

search.results.work.each do |book|
    book.id        # => book id
    book.title     # => book title
end

Trying to fetch a book.id or book.title does nothing, simply because those objects reference nothing now

Sample structure for element book: #<Hashie::Mash average_rating="4.46" best_book=#<Hashie::Mash author=#<Hashie::Mash id=656983 name="J.R.R. Tolkien"> id=33 image_url="http://d.gr-assets.com/books/1411114164m/33.jpg" small_image_url="http://d.gr-assets.com/books/1411114164s/33.jpg" title="The Lord of the Rings (The Lord of the Rings, #1-3)" type="Book"> books_count=351 id=3462456 original_publication_day=nil original_publication_month=nil original_publication_year=1955 ratings_count=394372 text_reviews_count=8516>

book.best_book.title works though.

I know at least that author attributes like 'author.link' still function fine. I guess API changes have been made?

Maybe, i have no idea as i havent used the gem for a few years. If interested, please investigate more.

I tried the same thing, and it worked. Can you replicate the error? Perhaps you have the error because you didn't use puts?

search.results.work.each do |b|
puts b.id
end

=> 3462456
=> 3204327
=> 2963845
=> 2964424
=> 4414
=> 4479
=> 26510
=> 89369
=> 17136
=> 65478
=> 521513
=> 17145
=> 1637201
=> 306544
=> 808427
=> 521514
=> 47306890
=> 17141
=> 17150
=> 90550

closing due to no activity.