Packages

Elixir wrapper for GwentAPI developed using Tesla HTTP client.

Current section

Files

Jump to
plotka lib plotka.ex
Raw

lib/plotka.ex

defmodule Plotka do
@moduledoc """
Elixir wrapper for [GwentAPI](https://gwentapi.com/).
Developed using [Tesla](https://github.com/teamon/tesla) HTTP Client.
Płotka (English: Roach) is the name that Geralt of Rivia, the witcher,
gives to all of his horses. His preference is for mares.
© http://witcher.wikia.com/wiki/Roach
"""
use Tesla, only: ~w(get)a
plug Tesla.Middleware.BaseUrl, "https://api.gwentapi.com"
adapter Tesla.Adapter.Hackney
@doc """
Retrieve avaiable resources list.
## Example:
iex> Plotka.resources
%{"cards" => "https://api.gwentapi.com/v0/cards/",
"factions" => "https://api.gwentapi.com/v0/factions/",
"glyphs" => "https://api.gwentapi.com/v0/glyphs/",
"patches" => "https://api.gwentapi.com/v0/patches/",
"rarities" => "https://api.gwentapi.com/v0/rarities/",
"types" => "https://api.gwentapi.com/v0/types/"}
"""
def resources do
response = get("/v0")
Poison.decode!(response.body)
end
end