https://github.com/abarrak/card-mine-api
Generates cards and saves them for later use or sharing.
https://github.com/abarrak/card-mine-api
cards devise-token-auth factory-girl jbuilder json rails rails-api rspec
Last synced: 2 months ago
JSON representation
Generates cards and saves them for later use or sharing.
- Host: GitHub
- URL: https://github.com/abarrak/card-mine-api
- Owner: abarrak
- License: mit
- Created: 2017-03-06T17:23:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-17T05:07:50.000Z (about 9 years ago)
- Last Synced: 2025-04-01T15:50:44.603Z (about 1 year ago)
- Topics: cards, devise-token-auth, factory-girl, jbuilder, json, rails, rails-api, rspec
- Language: Ruby
- Homepage:
- Size: 4.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Card Mine API
[](https://travis-ci.org/abarrak/card-mine-api) [](https://lima.codeclimate.com/github/abarrak/card-mine-api/coverage)

## Overview
This repository contains the source code of Card Mine web API.
It works as a card factory engine that helps you generate different kinds of cards along with stamps of formatted text, then persist them in the cloud.
It's essentially implemented to be the back-end to my capstone project for Udacity iOS nanodegree.
## REST API Documentation
The following table summarizes the various API endpoints.
| path | method | purpose |
| :--------------------------------------- | :----: | :--------------------------------------- |
| /api/v1/auth | POST | Email registration. Requires **email**, **password**, and **password_confirmation** params. A verification email will be sent to the email address provided. |
| /api/v1/auth | DELETE | Account deletion. This route will destroy users identified by their **uid**, **access_token** and **client** headers. |
| /api/v1/auth | PUT | Account updates. This route will update an existing user's account settings. The default accepted params are **password** and **password_confirmation** |
| /api/v1/auth/sign_in | POST | Email authentication. Requires **email** and **password** as params. This route will return a JSON representation of the `User` model on successful login along with the `access-token` and `client` in the header of the response. |
| /api/v1/auth/sign_out | DELETE | Use this route to end the user's current session. This route will invalidate the user's authentication token. You must pass in **uid**, **client**, and **access-token** in the request headers. |
| /api/v1/auth/validate_token | GET | Use this route to validate tokens on return visits to the client. Requires **uid**, **client**, and **access-token** as params. These values should correspond to the columns in your `User` table of the same names. |
| /api/v1/auth/password | PUT | Use this route to change users' passwords. Requires **password** and **password_confirmation** as params. |
| /api/v1/auth/password/edit | GET | Verify user by password reset token. This route is the destination URL for password reset confirmation. This route must contain **reset_password_token** and **redirect_url** params. These values will be set automatically by the confirmation email that is generated by the password reset request. |
| /api/v1/templates | GET | Get the full catalog of cards template that Card Mine provides. |
| /api/v1/cards/ | GET | Get all of the signed in user's card. |
| /api/v1/cards/ | POST | Create a new card for the currently signed in user. |
| /api/v1/cards/:id | GET | Get a specific card of the signed in user. |
| /api/v1/cards/:id | PUT | Update a specific card of the signed in user. |
| /api/v1/cards/:id | DELETE | Destroys the specified card record along with its related textual content records. |
| /api/v1/cards/:card_id/textual_content | GET | Returns all the texts associated with a specific card with all relative information of the textual content. |
| /api/v1/cards/:card_id/textual_content | POST | Create a new textual content for the specified card. |
| /api/v1/cards/:card_id/textual_content/:id | GET | Return the textual content record with the provided id parameter. |
| /api/v1/cards/:card_id/textual_content/:id | PUT | Updates the textual content record with the provided id parameter. |
| /api/v1/cards/:card_id/textual_content/:id | DELETE | Destroys the textual content record with the provided id parameter. |
A the complete documentation will be provided soon.
## Live
Card Mine API version can be consumed online via heroku: [http://cardmine.herokuapp.com/](http://cardmine.herokuapp.com/).
For example, the following snippet gets the catalog of existing card templates in json form:
```sh
curl -X GET http://cardmine.herokuapp.com/api/v1/templates
```
## Security
Access to all API resources (except static content) is restricted to request with valid token that adheres to [HTTP Token Authentication](http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token/ControllerMethods.html).
## iOS Client App
Refer to this [repo](https://github.com/abarrak/card-mine) to review the app code and related files.
## TODO
1. ~~Add throttling and clients access keys.~~
2. Document the API extensively.