Skip to content

Commit

Permalink
add back typespecs and fix default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiercy827 committed Oct 8, 2018
1 parent 0f3c94d commit 0fa5ad1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/lob/resource_base.ex
Expand Up @@ -19,6 +19,7 @@ defmodule Lob.ResourceBase do
Client.get_request("#{base_url()}?#{Util.build_query_string(params)}" , Util.build_headers(headers))
end

@spec list!(map, map) :: {map, list}
def list!(params \\ %{}, headers \\ %{}) do
case list(params, headers) do
{:ok, body, headers} -> {body, headers}
Expand All @@ -33,7 +34,8 @@ defmodule Lob.ResourceBase do
Client.get_request(resource_url(id), Util.build_headers(headers))
end

def retrieve!(id \\ %{}, headers \\ %{}) do
@spec retrieve!(String.t, map) :: {map, list}
def retrieve!(id, headers \\ %{}) do
case retrieve(id, headers) do
{:ok, body, headers} -> {body, headers}
error -> raise to_string(error)
Expand All @@ -47,7 +49,8 @@ defmodule Lob.ResourceBase do
Client.post_request(base_url(), Util.build_body(data), Util.build_headers(headers))
end

def create!(data \\ %{}, headers \\ %{}) do
@spec create!(String.t, map) :: {map, list}
def create!(data, headers \\ %{}) do
case create(data, headers) do
{:ok, body, headers} -> {body, headers}
error -> raise to_string(error)
Expand All @@ -61,7 +64,8 @@ defmodule Lob.ResourceBase do
Client.delete_request(resource_url(id), Util.build_headers(headers))
end

def delete!(id \\ %{}, headers \\ %{}) do
@spec delete!(String.t, map) :: {map, list}
def delete!(id, headers \\ %{}) do
case delete(id, headers) do
{:ok, body, headers} -> {body, headers}
error -> raise to_string(error)
Expand Down

0 comments on commit 0fa5ad1

Please sign in to comment.