Skip to content

Commit

Permalink
deps(mix): update open_trip_planner_client to 0.8 (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen authored Apr 30, 2024
1 parent 915cae3 commit 23f075f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1,268 deletions.
27 changes: 14 additions & 13 deletions lib/trip_plan/api/open_trip_planner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,30 @@ defmodule TripPlan.Api.OpenTripPlanner do
score = json["accessibilityScore"]

%Itinerary{
start: parse_time(json["startTime"]),
stop: parse_time(json["endTime"]),
start: parse_time(json["start"]),
stop: parse_time(json["end"]),
legs: Enum.map(json["legs"], &parse_leg/1),
accessible?: if(score, do: score == 1.0),
tag: json["tag"]
}
end

defp parse_time(ms_after_epoch) do
{:ok, ms_after_epoch_dt} =
ms_after_epoch
|> DateTime.from_unix(:millisecond)

Timex.to_datetime(
ms_after_epoch_dt,
Application.fetch_env!(:open_trip_planner_client, :timezone)
)
defp parse_time(iso8601_formatted_datetime) do
Timex.parse!(iso8601_formatted_datetime, "{ISO:Extended}")
end

defp parse_leg(json) do
estimated_or_scheduled = fn key ->
if json[key]["estimated"] do
json[key]["estimated"]["time"]
else
json[key]["scheduledTime"]
end
end

%Leg{
start: parse_time(json["startTime"]),
stop: parse_time(json["endTime"]),
start: parse_time(estimated_or_scheduled.("start")),
stop: parse_time(estimated_or_scheduled.("end")),
mode: parse_mode(json),
from: parse_named_position(json["from"], "stop"),
to: parse_named_position(json["to"], "stop"),
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ defmodule DotCom.Mixfile do
{:open_trip_planner_client,
[
github: "thecristen/open_trip_planner_client",
ref: "v0.6.3"
ref: "v0.8.0"
]},
{:parallel_stream, "1.1.0"},
# latest version 1.7.11
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"nimble_ownership": {:hex, :nimble_ownership, "0.3.1", "99d5244672fafdfac89bfad3d3ab8f0d367603ce1dc4855f86a1c75008bce56f", [:mix], [], "hexpm", "4bf510adedff0449a1d6e200e43e57a814794c8b5b6439071274d248d272a549"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
"open_trip_planner_client": {:git, "https://github.com/thecristen/open_trip_planner_client.git", "db72c188f45e2b332168001614548df90cb6814a", [ref: "v0.6.3"]},
"open_trip_planner_client": {:git, "https://github.com/thecristen/open_trip_planner_client.git", "6216511947bd48ddb7d7cc6d80c1876232572c3f", [ref: "v0.8.0"]},
"parallel_stream": {:hex, :parallel_stream, "1.1.0", "f52f73eb344bc22de335992377413138405796e0d0ad99d995d9977ac29f1ca9", [:mix], [], "hexpm", "684fd19191aedfaf387bbabbeb8ff3c752f0220c8112eb907d797f4592d6e871"},
"parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"},
"phoenix": {:hex, :phoenix, "1.6.16", "e5bdd18c7a06da5852a25c7befb72246de4ddc289182285f8685a40b7b5f5451", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e15989ff34f670a96b95ef6d1d25bad0d9c50df5df40b671d8f4a669e050ac39"},
Expand Down
5 changes: 0 additions & 5 deletions test/trip_plan/fixture/README.md

This file was deleted.

64 changes: 0 additions & 64 deletions test/trip_plan/fixture/nearby_airport.json

This file was deleted.

Loading

0 comments on commit 23f075f

Please sign in to comment.