Packages
Elixir library to consume the public part REST API of FranceTélévisions Video Factory.
Retired package: Security issue - remove for privacy
Current section
Files
Jump to
Current section
Files
lib/legacy_client.ex
defmodule ExVideoFactory.LegacyClient do
use HTTPotion.Base
@moduledoc """
Documentation for ExVideoFactory.LegacyClient.
"""
@prod_endpoint "https://sivideo.webservices.francetelevisions.fr/tools/"
def process_url(url, options) do
(@prod_endpoint <> url)
|> prepend_protocol
|> append_query_string(options)
end
defp prepend_protocol(url) do
if url =~ ~r/\Ahttps?:\/\// do
url
else
"http://" <> url
end
end
defp append_query_string(url, options) do
if options[:query] do
url <> "?#{URI.encode_query(options[:query])}"
else
url
end
end
def process_request_headers(headers) do
Keyword.put(headers, :Accept, "application/json")
end
def process_response_body(body) do
body
|> Poison.decode!()
end
end