Skip to content
/ buckyy Public

Buckyy is a simple bucketlist API allowing consumers to perform CRUD operations on bucketlists. A bucketlist has many items and belongs to a user.

Notifications You must be signed in to change notification settings

akabiru/buckyy

Repository files navigation

Build Status Coverage Status Code Climate

Buckyy 🎢 ⛵

Buckyy is a simple bucketlist API allowing consumers to perform CRUD operations on bucketlists. A user can have many bucketlists and each bucketlist can have many items.

API Features

  1. User authentication with JWT.
  2. User can perform CRUD operations on Buckelist and items resources
  3. API accepts paginated requests with limit e.g. curl -i http://buckyy.herokuapp.com/bucketlists?limit=5&page=2
  4. API uses Accept header to version api calls e.g. Accept:application/vnd.buckyy.v1+json.
  5. Apiary documentation for easier integration

Getting Started

  1. git clone https://github.com/andela-akabiru/buckyy.git
  2. cd buckyy
  3. bundle install
  4. rake db:setup
  5. rails server

The above will get you a copy of the project up and running on your local machine for development and testing purposes.

Dependencies

  1. Ruby
  2. PostgreSQL
  3. Bundler
  4. Ruby on Rails
  5. RSpec

Tests

1. cd buckyy
2. bundle exec rake

API Endpoints

All endpoints except /signup require a token for authentication. The API call should have the token in Authorization header.

http http://buckyy.herokuapp.com/bucketlists \
Authorization: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE0Njc2MTkxNDV9.R6VLZD4qtsdVHXZwU8bEo6S16cbNQfo7lICsNdAq00I"
EndPoint Functionality
POST /signup Signup a user
POST /auth/login Login user
GET /auth/logout Logout user
POST /bucketlists/ Create a new bucket list
GET /bucketlists/ List all the created bucket lists
GET /bucketlists?page=1&limit=5 List five bucketlists from page 1
GET /bucketlists?q=bucket Search for bucketlist
GET /bucketlists/:id Get single bucket list
PUT /bucketlists/:id Update this bucketlist
DELETE /bucketlists/:id Delete this single bucketlist
POST /bucketlists/:id/items/ Create a new item in bucketlist
PUT /bucketlists/:id/items/:item_id Update a bucketlist item
DELETE /bucketlists/:id/items/:item_id Delete an item in a bucket lists

Responses

The API responds with JSON data by default.

Error Handling

The API responds with an error message and http status code whenenever it encounters an error.

{
  "error": "Not Found",
  "status": "404"
}

Versions

The API uses Accept header to version api calls e.g. Accept:application/vnd.buckyy.v1+json. No breaking changes. 😃

Request & Response examples

Request GET /bucketlists?page=2&limit=2

 http https://buckyy.herokuapp.com/bucketlists?page=2&limit=2 \
 Authorization: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE0Njc2MTkxNDV9.R6VLZD4qtsdVHXZwU8bEo6S16cbNQfo7lICsNdAq00I'

Response (application/json)

[
    {
        "created_by": "1",
        "id": 3,
        "items": [
            {
                "bucketlist_id": 3,
                "done": false,
                "id": 3,
                "name": "Obi-Wan Kenobi",
                "date_created": "2016-07-04  5:16:12",
                "date_modified": "2016-07-04  5:16:12",
            }
        ],
        "name": "eaque"
    },
    {
        "created_by": "1",
        "id": 4,
        "items": [
            {
                "bucketlist_id": 4,
                "done": false,
                "id": 4,
                "name": "Chewbacca",
                "date_created": "2016-07-04  5:16:12",
                "date_modified": "2016-07-04  5:16:12",
            }
        ],
        "name": "non"
    }
]

Application Limitations

  1. The API only responds with JSON

Contributing

  1. Fork it! 🍴
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git add -A && git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature 🚀
  5. Submit a pull request 😎

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Buckyy is a simple bucketlist API allowing consumers to perform CRUD operations on bucketlists. A bucketlist has many items and belongs to a user.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published