Skip to content

Add parse_book_data(work_id) helper method

Goal: create a parse_book_data(work_id) helper method that can be used by the /search endpoint and the /books/work_id endpoint (for page that displays info about a single book)

  • Uses the OpenLibrary works api to get the following:
  • work title
  • author: will need to get the "name" key value pair from the authors api
  • description
  • cover ID (by picking the first from the list of covers)

*** method should check to ensure that the work_id is valid and if its not, should return null or equivalent so that search method can check that all books in its return list are valid. The works api returns the following json an invalid work_id is used in the request: {"error": "notfound", "key": "/works/0L37831091W"}

Return a book object containing the following required fields: work_id, title, author, description, cover_id

Closes #95 (closed)

Edited by ehurst96