Current section
7 Versions
Jump to
Current section
7 Versions
Compare versions
5
files changed
+25
additions
-6
deletions
| @@ -3,6 +3,17 @@ Trello | |
| 3 3 | |
| 4 4 | Wrapper for trello api |
| 5 5 | |
| 6 | + #### Getting Started |
| 7 | + ```elixir |
| 8 | + config :trello, |
| 9 | + secret: "23o4hqsfkdhalsdjfalksjdfl;" |
| 10 | + ``` |
| 11 | + ###### To use env key |
| 12 | + ```elixir |
| 13 | + config :trello, |
| 14 | + secret: {:system, "TRELLO_KEY"} |
| 15 | + ``` |
| 16 | + |
| 6 17 | ### Methods |
| 7 18 | |
| 8 19 | - `get(url, secret)` |
| @@ -18,4 +18,4 @@ | |
| 18 18 | [{<<"app">>,<<"poison">>}, |
| 19 19 | {<<"optional">>,false}, |
| 20 20 | {<<"requirement">>,<<">= 1.5.0">>}]}]}. |
| 21 | - {<<"version">>,<<"1.0.0">>}. |
| 21 | + {<<"version">>,<<"1.0.1">>}. |
| @@ -1,6 +1,5 @@ | |
| 1 1 | defmodule Trello do |
| 2 2 | alias Trello.Http |
| 3 | - import IEx |
| 4 3 | |
| 5 4 | def get(url, secret), do: Http.get(create_url(url, secret)) |> unwrap_http |
| 6 5 | def get!(url, secret), do: Http.get!(create_url(url, secret)) |> unwrap_http |
| @@ -56,9 +55,19 @@ defmodule Trello do | |
| 56 55 | |
| 57 56 | def process_error(error), do: error |
| 58 57 | def process_success(body), do: body |
| 59 | - |
| 60 | - defp key, do: Application.fetch_env!(:trello, :secret) |
| 61 58 | defp has_query_params?(url), do: Regex.match?(~r/\?/, url) |
| 59 | + |
| 60 | + defp key do |
| 61 | + secret = Application.fetch_env!(:trello, :secret) |
| 62 | + |
| 63 | + if (is_tuple secret) do |
| 64 | + {:system, key} = secret |
| 65 | + |
| 66 | + System.get_env(key) |
| 67 | + else |
| 68 | + secret |
| 69 | + end |
| 70 | + end |
| 62 71 | |
| 63 72 | defp get_lists_with_id(id, idName, list) do |
| 64 73 | Enum.filter list, fn(item) -> |
| @@ -1,6 +1,5 @@ | |
| 1 1 | defmodule Trello.Http do |
| 2 2 | use HTTPoison.Base |
| 3 | - import IEx |
| 4 3 | |
| 5 4 | def process_url(url), do: "https://trello.com/1/" <> url |
| @@ -1,7 +1,7 @@ | |
| 1 1 | defmodule TrelloElixir.Mixfile do |
| 2 2 | use Mix.Project |
| 3 3 | |
| 4 | - @version "1.0.0" |
| 4 | + @version "1.0.1" |
| 5 5 | @elixir_version "~> 1.2" |
| 6 6 | |
| 7 7 | def project do |