Skip to content

Commit

Permalink
Merge pull request #223 from jayjun/2.0
Browse files Browse the repository at this point in the history
Add parameters to DELETE requests (#222)
  • Loading branch information
begedin authored and joshsmith committed May 15, 2017
2 parents 7330ff7 + 1af8597 commit 47df0e5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ erl_crash.dump
*.ez
config/config.secret.exs
/doc
.DS_Store
2 changes: 1 addition & 1 deletion lib/stripe/card.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/stripe/customer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/stripe/external_account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/stripe/plan.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions lib/stripe/request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions lib/stripe/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 47df0e5

Please sign in to comment.