examples/store-api-tests/api.md in restspec-0.1 vs examples/store-api-tests/api.md in restspec-0.2

- old
+ new

@@ -3,142 +3,187 @@ ## Products ### Create [POST /products] -Returns schema **product** +#### Payload +The payload is an instance of the **product** schema. -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| created_at | date_time | 2014-12-08T22:35:55-05:00 | -| updated_at | date_time | 2014-12-02T07:52:23-05:00 | -| name | string | doloremque | -| code | string | voluptatem | -| price | decimal | 61.76 | -| category_id | schema_id | 51 | -| category | embedded_schema | {:name=>"deserunt"} | + ```json + { + "name": "consequatur", + "code": "corporis", + "price": 86.56, + "category_id": "5" + } + ``` + + +#### Response + Returns schema **product** + + + ```json + { + "created_at": "2014-12-08T20:04:00-05:00", + "updated_at": "2014-12-02T21:02:47-05:00", + "name": "ut", + "code": "nobis", + "price": 13.52, + "category_id": "1", + "category": { + "name": "delectus" + } + } + ``` + ### Index [GET /products] -Returns schema **product** +#### Response + Returns schema **product** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| created_at | date_time | 2014-11-27T10:18:05-05:00 | -| updated_at | date_time | 2014-11-25T14:47:53-05:00 | -| name | string | quaerat | -| code | string | et | -| price | decimal | 70.28 | -| category_id | schema_id | 51 | -| category | embedded_schema | {:name=>"rerum"} | + ```json + { + "created_at": "2014-12-27T12:23:04-05:00", + "updated_at": "2014-12-04T23:20:43-05:00", + "name": "voluptatem", + "code": "facilis", + "price": 41.47, + "category_id": "8" + } + ``` + ### Show [GET /products/:id] -Returns schema **product** +#### Response + Returns schema **product** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| created_at | date_time | 2014-12-05T13:39:27-05:00 | -| updated_at | date_time | 2014-12-23T13:04:47-05:00 | -| name | string | sed | -| code | string | quam | -| price | decimal | 81.56 | -| category_id | schema_id | 51 | -| category | embedded_schema | {:name=>"commodi"} | + ```json + { + "created_at": "2014-11-28T20:21:40-05:00", + "updated_at": "2014-12-28T08:10:27-05:00", + "name": "quasi", + "code": "rerum", + "price": 39.48, + "category_id": "0", + "category": { + "name": "saepe" + } + } + ``` + ### Update [PUT /products/:id] -Returns schema **product** +#### Response + Returns schema **product** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| created_at | date_time | 2014-12-11T19:55:48-05:00 | -| updated_at | date_time | 2014-12-01T18:33:17-05:00 | -| name | string | possimus | -| code | string | omnis | -| price | decimal | 13.37 | -| category_id | schema_id | 51 | -| category | embedded_schema | {:name=>"tempora"} | + ```json + { + "created_at": "2014-12-27T02:32:32-05:00", + "updated_at": "2014-12-05T22:31:32-05:00", + "name": "iure", + "code": "autem", + "price": 47.17, + "category_id": "1", + "category": { + "name": "ut" + } + } + ``` + ### Destroy [DELETE /products/:id] -Returns schema **product** +#### Response + The response is empty. -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| created_at | date_time | 2014-12-17T17:29:46-05:00 | -| updated_at | date_time | 2014-12-22T08:20:22-05:00 | -| name | string | quos | -| code | string | aut | -| price | decimal | 32.84 | -| category_id | schema_id | 51 | -| category | embedded_schema | {:name=>"saepe"} | - ## Categories ### Create [POST /categories] -Returns schema **category** +#### Response + Returns schema **category** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| name | string | nam | + ```json + { + "name": "quaerat" + } + ``` + ### Index [GET /categories] -Returns schema **category** +#### Response + Returns schema **category** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| name | string | ut | + ```json + { + "name": "amet" + } + ``` + ### Show [GET /categories/:id] -Returns schema **category** +#### Response + Returns schema **category** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| name | string | tempore | + ```json + { + "name": "consequatur" + } + ``` + ### Update [PUT /categories/:id] -Returns schema **category** +#### Response + Returns schema **category** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| name | string | vel | + ```json + { + "name": "voluptatem" + } + ``` + ### Destroy [DELETE /categories/:id] -Returns schema **category** +#### Response + The response is empty. -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| name | string | rerum | - ### Products [GET /categories/:id/products] -Returns schema **product** +#### Response + Returns schema **product** -| Attribute | Type | Example | -|-------------|:--------------------------:|---------------:| -| created_at | date_time | 2014-12-23T23:47:07-05:00 | -| updated_at | date_time | 2014-11-29T07:40:59-05:00 | -| name | string | corrupti | -| code | string | aut | -| price | decimal | 03.80 | -| category_id | schema_id | 51 | -| category | embedded_schema | {:name=>"qui"} | + + ```json + { + "created_at": "2014-12-13T00:42:13-05:00", + "updated_at": "2014-12-12T18:31:59-05:00", + "name": "labore", + "code": "exercitationem", + "price": 15.84, + "category_id": "0", + "category": { + "name": "incidunt" + } + } + ```