Current section

Files

Jump to
ndc_ex_sdk lib message ndc_merge.ex
Raw

lib/message/ndc_merge.ex

defmodule NDCMerge do
def build_body do
end
def get_method_headers(generic_h, method_h) when is_nil(method_h), do: generic_h
def get_method_headers(generic_h, method_h), do: generic_h ++ method_h
def get_headers(headers, method) do
Enum.map(headers, fn ({key, value}) ->
{key, String.replace(value, "{{NDC-method}}", Atom.to_string(method))}
end)
end
def get_headers_consumer(headers, consumer) when is_nil(consumer), do: headers
def get_headers_consumer(headers, consumer), do: headers ++ consumer
def getData(data, credentials) when is_nil(credentials), do: data
def getData(data, credentials), do: data ++ credentials
def is_ssl(config, path) when config == nil or path == nil, do: [timeout: 60000, recv_timeout: 60000]
def is_ssl(ssl_config, path) when ssl_config != nil do
path = "#{path}keys/"
[
hackney: [ # :hackney options
ssl_options: [ # :ssl options
cacertfile: path <> ssl_config[:cacertfile], # CA certificate used to validate server cert; path(), "string" is ok
certfile: path <> ssl_config[:certfile], # client certificate, signed by CA; path(), "string" is ok
keyfile: path <> ssl_config[:keyfile], # private key for client.crt; path(). "string" is ok
password: ssl_config[:password] # password for keyfile; string(), "string" not ok, use 'char list'
]
],
timeout: 60000, recv_timeout: 60000
]
end
end