Skip to content

Commit f1a1479

Browse files
committed
Fix Dialyzer errors
1 parent 4812546 commit f1a1479

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

lib/ex_twilio/api.ex

+15-18
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ defmodule ExTwilio.Api do
1515
Items are returned as instances of the given module's struct. For more
1616
details, see the documentation for each function.
1717
"""
18-
1918
use HTTPoison.Base
2019

2120
alias ExTwilio.Config
@@ -170,14 +169,25 @@ defmodule ExTwilio.Api do
170169

171170
def auth_header(headers, _), do: headers
172171

172+
@spec format_data(any) :: binary
173+
def format_data(data)
174+
175+
def format_data(data) when is_map(data) do
176+
data
177+
|> Map.to_list()
178+
|> Url.to_query_string()
179+
end
180+
181+
def format_data(data) when is_list(data) do
182+
Url.to_query_string(data)
183+
end
184+
185+
def format_data(data), do: data
186+
173187
###
174188
# HTTPotion API
175189
###
176190

177-
@doc """
178-
Automatically adds the correct headers to each API request.
179-
"""
180-
@spec process_request_headers(list) :: list
181191
def process_request_headers(headers \\ []) do
182192
headers
183193
|> Keyword.put(:"Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
@@ -187,17 +197,4 @@ defmodule ExTwilio.Api do
187197
def process_request_options(options) do
188198
Keyword.merge(options, Config.request_options())
189199
end
190-
191-
@spec format_data(data) :: binary
192-
def format_data(data) when is_map(data) do
193-
data
194-
|> Map.to_list()
195-
|> Url.to_query_string()
196-
end
197-
198-
def format_data(data) when is_list(data) do
199-
Url.to_query_string(data)
200-
end
201-
202-
def format_data(data), do: data
203200
end

lib/ex_twilio/jwt/access_token.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ defmodule ExTwilio.JWT.AccessToken do
9595
"cty" => "twilio-fpa;v=1"
9696
})
9797

98-
Joken.generate_and_sign!(token_config, nil, signer)
98+
Joken.generate_and_sign!(token_config, %{}, signer)
9999
end
100100

101101
defp list_of_grants?(grants) when is_list(grants) do

lib/ex_twilio/url_generator.ex

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ defmodule ExTwilio.UrlGenerator do
147147
end
148148

149149
@spec add_account_to_options(atom, list) :: list
150+
defp add_account_to_options(module, options)
151+
150152
defp add_account_to_options(module, options) do
151153
if module == ExTwilio.Account and options[:account] == nil do
152154
options
@@ -155,7 +157,6 @@ defmodule ExTwilio.UrlGenerator do
155157
end
156158
end
157159

158-
@spec add_account_to_options(atom, list) :: list
159160
defp add_flow_to_options(_module, options) do
160161
Keyword.put_new(options, :flow, Keyword.get(options, :flow_sid))
161162
end

0 commit comments

Comments
 (0)