lwwsx v0.1.0 Lwwsx.Parser View Source

Generic parser to parse all the Livedoor Weather Web Service api responses

Link to this section Summary

Functions

Parses the response from Livedoor Weather Web Service API calls

Link to this section Functions

Parses the response from Livedoor Weather Web Service API calls

Examples

iex> Lwwsx.Parser.parse({:ok, %HTTPoison.Response{body: "{\"description\": {\"text\": \"text\"}}", headers: [{"Server", "nginx"}], status_code: 200}})
{:ok, %{"description" => %{"text" => "text"}}, %{"Server" => "nginx"}}

iex> Lwwsx.Parser.parse({:ok, %HTTPoison.Response{body: "body", status_code: 404}})
{:error, "body"}

iex> Lwwsx.Parser.parse({:error, :hoge})
{:error}

iex> Lwwsx.Parser.parse(:fuga)
:fuga