https://github.com/hopsoft/coin_rack
A REST API for Coin
https://github.com/hopsoft/coin_rack
Last synced: 6 months ago
JSON representation
A REST API for Coin
- Host: GitHub
- URL: https://github.com/hopsoft/coin_rack
- Owner: hopsoft
- License: mit
- Created: 2012-12-01T08:06:35.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-12-06T17:20:29.000Z (almost 11 years ago)
- Last Synced: 2025-04-24T05:18:24.328Z (6 months ago)
- Language: Ruby
- Size: 223 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/)
[](https://codeclimate.com/github/hopsoft/coin_rack)
[](https://gemnasium.com/hopsoft/coin_rack)
[](https://travis-ci.org/hopsoft/coin_rack)
[](https://coveralls.io/r/hopsoft/coin_rack?branch=master)
[](http://rubygems.org/gems/coin_rack)# CoinRack
A simple [Rack](http://rack.github.com/) application that provides a
REST interface to [Coin's API](https://github.com/hopsoft/coin).## Quick Start
### Run the server
```bash
$ gem install coin_rack
$ coin_rack --run
```### Make some client requests
```bash
$ curl --data "value=true" http://localhost:9292/example.json
{"example":true}$ curl http://localhost:9292/example.json
{"example":true}$ curl -X DELETE http://localhost:9292/example.json
{"example":true}$ curl http://localhost:9292/example.json
{"example":null}
```#### Prefer XML?
```bash
$ curl --data "value=true" http://localhost:9292/example.xmltrue
$ curl http://localhost:9292/example.xml
true
$ curl -X DELETE http://localhost:9292/example.xml
true
$ curl http://localhost:9292/example.xml
```
## URL Definition
```
cache key
|
http://localhost:9292/KEY.FORMAT
|
response format
```*Note: The XML format is also supported but XML examples have been omitted for brevity.*
## POST/PUT
Create and/or update the key to a new value.
#### Params
* **value** - the value to assign
#### Request URI
```
http://localhost:9292/example.json
```#### Request Body
```
value=true
```#### Response
```
"{\"example\":\"true\"}"
```## GET
Get the current value for the specified key.
#### Request URI
```
http://localhost:9292/example.json
```#### Response
```
"{\"example\":\"true\"}"
```## DELETE
Deletes the key.
#### Request URI
```
http://localhost:9292/example.json
```#### Response
Note the value returned is the value that was deleted.
```
"{\"example\":true}"
```## Getting Serious
* [Running behind robust web servers](https://github.com/hopsoft/coin_rack/wiki/Running-behind-robust-web-servers)