Skip to content

Commit 4bead1e

Browse files
committed
Change use of deprecated Dict to Keyword in Http
Needed to avoid compile warnings on newer Elixir versions. Tidy some spacing + line length. Bump release to 0.1.2
1 parent 890a8bd commit 4bead1e

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

lib/segment/analytics.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ defmodule Segment.Analytics do
8080

8181
defp post_to_segment(function, body) do
8282
Http.post(function, body)
83-
|> log_result(function, body)
83+
|> log_result(function, body)
8484
end
8585

8686
defp log_result({_, %{status_code: code}}, function, body) when code in 200..299 do

lib/segment/http.ex

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ defmodule Segment.Analytics.Http do
44
@base_url "https://api.segment.io/v1/"
55

66
def process_url(url) do
7-
@base_url <> url
7+
@base_url <> url
88
end
99

1010
def post(url, body, headers, options \\ []) do
11-
options_with_auth = Keyword.merge(options, [hackney: [basic_auth: {Segment.write_key, ""}]])
11+
options_with_auth =
12+
Keyword.merge(options, [hackney: [basic_auth: {Segment.write_key(), ""}]])
13+
1214
request(:post, url, body, headers, options_with_auth)
1315
end
1416

1517
def process_options(options) do
16-
Dict.put(options, :basic_auth, {Segment.write_key(),""})
18+
Keyword.put(options, :basic_auth, {Segment.write_key(),""})
1719
end
1820

1921
def process_request_headers(headers) do
20-
Dict.put(headers, :"Content-Type", "application/json")
21-
|> Dict.put(:"accept", "application/json")
22+
headers
23+
|> Keyword.put(:"Content-Type", "application/json")
24+
|> Keyword.put(:"accept", "application/json")
2225
end
2326
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule AnalyticsElixir.Mixfile do
44
def project do
55
[
66
app: :segment,
7-
version: "0.1.1",
7+
version: "0.1.2",
88
elixir: "~> 1.0",
99
deps: deps(),
1010
description: "analytics_elixir",

0 commit comments

Comments
 (0)