diff --git a/config/config.exs b/config/config.exs index 59eaa64..bd81ca2 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this diff --git a/lib/oembed/provider.ex b/lib/oembed/provider.ex index a0eb756..d4abfbe 100644 --- a/lib/oembed/provider.ex +++ b/lib/oembed/provider.ex @@ -14,11 +14,12 @@ defmodule OEmbed.Provider do @behaviour OEmbed.Provider @default_opts [follow_redirect: true, ssl: [{:versions, [:"tlsv1.2"]}]] + @request_opts Application.compile_env(:oembed, :request_opts, []) defp get_oembed(url) do opts = @default_opts - |> Keyword.merge(Application.compile_env(:oembed, :request_opts)) + |> Keyword.merge(@request_opts) with {:ok, %HTTPoison.Response{body: body}} <- HTTPoison.get(url, [], opts), @@ -39,5 +40,5 @@ defmodule OEmbed.Provider do end @callback provides?(String.t()) :: boolean - @callback get(String.t()) :: struct + @callback get(String.t()) :: {:ok, String.t()} | {:error, String.t()} end diff --git a/mix.exs b/mix.exs index bf14265..697fc43 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule OEmbed.Mixfile do use Mix.Project - @version "0.4.1" + @version "0.4.2" def project do [ @@ -41,7 +41,7 @@ defmodule OEmbed.Mixfile do {:httpoison, ">= 0.9.0"}, {:floki, ">= 0.24.0"}, {:poison, ">= 1.5.0"}, - {:exconstructor, ">= 1.0.0"}, + {:exconstructor, "~> 1.2.13"}, {:exvcr, "~> 0.12", only: :test}, {:inch_ex, ">= 0.0.0", only: :docs}, {:earmark, ">= 0.0.0", only: :dev},