Current section

Files

Jump to
display_purposes lib display_purposes.ex
Raw

lib/display_purposes.ex

defmodule DisplayPurposes do
@moduledoc """
Display Purposes API wrapper
API wrapper functions:
- `tags/3` function
- `graph/3` function
"""
@query "https://query.displaypurposes.com/"
@tags "tag/"
@graph "graph/"
use HTTPoison.Base
@doc """
Get relevant hashtags for `word`
"""
def tags(word, headers \\ [], options \\ []) when is_binary(word) and is_list(headers) and is_list(options) do
get(@tags <> word, headers, options)
end
@doc """
Get neighborhood graph of hashtag
"""
def graph(word, headers \\ [], options \\ []) when is_binary(word) and is_list(headers) and is_list(options) do
get(@graph <> word, headers, options)
end
@doc false
def process_request_url(url) do
@query <> url
end
@doc false
def process_response_body(body) do
body |> Jason.decode!()
end
end