diff --git a/.gitignore b/.gitignore index 205d4c80..2808f85b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ erl_crash.dump *.ez config/config.secret.exs /doc +.DS_Store diff --git a/lib/stripe/card.ex b/lib/stripe/card.ex index bfc09474..af6985d7 100644 --- a/lib/stripe/card.ex +++ b/lib/stripe/card.ex @@ -139,6 +139,6 @@ defmodule Stripe.Card do @spec delete(source, String.t, String.t, Keyword.t) :: :ok | {:error, Stripe.api_error_struct} def delete(owner_type, owner_id, card_id, opts \\ []) do endpoint = endpoint_for_owner(owner_type, owner_id) <> "/" <> card_id - Stripe.Request.delete(endpoint, opts) + Stripe.Request.delete(endpoint, %{}, opts) end end diff --git a/lib/stripe/customer.ex b/lib/stripe/customer.ex index a1de8b4f..8cfffbea 100644 --- a/lib/stripe/customer.ex +++ b/lib/stripe/customer.ex @@ -97,6 +97,6 @@ defmodule Stripe.Customer do @spec delete(binary, list) :: :ok | {:error, Stripe.api_error_struct} def delete(id, opts \\ []) do endpoint = @plural_endpoint <> "/" <> id - Stripe.Request.delete(endpoint, opts) + Stripe.Request.delete(endpoint, %{}, opts) end end diff --git a/lib/stripe/external_account.ex b/lib/stripe/external_account.ex index ec4fe5cd..b6ea0f23 100644 --- a/lib/stripe/external_account.ex +++ b/lib/stripe/external_account.ex @@ -86,6 +86,6 @@ defmodule Stripe.ExternalAccount do @spec delete(binary, list) :: :ok | {:error, Stripe.api_error_struct} def delete(id, opts = [connect_account: managed_account_id]) do endpoint = endpoint(managed_account_id) <> "/" <> id - Stripe.Request.delete(endpoint, opts) + Stripe.Request.delete(endpoint, %{}, opts) end end diff --git a/lib/stripe/plan.ex b/lib/stripe/plan.ex index ee3cd828..1e210e7f 100644 --- a/lib/stripe/plan.ex +++ b/lib/stripe/plan.ex @@ -77,6 +77,6 @@ defmodule Stripe.Plan do @spec delete(binary, list) :: :ok | {:error, Stripe.api_error_struct} def delete(id, opts \\ []) do endpoint = @plural_endpoint <> "/" <> id - Stripe.Request.delete(endpoint, opts) + Stripe.Request.delete(endpoint, %{}, opts) end end diff --git a/lib/stripe/request.ex b/lib/stripe/request.ex index 7095af9a..d938b389 100644 --- a/lib/stripe/request.ex +++ b/lib/stripe/request.ex @@ -41,9 +41,9 @@ defmodule Stripe.Request do |> handle_result end - @spec delete(String.t, Keyword.t) :: :ok | {:error, Stripe.api_error_struct} - def delete(endpoint, opts) do - %{} + @spec delete(String.t, map, Keyword.t) :: :ok | {:error, Stripe.api_error_struct} + def delete(endpoint, params, opts) do + params |> Stripe.request(:delete, endpoint, %{}, opts) |> handle_result end diff --git a/lib/stripe/subscription.ex b/lib/stripe/subscription.ex index cf02d1e0..9b780319 100644 --- a/lib/stripe/subscription.ex +++ b/lib/stripe/subscription.ex @@ -87,10 +87,12 @@ defmodule Stripe.Subscription do @doc """ Delete a subscription. + + Takes the `id` and an optional map of `params`. """ - @spec delete(binary, list) :: :ok | {:error, Stripe.api_error_struct} - def delete(id, opts \\ []) do + @spec delete(binary, map, list) :: :ok | {:error, Stripe.api_error_struct} + def delete(id, params \\ %{}, opts \\ []) do endpoint = @plural_endpoint <> "/" <> id - Stripe.Request.delete(endpoint, opts) + Stripe.Request.delete(endpoint, params, opts) end end diff --git a/mix.exs b/mix.exs index cffced57..9d0346b0 100644 --- a/mix.exs +++ b/mix.exs @@ -15,7 +15,7 @@ defmodule Stripe.Mixfile do "coveralls.html": :test ], test_coverage: [tool: ExCoveralls], - version: "2.0.0-alpha.6" + version: "2.0.0-alpha.7" ] end