Skip to content

Commit 9815700

Browse files
AlbertMNdnorhoj
authored andcommitted
Testing includes
With "kitten" example
1 parent ca93011 commit 9815700

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed

source/includes/_printers.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Kittens
2+
3+
## Get All Kittens
4+
5+
```ruby
6+
require 'kittn'
7+
8+
api = Kittn::APIClient.authorize!('meowmeowmeow')
9+
api.kittens.get
10+
```
11+
12+
```python
13+
import kittn
14+
15+
api = kittn.authorize('meowmeowmeow')
16+
api.kittens.get()
17+
```
18+
19+
```shell
20+
curl "http://example.com/api/kittens" \
21+
-H "Authorization: meowmeowmeow"
22+
```
23+
24+
```javascript
25+
const kittn = require('kittn');
26+
27+
let api = kittn.authorize('meowmeowmeow');
28+
let kittens = api.kittens.get();
29+
```
30+
31+
> The above command returns JSON structured like this:
32+
33+
```json
34+
[
35+
{
36+
"id": 1,
37+
"name": "Fluffums",
38+
"breed": "calico",
39+
"fluffiness": 6,
40+
"cuteness": 7
41+
},
42+
{
43+
"id": 2,
44+
"name": "Max",
45+
"breed": "unknown",
46+
"fluffiness": 5,
47+
"cuteness": 10
48+
}
49+
]
50+
```
51+
52+
This endpoint retrieves all kittens.
53+
54+
### HTTP Request
55+
56+
`GET http://example.com/api/kittens`
57+
58+
### Query Parameters
59+
60+
Parameter | Default | Description
61+
--------- | ------- | -----------
62+
include_cats | false | If set to true, the result will also include cats.
63+
available | true | If set to false, the result will include kittens that have already been adopted.
64+
65+
<aside class="success">
66+
Remember — a happy kitten is an authenticated kitten!
67+
</aside>
68+
69+
## Get a Specific Kitten
70+
71+
```ruby
72+
require 'kittn'
73+
74+
api = Kittn::APIClient.authorize!('meowmeowmeow')
75+
api.kittens.get(2)
76+
```
77+
78+
```python
79+
import kittn
80+
81+
api = kittn.authorize('meowmeowmeow')
82+
api.kittens.get(2)
83+
```
84+
85+
```shell
86+
curl "http://example.com/api/kittens/2" \
87+
-H "Authorization: meowmeowmeow"
88+
```
89+
90+
```javascript
91+
const kittn = require('kittn');
92+
93+
let api = kittn.authorize('meowmeowmeow');
94+
let max = api.kittens.get(2);
95+
```
96+
97+
> The above command returns JSON structured like this:
98+
99+
```json
100+
{
101+
"id": 2,
102+
"name": "Max",
103+
"breed": "unknown",
104+
"fluffiness": 5,
105+
"cuteness": 10
106+
}
107+
```
108+
109+
This endpoint retrieves a specific kitten.
110+
111+
<aside class="warning">Inside HTML code blocks like this one, you can't use Markdown, so use <code>&lt;code&gt;</code> blocks to denote code.</aside>
112+
113+
### HTTP Request
114+
115+
`GET http://example.com/kittens/<ID>`
116+
117+
### URL Parameters
118+
119+
Parameter | Description
120+
--------- | -----------
121+
ID | The ID of the kitten to retrieve
122+
123+
## Delete a Specific Kitten
124+
125+
```ruby
126+
require 'kittn'
127+
128+
api = Kittn::APIClient.authorize!('meowmeowmeow')
129+
api.kittens.delete(2)
130+
```
131+
132+
```python
133+
import kittn
134+
135+
api = kittn.authorize('meowmeowmeow')
136+
api.kittens.delete(2)
137+
```
138+
139+
```shell
140+
curl "http://example.com/api/kittens/2" \
141+
-X DELETE \
142+
-H "Authorization: meowmeowmeow"
143+
```
144+
145+
```javascript
146+
const kittn = require('kittn');
147+
148+
let api = kittn.authorize('meowmeowmeow');
149+
let max = api.kittens.delete(2);
150+
```
151+
152+
> The above command returns JSON structured like this:
153+
154+
```json
155+
{
156+
"id": 2,
157+
"deleted" : ":("
158+
}
159+
```
160+
161+
This endpoint deletes a specific kitten.
162+
163+
### HTTP Request
164+
165+
`DELETE http://example.com/kittens/<ID>`
166+
167+
### URL Parameters
168+
169+
Parameter | Description
170+
--------- | -----------
171+
ID | The ID of the kitten to delete

0 commit comments

Comments
 (0)