Build Status

Splitwise API wrapper

A wrapper for the Splitwise API.

Installation

If available in Hex, the package can be installed by adding ex_splitwise to your list of dependencies in mix.exs:

def deps do
[
{:ex_splitwise, "~> 0.1.0"}
]
end

Getting started

  1. Register your application to get a key and secret in order to authenticate to the API.
  2. Use the key and secret to get a token:

Let the user navigate to the authorize_url to enter their credentials:

authorize_url = ExSplitwise.OAuth2.Client.authorize_url!()

Get a token with the code returned by Splitwise:

def callback(conn, params) do
ExSplitwise.OAuth2.Client.get_token!(params["code"])
render(conn, "index.html")
end
  1. Make a request (current_user)
def user(conn, _params) do
%{body: body} = ExSplitwise.Users.current()
json(conn, user)
end

Usage

All the functions return a %ExSplitwise.Reponse{} struct with the following fields:

Functions

Users

Groups

Friends

Expenses

Notifications

Comments

Currencies

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/splitwise.