pezra / exhal

Use HAL APIs with ease
MIT License
22 stars 15 forks source link

Incorrect example in the documentation #47

Closed amhamid closed 8 years ago

amhamid commented 8 years ago

There is an incorrect example in the documentation, that can cause users have difficulties in using it. See my pull request: #46

Details

  1. Instead of this:
    iex> doc = ExHal.client
    ...> |> ExHal.Client.add_headers("User-Agent": "MyClient/1.0")
    ...> |> ExHal.Client.get("http://example.com/hal")
    %ExHal.Document{...}

==> You need to pattern match like this, so that your next example to follow_link will work fine:

{:ok, doc} = ExHal.client
...> |> ExHal.Client.add_headers("User-Agent": "MyClient/1.0")
...> |> ExHal.Client.get("http://example.com/hal")
%ExHal.Document{...}
  1. Also here, instead of:
    iex> ExHal.follow_link("self")

==> Should be this:

iex> ExHal.follow_link(doc, "self")
pezra commented 8 years ago

Fixed by #46. Thanks.