Project

coin_rack

0.0
No commit activity in last 3 years
No release in over 3 years
A Simple Rack application that provides a REST interface for Coin.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Lines of Code Code Status Dependency Status Build Status Coverage Status Downloads

CoinRack

A simple Rack application that provides a REST interface to Coin's API.

Quick Start

Run the server

$ gem install coin_rack
$ coin_rack --run

Make some client requests

$ 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?

$ curl --data "value=true" http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <example type="boolean">true</example>
</hash>

$ curl http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <example type="boolean">true</example>
</hash>

$ curl -X DELETE http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <example type="boolean">true</example>
</hash>

$ curl http://localhost:9292/example.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <example nil="true"/>
</hash>

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