Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
af81574
[Feature] register api blueprint
WNjihia Jul 5, 2017
2464203
[Feature] add token authentication functionality
WNjihia Jul 5, 2017
db0962b
[Feature] refactor token creation functionality
WNjihia Jul 5, 2017
ab6e52d
[Feature] change user information
WNjihia Jul 5, 2017
47e0b7e
[Feature] add tests for invalid email format
WNjihia Jul 5, 2017
39772a1
[Feature] add create bucketlist functionality
WNjihia Jul 5, 2017
593a123
[Chore] add .env to gitignore
WNjihia Jul 5, 2017
166e68b
[Feature] add retrieve bucketlist functionality
WNjihia Jul 5, 2017
5715f5f
[Feature #146867225] add update bucketlist functionality
WNjihia Jul 5, 2017
db44a6e
[Feature #146867225] add delete bucketlist functionality
WNjihia Jul 5, 2017
68a7e7b
[Feature #146867225] add create item functionality
WNjihia Jul 5, 2017
bf733d2
[Feature #146867225] add item save and delete methods
WNjihia Jul 5, 2017
25f1707
[Feature #146867225] add retrieve functionality
WNjihia Jul 5, 2017
a63ceaa
[Feature #146867225] refactor authentication tests
WNjihia Jul 6, 2017
449b0ca
[Chore] add .travis.yml file
WNjihia Jul 6, 2017
3a96c56
[Feature #146867225] refactor bucketlist tests
WNjihia Jul 6, 2017
f18c3a1
[Feature #146867225] refactor failing items tests
WNjihia Jul 7, 2017
a979260
[Chore] update .travis.yml file
WNjihia Jul 7, 2017
2535ce4
[Chore] update .travis.yml file
WNjihia Jul 7, 2017
54ec19b
[Chore] update .travis.yml file
WNjihia Jul 7, 2017
5cf15a9
[Chore] add alternate secret key
WNjihia Jul 7, 2017
ffc989f
[Feature #146867225] change test db to sqlite
WNjihia Jul 7, 2017
b0d6585
[Feature #146867225] add alternate secret key for token
WNjihia Jul 7, 2017
6789f6d
[Feature #146867225] edit alternate secret key
WNjihia Jul 7, 2017
d95efb7
[Feature #146867225] add alternate secret key to decode
WNjihia Jul 7, 2017
1a8733b
[Chore] add coveralls to .travis.yml
WNjihia Jul 7, 2017
ef74f71
[Chore] add coveralls to .travis.yml
WNjihia Jul 7, 2017
09e77b6
[Chore] add coveralls to .travis.yml
WNjihia Jul 7, 2017
2f8f3fb
[Chore] refactor test names to camelcase
WNjihia Jul 7, 2017
fad7bdf
[Chore] add coveragerc file
WNjihia Jul 7, 2017
59e6eec
[Chore] add .coveralls.yml file
WNjihia Jul 7, 2017
02e62b2
[Chore] refactor .travis.yml file
WNjihia Jul 7, 2017
2039e97
[Feature ##146867225] add test for item status change
WNjihia Jul 7, 2017
9977a1e
[Feature ##146867225] add test for deleting an item successfully
WNjihia Jul 7, 2017
456446c
[Feature ##146867225] add similar alternate secret keys
WNjihia Jul 7, 2017
e055b24
[Feature #146867225] add test for updating items with same data
WNjihia Jul 7, 2017
e3ca740
[Feature #146867701] add pagination to api
WNjihia Jul 10, 2017
9c90d4c
[Feature #146867823] implement search by name for bucketlist
WNjihia Jul 10, 2017
82f9ee9
[Feature #146867823] implement search by name for items
WNjihia Jul 10, 2017
d16f428
[Chore] add README.md
WNjihia Jul 10, 2017
6d5e8d9
[Chore] add images to README.md
WNjihia Jul 10, 2017
293d7af
[Feature #146867225] refactor check for name format
WNjihia Jul 10, 2017
cd439c9
[Chore] add travis ci and coveralls badge
WNjihia Jul 10, 2017
650b656
Add Codacy badge
codacy-badger Jul 10, 2017
b908042
Merge pull request #3 from codacy-badger/codacy-badge
WNjihia Jul 10, 2017
c669e10
Transferring API Description file from Apiary.io
WNjihia Jul 10, 2017
47b3182
[Chore] update README.md
WNjihia Jul 10, 2017
164c9fd
[Chore] update .gitignore
WNjihia Jul 10, 2017
649a4b5
Merge branch 'develop' of https://github.com/WNjihia/flask-bucketlist…
WNjihia Jul 10, 2017
f6f43d9
Saving API Description Document from apiary-client
WNjihia Jul 11, 2017
6bb1c77
[Chore] add API documentation
WNjihia Jul 11, 2017
930e22d
[Chore] add API documentation
WNjihia Jul 11, 2017
543481f
[Feature #146867225] add app error handlers
WNjihia Jul 12, 2017
71a1c3d
[Feature #146867225] add route to index.html
WNjihia Jul 12, 2017
89acff8
[Feature #146867225] add api documentation
WNjihia Jul 12, 2017
e11d134
[Chore] add format to print variables
WNjihia Jul 12, 2017
b22f47d
[Chore] move index.html to templates folder
WNjihia Jul 12, 2017
7e6721b
[Feature #146867225] refactor status change test
WNjihia Jul 12, 2017
8a39880
[Feature #146867225] refactor message response
WNjihia Jul 12, 2017
dd508cc
[Feature #146867225] add validate helper functions
WNjihia Jul 12, 2017
03d58c7
[Chore] add dredd.yml file
WNjihia Jul 12, 2017
75cd08a
[Feature #146867225] refactor response messages
WNjihia Jul 12, 2017
1a1bdfd
[Feature #146867225] refactor patch functionality
WNjihia Jul 12, 2017
2d57954
[Feature #146867225] refactor item tests
WNjihia Jul 12, 2017
5895a3b
[Feature #146867225] refactor user_auth tests
WNjihia Jul 12, 2017
d7a63c3
[Chore] change travis ci badge branch
WNjihia Jul 12, 2017
3623cc3
[Chore] add Procfile
WNjihia Jul 13, 2017
ca44814
[Chore] update requirements.txt
WNjihia Jul 13, 2017
6dd3f98
[Chore] add gunicorn to requirements.txt
WNjihia Jul 13, 2017
0d90050
[Chore] update Procfile
WNjihia Jul 13, 2017
a6b1e97
[Chore] specify how to start app
WNjihia Jul 13, 2017
d140389
[Chore] refactor Procfile
WNjihia Jul 13, 2017
525a6c0
[Feature #146867225] refactor put and patch functionality
WNjihia Jul 13, 2017
be283d0
[Feature #146867225] refactor update item tests
WNjihia Jul 13, 2017
ef83229
[Feature #146867225] add test for access to item resource with no token
WNjihia Jul 13, 2017
26ae122
[Feature #146867225] add test for access to bucketlist resource with …
WNjihia Jul 13, 2017
7d00577
[Feature #146867225] add test delete item with invalid token
WNjihia Jul 13, 2017
fce9c56
[Chore] edit pep8 error
WNjihia Jul 13, 2017
c87e781
[Feature #146867225] add check for password length
WNjihia Jul 13, 2017
9a4e5cd
[Feature #146867225] add tests to check for password length
WNjihia Jul 13, 2017
359f19e
[Feature #146867225] add tests to check for password length
WNjihia Jul 13, 2017
4151e4b
Merge branch 'develop' of https://github.com/WNjihia/flask-bucketlist…
WNjihia Jul 13, 2017
cfd55d1
[Chore] remove alternative secret key
WNjihia Jul 13, 2017
6b3b649
[Chore] update host on api documentation
WNjihia Jul 13, 2017
7dfefb5
[Chore] remove coveralls badge
WNjihia Jul 13, 2017
70b6dcd
[Chore] add coveralls badge
WNjihia Jul 13, 2017
21ebf3f
[Chore] add patch method to api documentation
WNjihia Jul 13, 2017
e532004
[Chore] update api routes on documentation
WNjihia Jul 13, 2017
e33b18f
[Chore] update request url
WNjihia Jul 14, 2017
dfb828b
[Chore] refactor url route
WNjihia Jul 14, 2017
777fb4b
[Chore] add documentation link to README.md
WNjihia Jul 14, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[report]
omit =
*/migrations/*
*virtualenvs/*
*/site-packages/*
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: nZcYGqlIeVZLAh31Hl9JwvqPB8btPoHp3
5 changes: 0 additions & 5 deletions .env

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
*.pyc
.DS_Store
.env
.cache/*
.coverage
instance/testdb.db
tests/.coverage
tests/cover/
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: python
python:
- "3.5"
- "3.6"
# command to install dependencies
install:
- pip install -r requirements.txt
- pip install coveralls
# command to run tests
script:
# coverage run -m unittest
nosetests --with-coverage --cover-package=bucketlist
env:
- DB=postgres

after_success:
coveralls
3 changes: 3 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: gunicorn run:app
init: python manage.py db init
upgrade: python manage.py db upgrade
163 changes: 162 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,162 @@
# flask-bucketlist-api
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/93600bb65a2d4e51b0659003115ea6d6)](https://www.codacy.com/app/WNjihia/flask-bucketlist-api?utm_source=github.com&utm_medium=referral&utm_content=WNjihia/flask-bucketlist-api&utm_campaign=badger)
[![Build Status](https://travis-ci.org/WNjihia/flask-bucketlist-api.svg?branch=develop)](https://travis-ci.org/WNjihia/flask-bucketlist-api)
[![Coverage Status](https://coveralls.io/repos/github/WNjihia/flask-bucketlist-api/badge.svg?branch=develop)](https://coveralls.io/github/WNjihia/flask-bucketlist-api?branch=develop)

API documentation: http://docs.bucketlistwnjihia.apiary.io/

### BucketList API

According to the Oxford Dictionary, a BucketList is a number of experiences or achievements that a person hopes to have or accomplish during their lifetime.

This is a Flask API for an online BucketList service.

### Installation and Setup

Clone the repository from GitHub:
```
$ git clone https://github.com/WNjihia/flask-bucketlist-api.git
```

Fetch from the develop branch:
```
$ git fetch origin develop
```

Navigate to the `flask-bucketlist-api` directory:
```
$ cd flask-bucketlist-api
```

Create a virtual environment:
> Use [this guide](http://docs.python-guide.org/en/latest/dev/virtualenvs/) to create and activate a virtual environment.

Install the required packages:
```
$ pip install -r requirements.txt

```

Install postgres:
```
brew install postgresql
type psql in terminal.
On postgres interactive interface, type CREATE DATABASE flask_api;
```

Create a .env file and add the following:
```
source name-of-virtual-environment/bin/activate
export FLASK_APP="run.py"
export SECRET="a-secret-key"
export DATABASE_URL="postgresql://localhost/flask_api"
```

Then run:
```
source .env
```

Run the migrations:
```
python manage.py db init
python manage.py db migrate
python manage.py db upgrade
```

Launch the program:
```
python run.py
```

### API Endpoints

| Methods | Resource URL | Description | Public Access |
| ---- | ------- | --------------- | ------ |
|POST| `/api/v1/auth/login` | Logs a user in| TRUE |
|POST| `/api/v1/auth/register` | Register a user | TRUE |
|POST| `/api/v1/bucketlists/` | Create a new bucket list | FALSE |
|GET| `/api/v1/bucketlists/` | List all the created bucket lists | FALSE |
|GET| `/api/v1/bucketlists/<bucketlist_id>/` | Get single bucket list | FALSE |
|PUT| `/api/v1/bucketlists/<bucketlist_id>/` | Update this bucket list | FALSE |
|DELETE| `/api/v1/bucketlists/<bucketlist_id>/` | Delete this single bucket list | FALSE |
|POST| `/api/v1/bucketlists/<bucketlist_id>/items/` | Create a new item in bucket list | FALSE |
|GET| `/api/v1/bucketlists/<bucketlist_id>/items/` | List items in this bucket list | FALSE |
|GET| `/api/v1/bucketlists/<bucketlist_id>/items/<item_id>/` | Get single bucket list item | FALSE |
|PUT|`/api/v1/bucketlists/<bucketlist_id>/items/<item_id>/` | Update a bucket list item | FALSE |
|DELETE|`/api/v1/bucketlists/<bucket_id>/items/<item_id>/` | Delete an item in a bucket list | FALSE |
|GET| `/api/v1/bucketlists?limit=2&` | Pagination to get 2 bucket list records per page | FALSE |
|GET| `/api/v1/bucketlists?q=bucket` | Search for bucket lists with name like ```bucket``` | FALSE |
|GET| `/api/v1/bucketlists/<bucketlist_id>/items?limit=2&` | Pagination to get 2 bucketlist item records per page | FALSE |
|GET| `/api/v1/bucketlists/<bucketlist_id>/items?q=climb` | Search for bucketlist items with name like ```climb``` | FALSE |

### How to use the API

**Register a user**

![Alt text](https://image.ibb.co/gsQT4a/Screen_Shot_2017_07_10_at_14_34_15.png)

**To Login a user**

![Alt text](https://image.ibb.co/csyTLF/Screen_Shot_2017_07_10_at_12_31_28.png)

**Create a new BucketList**

![Alt text](https://image.ibb.co/dbq9cv/Screen_Shot_2017_07_10_at_14_39_18.png)

**Get all BucketLists**

![Alt text](https://image.ibb.co/gEhAZa/Screen_Shot_2017_07_10_at_12_35_12.png)

**Get a single BucketList**

![Alt text](https://image.ibb.co/cwy1qF/Screen_Shot_2017_07_10_at_14_43_33.png)

**Update a BucketList**

![Alt text](https://image.ibb.co/g0jDnv/Screen_Shot_2017_07_10_at_12_34_35.png)

**Delete a BucketList**

![Alt text](https://image.ibb.co/jmhYnv/Screen_Shot_2017_07_10_at_12_34_59.png)

**Create a new BucketList item**

![Alt text](https://image.ibb.co/jjFa0F/Screen_Shot_2017_07_10_at_12_36_39.png)

**Get all BucketList items**

![Alt text](https://image.ibb.co/j0iRqF/Screen_Shot_2017_07_10_at_12_36_53.png)

**Get a single BucketList item**

![Alt text](https://image.ibb.co/mhC5Hv/Screen_Shot_2017_07_10_at_14_42_10.png)

**Update a BucketList item**

![Alt text](https://image.ibb.co/ifFvja/Screen_Shot_2017_07_10_at_12_37_50.png)

**Delete a BucketList item**

![Alt text](https://image.ibb.co/e6pAHv/Screen_Shot_2017_07_10_at_12_38_13.png)

**Search for:**
**-a BucketList**

![Alt text](https://image.ibb.co/fnYvHv/Screen_Shot_2017_07_10_at_14_36_31.png)

**-an Item**

![Alt text](https://image.ibb.co/imZfja/Screen_Shot_2017_07_10_at_14_35_56.png)

**Pagination**

![Alt text](https://image.ibb.co/kPcYnv/Screen_Shot_2017_07_10_at_12_33_08.png)

![Alt text](https://image.ibb.co/f3dHEa/Screen_Shot_2017_07_10_at_12_33_24.png)

### Testing

To test, run the following command:
```
nosetests
```
Loading