Skip to content

Commit

Permalink
support patch method
Browse files Browse the repository at this point in the history
  • Loading branch information
scrogson committed Oct 28, 2015
1 parent 369c13d commit 1da2ea2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/oauth2/access_token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,25 @@ defmodule OAuth2.AccessToken do
def put!(token, url, body \\ "", headers \\ [], opts \\ []),
do: request!(:put, token, url, body, headers, opts)

@doc """
Makes a `PATCH` request to the given `url` using the `OAuth2.AccessToken`
struct.
"""
@spec patch(t, binary, body, Client.headers, Keyword.t) :: {:ok, OAuth2.Response.t} | {:error, OAuth2.Error.t}
def put(token, url, body \\ "", headers \\ [], opts \\ []),
do: request(:patch, token, url, body, headers, opts)

@doc """
Same as `patch/5` but returns a `OAuth2.Response` or `OAuth2.Error` exception if
the request results in an error.
An `OAuth2.Error` exception is raised if the request results in an
error tuple (`{:error, reason}`).
"""
@spec patch(t, binary, body, Client.headers, Keyword.t) :: OAuth2.Response.t | OAuth2.Error.t
def put!(token, url, body \\ "", headers \\ [], opts \\ []),
do: request!(:patch, token, url, body, headers, opts)

@doc """
Makes a `POST` request to the given URL using the `OAuth2.AccessToken`.
"""
Expand Down

0 comments on commit 1da2ea2

Please sign in to comment.