Add descriptions to fields

This commit is contained in:
Martin Lensment 2015-04-01 13:52:35 +03:00
parent 42001c4601
commit 28d0cfd4df
5 changed files with 32 additions and 31 deletions

View file

@ -5,9 +5,9 @@ module Repp
resource :contacts do
desc 'Return list of contact'
params do
optional :limit, type: Integer, values: (1..20).to_a
optional :offset, type: Integer
optional :details, type: String, values: %w(true false)
optional :limit, type: Integer, values: (1..20).to_a, desc: 'How many contacts to show'
optional :offset, type: Integer, desc: 'Contact number to start at'
optional :details, type: String, values: %w(true false), desc: 'Whether to include details'
end
get '/' do

View file

@ -5,9 +5,9 @@ module Repp
resource :domains do
desc 'Return list of domains'
params do
optional :limit, type: Integer, values: (1..20).to_a
optional :offset, type: Integer
optional :details, type: String, values: %w(true false)
optional :limit, type: Integer, values: (1..20).to_a, desc: 'How many domains to show'
optional :offset, type: Integer, desc: 'Domain number to start at'
optional :details, type: String, values: %w(true false), desc: 'Whether to include details'
end
get '/' do

View file

@ -4,11 +4,11 @@ Returns contacts of the current registrar.
#### Parameters
| Field name | Required | Type | Allowed values |
| ---------- | -------- | ---- | -------------- |
| limit | false | Integer | [1..20] |
| offset | false | Integer | |
| details | false | String | ["true", "false"] |
| Field name | Required | Type | Allowed values | Description |
| ---------- | -------- | ---- | -------------- | ----------- |
| limit | false | Integer | [1..20] | How many contacts to show |
| offset | false | Integer | | Contact number to start at |
| details | false | String | ["true", "false"] | Whether to include details |
#### Request
```
@ -23,26 +23,26 @@ Content-Type: application/json
```
HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 586
Content-Length: 573
Content-Type: application/json
{
"contacts": [
{
"id": 1,
"code": "sh651514820",
"code": "sh095058820",
"reg_no": null,
"phone": "+372.12345678",
"email": "giles_altenwerth@oberbrunnerbrakus.com",
"email": "shakira.reichert@corkery.com",
"fax": null,
"created_at": "2015-04-01T10:45:28.045Z",
"updated_at": "2015-04-01T10:45:28.045Z",
"created_at": "2015-04-01T10:51:49.854Z",
"updated_at": "2015-04-01T10:51:49.854Z",
"ident": "37605030299",
"ident_type": "priv",
"created_by_id": null,
"updated_by_id": null,
"auth_info": "password",
"name": "Ms. Lucienne Olson0",
"name": "Henderson Feest0",
"org_name": null,
"registrar_id": 1,
"creator_str": "autotest",
@ -81,7 +81,7 @@ Content-Type: application/json
{
"contacts": [
"sh371827431"
"sh331036241"
],
"total_number_of_records": 2
}

View file

@ -4,11 +4,11 @@ Returns domains of the current registrar.
#### Parameters
| Field name | Required | Type | Allowed values |
| ---------- | -------- | ---- | -------------- |
| limit | false | Integer | [1..20] |
| offset | false | Integer | |
| details | false | String | ["true", "false"] |
| Field name | Required | Type | Allowed values | Description |
| ---------- | -------- | ---- | -------------- | ----------- |
| limit | false | Integer | [1..20] | How many domains to show |
| offset | false | Integer | | Domain number to start at |
| details | false | String | ["true", "false"] | Whether to include details |
#### Request
```
@ -32,21 +32,21 @@ Content-Type: application/json
"id": 1,
"name": "domain0.ee",
"registrar_id": 1,
"registered_at": "2015-04-01T10:45:28.858Z",
"registered_at": "2015-04-01T10:51:53.445Z",
"status": null,
"valid_from": "2015-04-01T00:00:00.000Z",
"valid_to": "2016-04-01T00:00:00.000Z",
"owner_contact_id": 1,
"auth_info": "81d71922080506c636030ff5634823ba",
"created_at": "2015-04-01T10:45:28.854Z",
"updated_at": "2015-04-01T10:45:28.850Z",
"auth_info": "15d4b95d0611312ee96e63e48fcab2de",
"created_at": "2015-04-01T10:51:53.439Z",
"updated_at": "2015-04-01T10:51:53.432Z",
"name_dirty": "domain0.ee",
"name_puny": "domain0.ee",
"period": 1,
"period_unit": "y",
"creator_str": null,
"updator_str": null,
"whois_body": " This Whois Server contains information on\n Estonian Top Level Domain ee TLD\n\n domain: domain0.ee\n registrar: registrar1\n status:\n registered: \n changed: 2015-04-01 10:45:28\n expire:\n outzone:\n delete:\n\n \n\n nsset:\n nserver:\n\n registrar: registrar1\n phone: \n address: Street 111, Town, County, Postal\n created: 2015-04-01 10:45:28\n changed: 2015-04-01 10:45:28\n"
"whois_body": " This Whois Server contains information on\n Estonian Top Level Domain ee TLD\n\n domain: domain0.ee\n registrar: registrar1\n status:\n registered: \n changed: 2015-04-01 10:51:53\n expire:\n outzone:\n delete:\n\n \n\n nsset:\n nserver:\n\n registrar: registrar1\n phone: \n address: Street 111, Town, County, Postal\n created: 2015-04-01 10:51:53\n changed: 2015-04-01 10:51:53\n"
}
],
"total_number_of_records": 2

View file

@ -39,8 +39,8 @@ module Autodoc
return unless route.route_params.is_a?(Hash)
rows = [
"| Field name | Required | Type | Allowed values |",
"| ---------- | -------- | ---- | -------------- |"
"| Field name | Required | Type | Allowed values | Description |",
"| ---------- | -------- | ---- | -------------- | ----------- |"
]
route.route_params.each do |name, desc|
@ -48,7 +48,8 @@ module Autodoc
details << "| #{name} "
details << "| #{desc[:required]} "
details << "| #{desc[:type]} "
details << "| #{ranges_from_array(desc[:values])} |"
details << "| #{ranges_from_array(desc[:values])} "
details << "| #{desc[:desc]} |"
rows << details.join
end