Created
May 8, 2015 19:58
-
-
Save Frost/ca99f1aed635fc247657 to your computer and use it in GitHub Desktop.
Fetching book info from Google Books API using elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule GoogleBooks do | |
| use HTTPoison.Base | |
| @base_url "https://www.googleapis.com/books/v1/volumes?q=isbn:" | |
| def process_url(isbn13) do | |
| isbn = String.replace(isbn13, "-", "") | |
| @base_url <> isbn | |
| end | |
| def process_response_body(body) do | |
| body | |
| |> Poison.decode! | |
| |> Enum.map(fn({k, v}) -> {String.to_atom(k), v} end) | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
...and exchange
@base_urlfor"http://libris.kb.se/xsearch?format=json&query=ISBN:"to look stuff up on LIBRIS :)