diff --git a/lib/nimrag/api/activity.ex b/lib/nimrag/api/activity.ex index e1bd125..7315958 100644 --- a/lib/nimrag/api/activity.ex +++ b/lib/nimrag/api/activity.ex @@ -22,8 +22,8 @@ defmodule Nimrag.Api.Activity do field(:duration) => float(), {"maxHR", :max_hr} => float(), {"averageHR", :average_hr} => float(), - field(:elevation_gain) => float(), - field(:elevation_loss) => float() + field(:elevation_gain) => nullable(float()), + field(:elevation_loss) => nullable(float()), }) end end diff --git a/lib/nimrag/api/activity_list.ex b/lib/nimrag/api/activity_list.ex index 8455437..d0c7e2e 100644 --- a/lib/nimrag/api/activity_list.ex +++ b/lib/nimrag/api/activity_list.ex @@ -11,8 +11,8 @@ defmodule Nimrag.Api.ActivityList do start_local_at: NaiveDateTime.t(), average_hr: float(), max_hr: float(), - elevation_gain: float(), - elevation_loss: float(), + elevation_gain: nil | float(), + elevation_loss: nil | float(), description: nil | String.t(), activity_type: ActivityType.t() } @@ -32,9 +32,9 @@ defmodule Nimrag.Api.ActivityList do :duration => float(), {"averageHR", :average_hr} => float(), {"maxHR", :max_hr} => float(), - field(:elevationGain) => float(), - field(:elevationLoss) => float(), - field(:description) => nullable(str()), + optional(field(:elevationGain)) => nullable(float()), + optional(field(:elevationLoss)) => nullable(float()), + optional(field(:description)) => nullable(str()), field(:activity_type) => ActivityType.schematic() }) end diff --git a/lib/nimrag/api/profile.ex b/lib/nimrag/api/profile.ex index 115a8ca..b3fda9d 100644 --- a/lib/nimrag/api/profile.ex +++ b/lib/nimrag/api/profile.ex @@ -137,9 +137,9 @@ defmodule Nimrag.Api.Profile do schema(__MODULE__, %{ field(:activity_heart_rate_visibility) => str(), field(:activity_map_visibility) => str(), - field(:activity_power_visibility) => str(), + field(:activity_power_visibility) => nullable(str()), field(:activity_start_visibility) => str(), - field(:allow_golf_live_scoring) => bool(), + field(:allow_golf_live_scoring) => nullable(bool()), field(:allow_golf_scoring_by_connections) => bool(), field(:badge_visibility) => str(), field(:bio) => nullable(str()), @@ -151,8 +151,8 @@ defmodule Nimrag.Api.Profile do field(:facebook_url) => nullable(str()), field(:favorite_activity_types) => list(str()), field(:favorite_cycling_activity_types) => list(str()), - field(:full_name) => str(), - field(:garmin_guid) => nullable(str()), + field(:full_name) => nullable(str()), + {"garminGUID", :garmin_guid} => nullable(str()), field(:id) => int(), field(:level_is_viewed) => bool(), field(:level_point_threshold) => int(), diff --git a/lib/nimrag/auth.ex b/lib/nimrag/auth.ex index 1ce704b..426e26e 100644 --- a/lib/nimrag/auth.ex +++ b/lib/nimrag/auth.ex @@ -295,7 +295,7 @@ defmodule Nimrag.Auth do defp signin_req(sso, %Req.Response{} = prev_resp) do sso.client - |> Req.Request.put_header("cookie", get_cookie(prev_resp)) + |> Req.Request.put_header("cookie", Enum.join(get_cookie(prev_resp), "; ")) |> Req.Request.put_header("referer", "#{sso.url}/embed") |> Req.get( url: "/signin", @@ -307,7 +307,7 @@ defmodule Nimrag.Auth do defp submit_signin_req(sso, %Req.Response{} = prev_resp, credentials) do with {:ok, csrf_token} <- get_csrf_token(prev_resp) do sso.client - |> Req.Request.put_header("cookie", get_cookie(prev_resp)) + |> Req.Request.put_header("cookie", Enum.join(get_cookie(prev_resp), "; ")) |> Req.Request.put_header("referer", "#{sso.url}/signin") |> Req.post( url: "/signin", diff --git a/mix.exs b/mix.exs index 188e057..7f69a67 100644 --- a/mix.exs +++ b/mix.exs @@ -24,12 +24,6 @@ defmodule Nimrag.MixProject do """, aliases: aliases(), test_coverage: [tool: ExCoveralls], - preferred_cli_env: [ - check: :test, - coveralls: :test, - "coveralls.detail": :test, - "coveralls.html": :test - ], dialyzer: [ ignore_warnings: ".dialyzer_ignore.exs", plt_file: {:no_warn, "priv/plts/dialyzer.plt"}, @@ -60,6 +54,17 @@ defmodule Nimrag.MixProject do ] end + def cli do + [ + preferred_envs: [ + check: :test, + coveralls: :test, + "coveralls.detail": :test, + "coveralls.html": :test + ] + ] + end + defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] @@ -75,7 +80,7 @@ defmodule Nimrag.MixProject do {:excoveralls, "~> 0.18.1", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.31", only: :dev, runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, - {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, + {:credo, "~> 1.7.11", only: [:dev, :test], runtime: false}, {:styler, "~> 0.11", only: [:dev, :test], runtime: false} ] end diff --git a/mix.lock b/mix.lock index 02c5537..e42c958 100644 --- a/mix.lock +++ b/mix.lock @@ -1,13 +1,13 @@ %{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"}, - "credo": {:hex, :credo, "1.7.7", "771445037228f763f9b2afd612b6aa2fd8e28432a95dbbc60d8e03ce71ba4446", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8bc87496c9aaacdc3f90f01b7b0582467b69b4bd2441fe8aae3109d843cc2f2e"}, + "credo": {:hex, :credo, "1.7.16", "a9f1389d13d19c631cb123c77a813dbf16449a2aebf602f590defa08953309d4", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d0562af33756b21f248f066a9119e3890722031b6d199f22e3cf95550e4f1579"}, "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.33.0", "690562b153153c7e4d455dc21dab86e445f66ceba718defe64b0ef6f0bd83ba0", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "3f69adc28274cb51be37d09b03e4565232862a4b10288a3894587b0131412124"}, "excoveralls": {:hex, :excoveralls, "0.18.1", "a6f547570c6b24ec13f122a5634833a063aec49218f6fff27de9df693a15588c", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d65f79db146bb20399f23046015974de0079668b9abb2f5aac074d078da60b8d"}, - "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, + "file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"}, "finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"}, "hammer": {:hex, :hammer, "6.2.1", "5ae9c33e3dceaeb42de0db46bf505bd9c35f259c8defb03390cd7556fea67ee2", [:mix], [{:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm", "b9476d0c13883d2dc0cc72e786bac6ac28911fba7cc2e04b70ce6a6d9c4b2bdc"}, "hpax": {:hex, :hpax, "1.0.0", "28dcf54509fe2152a3d040e4e3df5b265dcb6cb532029ecbacf4ce52caea3fd2", [:mix], [], "hexpm", "7f1314731d711e2ca5fdc7fd361296593fc2542570b3105595bb0bc6d0fad601"},