- Install the prequisites:
$ gem install rails
(We use ActiveRecord for database migrations, see more details here) - Create the database:
$ createdb yobs
- Run the migrations:
$ rake
- Seed the database:
$ psql yobs < seed.sql
- Start the server:
$ ./serve.sh
Query for a list of users.
Returns:
{
"Users": [
{
"Facebook_id": <int>,
"Id": <int>
},
{
"Facebook_id": <int>,
"Id": <int>
},
…,
]
}
Retrieve the user with the given facebook_id
(which is required).
Returns:
{
"Facebook_id": <ID as int>,
"Id": <ID as int>
}
Create a new user with the given facebook ID (required).
Returns:
{
"Facebook_id": <ID as int>,
"Id": <ID as int>
}
Query for transactions. Optionally, pass a facebook_id
to filter the results by user.
Returns:
{
"Transactions": [
{
"Id": <int>,
"Owner_id": <int>,
"Amount": <int>,
"Description": <string>
},
…,
]
}
Retrieve the transaction with the given ID (required).
Returns:
{
"Id": <int>,
"Owner_id": <int>,
"Amount": <int>,
"Description": <string>
}
Create a new transaction with an associated owner. Either owner_id
or facebook_id
is required (passing both will result in an error). You must also pass an amount
, but description
is optional.
Returns:
{
"Id": <int>,
"Owner_id": <int>,
"Amount": <int>,
"Description": <string>
}
-
Users
- facebook_id
-
StripeCustomers
- stripe_customer_id
- user_id
-
Transactions
- owner_id (user)
- amount (cents)
- description (text)
-
UserTransactions
- user_id
- transaction_id
- amount