Bundled is an API only service for administering credits. If your application sells individual things, Bundled can help you sell bundles of things without adding lots of new logic to your application.
For example, if you sell fresh cut flowers and want to allow people to buy 10 bunches of flowers mailed out at their request then a bundle may work well, as it means they only need to pay once.
This is a Rails 5.1 api only application with a Postgres database. To get up and running
brew install postgresql
bundle exec rails db:create
bundle exec rails db:migrate
Tests are RSpec, run them with
bundle exec rspec
All endpoints are found at the base URL
https://bundled-api.herokuapp.com
/signup
POST
{
"Content-Type: application/json"
}
{
"name":"Dulce Marks",
"email":"[email protected]",
"password":"Password",
"password_confirmation":"Password"
}
201 (Created)
{
"message":"Account created successfully",
"auth_token":"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1"
}
/auth/login
POST
{
"Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1"
"Content-Type: application/json"
}
{
"email":"[email protected]",
"password":"Password"
}
200 (OK)
{
"auth_token":"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1"
}
To create a bundle you must first generate a UUID for the customer and store this in your database, you must also provide the name of the product the bundle is for.
/bundles
POST
{
"Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1"
"Content-Type: application/json"
}
{
"customer_reference":"[CUSTOMER_UUID]",
"starting_credits":43,
"remaining_credits":34,
"product":"Intelligent Paper Watch",
}
{
"product":"Intelligent Paper Watch",
"customer_reference":"326abe129f76457c5494",
"starting_credits":43,
"remaining_credits":34
}
Query the number of credits a customer has for a specific product
/credit_counter
POST
{
"Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1"
"Content-Type: application/json"
}
{
"customer_reference":"[CUSTOMER_UUID]",
"product":"Intelligent Paper Watch"
}
{
"remaining_credits":34
}
Adjust the number of credits on a bundle for a specific customer and product
/credit_adjustment
POST
{
"Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1"
"Content-Type: application/json"
}
{
"customer_reference":"[CUSTOMER_UUID]",
"product":"Intelligent Paper Watch",
"credit_adjustment":-1
}
{
"credit_adjustment":-1,
"remaining_credits":33
}