diff --git a/lib/kaffy/resource_query.ex b/lib/kaffy/resource_query.ex index b464789b..c88d91ab 100644 --- a/lib/kaffy/resource_query.ex +++ b/lib/kaffy/resource_query.ex @@ -136,21 +136,7 @@ defmodule Kaffy.ResourceQuery do {term, term_type} = case Decimal.parse(term) do - {:ok, value} -> - # this is the return value for the decimal package pre-2.0 - number = if value.exp >= 0, do: :integer, else: :decimal - - case number do - :integer -> - v = Decimal.to_integer(value) |> to_string() - {v, number} - - :decimal -> - {term, number} - end - {value, ""} -> - # this is the return value for the decimal package since 2.0 number = if Decimal.integer?(value), do: :integer, else: :decimal case number do diff --git a/mix.exs b/mix.exs index 099ffa85..3a4681df 100644 --- a/mix.exs +++ b/mix.exs @@ -42,7 +42,8 @@ defmodule Kaffy.MixProject do {:mock, "~> 0.3.3", only: :test}, {:ecto, "~> 3.0"}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, - {:jason, "~> 1.3", only: :test} + {:jason, "~> 1.3", only: :test}, + {:decimal, "~> 2.2", optional: true} ] end diff --git a/mix.lock b/mix.lock index f8260d0b..790c55b2 100644 --- a/mix.lock +++ b/mix.lock @@ -1,6 +1,6 @@ %{ "castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"}, - "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, + "decimal": {:hex, :decimal, "2.2.0", "df3d06bb9517e302b1bd265c1e7f16cda51547ad9d99892049340841f3e15836", [:mix], [], "hexpm", "af8daf87384b51b7e611fb1a1f2c4d4876b65ef968fa8bd3adf44cff401c7f21"}, "earmark_parser": {:hex, :earmark_parser, "1.4.33", "3c3fd9673bb5dcc9edc28dd90f50c87ce506d1f71b70e3de69aa8154bc695d44", [:mix], [], "hexpm", "2d526833729b59b9fdb85785078697c72ac5e5066350663e5be6a1182da61b8f"}, "ecto": {:hex, :ecto, "3.10.3", "eb2ae2eecd210b4eb8bece1217b297ad4ff824b4384c0e3fdd28aaf96edd6135", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "44bec74e2364d491d70f7e42cd0d690922659d329f6465e89feb8a34e8cd3433"}, "ex_doc": {:hex, :ex_doc, "0.30.6", "5f8b54854b240a2b55c9734c4b1d0dd7bdd41f71a095d42a70445c03cf05a281", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bd48f2ddacf4e482c727f9293d9498e0881597eae6ddc3d9562bd7923375109f"},