Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format Event #313

Merged
merged 1 commit into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions lib/stripe/core_resources/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ defmodule Stripe.Event do
import Stripe.Request

@type event_data :: %{
object: map,
previous_attributes: map
}
object: map,
previous_attributes: map
}

@type event_request :: %{
id: String.t | nil,
idempotency_key: String.t | nil
}
id: String.t() | nil,
idempotency_key: String.t() | nil
}

@type t :: %__MODULE__{
id: Stripe.id,
object: String.t,
api_version: String.t | nil,
created: Stripe.timestamp,
data: event_data,
livemode: boolean,
pending_webhooks: non_neg_integer,
request: event_request | nil,
type: String.t
}
id: Stripe.id(),
object: String.t(),
api_version: String.t() | nil,
created: Stripe.timestamp(),
data: event_data,
livemode: boolean,
pending_webhooks: non_neg_integer,
request: event_request | nil,
type: String.t()
}

defstruct [
:id,
Expand All @@ -52,7 +52,7 @@ defmodule Stripe.Event do
@doc """
Retrieve an event.
"""
@spec retrieve(Stripe.id | t, Stripe.options) :: {:ok, t} | {:error, Stripe.Error.t}
@spec retrieve(Stripe.id() | t, Stripe.options()) :: {:ok, t} | {:error, Stripe.Error.t()}
def retrieve(id, opts \\ []) do
new_request(opts)
|> put_endpoint(@plural_endpoint <> "/#{get_id!(id)}")
Expand All @@ -63,7 +63,7 @@ defmodule Stripe.Event do
@doc """
List all events, going back up to 30 days.
"""
@spec list(map, Stripe.options) :: {:ok, Stripe.List.of(t)} | {:error, Stripe.Error.t}
@spec list(map, Stripe.options()) :: {:ok, Stripe.List.of(t)} | {:error, Stripe.Error.t()}
def list(params \\ %{}, opts \\ []) do
new_request(opts)
|> put_endpoint(@plural_endpoint)
Expand Down
4 changes: 2 additions & 2 deletions test/stripe/core_resources/event_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ defmodule Stripe.EventTest do
describe "retrieve/2" do
test "retrieves an event" do
assert {:ok, %Stripe.Event{}} = Stripe.Event.retrieve("evt_123")
assert_stripe_requested :get, "/v1/events/evt_123"
assert_stripe_requested(:get, "/v1/events/evt_123")
end
end

describe "list/2" do
test "lists all events" do
assert {:ok, %Stripe.List{data: [%Stripe.Event{}]}} = Stripe.Event.list()
assert_stripe_requested :get, "/v1/events"
assert_stripe_requested(:get, "/v1/events")
end
end
end