Giter Site home page Giter Site logo

el-balde's Introduction

CircleCI Test Coverage Code Climate

El-balde

El-balde is an API for bucket list design. It exposes an API allowing consumers to create and manage bucket lists. This API provides endpoints for the following operations.

Documentation - https://elbalde.herokuapp.com/

Endpoints - https://elbalde.herokuapp.com/api/v1

Source code - https://github.com/andela-amagana/el-balde

API Features

  1. User authentication with JSON Web Tokens JWT Introduction to JWT
  2. Create a new bucket list
  3. List all the created bucket lists
  4. Get single bucket list
  5. Update this bucket list
  6. Delete this single bucket list
  7. Create a new item in bucket list
  8. List all the created items in a bucket list
  9. Get a single item in a bucket list
  10. Update a bucket list item
  11. Delete an item in a bucket list
  12. Paginate requests with parameters page and limit e.g. /bucketlists?page=2&limit=5
  13. Search bucket lists by name with parameter q e.g. /bucketlists?q=chall

System Dependencies

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

Getting Started

1. git clone https://github.com/andela-amagana/el-balde.git

2. cd el-balde

3. bundle install

4. rake db:migrate

5. rake db:seed

6. rails server

Tests

1. cd el-balde
2. rspec

API Endpoints

All endpoints except POST /users and POST /auth/login require an authentication token for Authorization, failure to which the API will return the error.

{
  "error": "Invalid request."
}

An Authorization token takes the format below.

{
  "auth_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJleHAiOjE0ODExMDE2NDYsImlzcyI6ImVsLWJhbGRlIiwiYXVkIjoiY2xpZW50In0.7U7NMCR8ea2Pv6ykozMNRwRHlLT6aFhPXpebOI8rTzw",
  "message": "Login successful."
}
EndPoint Functionality
POST /users Register a user
GET /users/:id View a single user
PUT /users/:id Update a user
DELETE /users/:id Delete a user
POST /auth/login Logs a user in
GET /auth/logout Logs a user out
POST /bucketlists/ Create a new bucket list
GET /bucketlists/ List all the created bucket lists
GET /bucketlists?page=2&limit=3 List 3 bucket lists from page 2
GET /bucketlists?q=chall Search for bucket lists containing string chall in their name
GET /bucketlists/:id Get single bucket list
PUT /bucketlists/:id Update this bucketlist
DELETE /bucketlists/:id Delete this single bucket list
POST /bucketlists/:id/items/ Create a new item in bucket list
GET /bucketlists/:id/items List all the created items in a bucket list
GET /bucketlists/:id/items?page=2&limit=3 List 3 bucket list items from page 2
GET /bucketlists/:id/items/:item_id Get a single item in a bucket list
PUT /bucketlists/:id/items/:item_id Update a bucket list item
DELETE /bucketlists/:id/items/:item_id Delete an item in a bucket list

Request & Response Example

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

 http://elbalde.herokuapp.com/api/v1/bucketlists/1/items?page=1&limit=2
 Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJleHAiOjE0ODExMDE2NDYsImlzcyI6ImVsLWJhbGRlIiwiYXVkIjoiY2xpZW50In0.7U7NMCR8ea2Pv6ykozMNRwRHlLT6aFhPXpebOI8rTzw'

Response (application/json)

 [
    {
        "id": 1,
        "name": "North pole",
        "date_created": "2016-11-30  9:53:16",
        "date_modified": "2016-11-30 10:03:56",
        "done": true
    },
    {
        "id": 2,
        "name": "South pole",
        "date_created": "2016-11-30  9:53:25",
        "date_modified": "2016-11-30  9:53:25",
        "done": false
    }
]

Limitations

  1. JWT tokens are invalidated by reference to persisted generated tokens.
  2. COR is not supported.
  3. Rate limiting is not supported.

el-balde's People

Contributors

alex-magana avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.