reqcord 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/CHANGELOG.md +77 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +171 -0
- data/LICENSE.txt +21 -0
- data/README.md +239 -95
- data/Rakefile +13 -0
- data/docs/configuration.md +319 -0
- data/examples/complex-spec-app/.rspec +1 -0
- data/examples/complex-spec-app/README.md +21 -0
- data/examples/complex-spec-app/app.rb +363 -0
- data/examples/complex-spec-app/docs/api/README.md +104 -0
- data/examples/complex-spec-app/docs/api/api/v1/admin/products/create.md +117 -0
- data/examples/complex-spec-app/docs/api/api/v1/admin/products/destroy.md +51 -0
- data/examples/complex-spec-app/docs/api/api/v1/admin/products/index.md +11 -0
- data/examples/complex-spec-app/docs/api/api/v1/admin/products/list.md +106 -0
- data/examples/complex-spec-app/docs/api/api/v1/auth/index.md +9 -0
- data/examples/complex-spec-app/docs/api/api/v1/auth/login.md +76 -0
- data/examples/complex-spec-app/docs/api/api/v1/cart-items/create.md +91 -0
- data/examples/complex-spec-app/docs/api/api/v1/cart-items/destroy.md +51 -0
- data/examples/complex-spec-app/docs/api/api/v1/cart-items/index.md +10 -0
- data/examples/complex-spec-app/docs/api/api/v1/carts/checkout.md +102 -0
- data/examples/complex-spec-app/docs/api/api/v1/carts/index.md +10 -0
- data/examples/complex-spec-app/docs/api/api/v1/carts/show.md +73 -0
- data/examples/complex-spec-app/docs/api/api/v1/home/index.md +9 -0
- data/examples/complex-spec-app/docs/api/api/v1/home/list.md +47 -0
- data/examples/complex-spec-app/docs/api/api/v1/notes/create.md +94 -0
- data/examples/complex-spec-app/docs/api/api/v1/notes/index.md +10 -0
- data/examples/complex-spec-app/docs/api/api/v1/notes/list.md +61 -0
- data/examples/complex-spec-app/docs/api/api/v1/orders/cancel.md +69 -0
- data/examples/complex-spec-app/docs/api/api/v1/orders/create.md +150 -0
- data/examples/complex-spec-app/docs/api/api/v1/orders/destroy.md +37 -0
- data/examples/complex-spec-app/docs/api/api/v1/orders/index.md +13 -0
- data/examples/complex-spec-app/docs/api/api/v1/orders/list.md +78 -0
- data/examples/complex-spec-app/docs/api/api/v1/orders/show.md +83 -0
- data/examples/complex-spec-app/docs/api/api/v1/products/index.md +11 -0
- data/examples/complex-spec-app/docs/api/api/v1/products/list.md +83 -0
- data/examples/complex-spec-app/docs/api/api/v1/products/search.md +88 -0
- data/examples/complex-spec-app/docs/api/api/v1/products/show.md +71 -0
- data/examples/complex-spec-app/docs/api/api/v1/profiles/index.md +10 -0
- data/examples/complex-spec-app/docs/api/api/v1/profiles/show.md +61 -0
- data/examples/complex-spec-app/docs/api/api/v1/profiles/update.md +91 -0
- data/examples/complex-spec-app/docs/api/api/v2/products/index.md +9 -0
- data/examples/complex-spec-app/docs/api/api/v2/products/list.md +77 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/admin/products/create.sh +18 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/admin/products/destroy.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/admin/products/list.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/auth/login.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/cart-items/create.sh +16 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/cart-items/destroy.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/carts/checkout.sh +13 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/carts/show.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/home/list.sh +8 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/notes/create.sh +15 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/notes/list.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/orders/cancel.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/orders/create.sh +29 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/orders/destroy.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/orders/list.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/orders/show.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/products/list.sh +8 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/products/search.sh +8 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/products/show.sh +8 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/profiles/show.sh +9 -0
- data/examples/complex-spec-app/docs/api/curl/api/v1/profiles/update.sh +16 -0
- data/examples/complex-spec-app/docs/api/curl/api/v2/products/list.sh +8 -0
- data/examples/complex-spec-app/docs/api/dataset.json +5116 -0
- data/examples/complex-spec-app/docs/api/postman/collection.json +2519 -0
- data/examples/complex-spec-app/generate.rb +14 -0
- data/examples/complex-spec-app/reqcord.yml +28 -0
- data/examples/complex-spec-app/spec/requests/admin_spec.rb +67 -0
- data/examples/complex-spec-app/spec/requests/cart_spec.rb +61 -0
- data/examples/complex-spec-app/spec/requests/home_and_auth_spec.rb +49 -0
- data/examples/complex-spec-app/spec/requests/orders_spec.rb +124 -0
- data/examples/complex-spec-app/spec/requests/products_spec.rb +65 -0
- data/examples/complex-spec-app/spec/spec_helper.rb +17 -0
- data/examples/complex-test-app/README.md +40 -0
- data/examples/complex-test-app/app.rb +384 -0
- data/examples/complex-test-app/docs/api/README.md +104 -0
- data/examples/complex-test-app/docs/api/api/v1/admin/products/create.md +117 -0
- data/examples/complex-test-app/docs/api/api/v1/admin/products/destroy.md +51 -0
- data/examples/complex-test-app/docs/api/api/v1/admin/products/index.md +11 -0
- data/examples/complex-test-app/docs/api/api/v1/admin/products/list.md +106 -0
- data/examples/complex-test-app/docs/api/api/v1/auth/index.md +9 -0
- data/examples/complex-test-app/docs/api/api/v1/auth/login.md +76 -0
- data/examples/complex-test-app/docs/api/api/v1/cart-items/create.md +91 -0
- data/examples/complex-test-app/docs/api/api/v1/cart-items/destroy.md +51 -0
- data/examples/complex-test-app/docs/api/api/v1/cart-items/index.md +10 -0
- data/examples/complex-test-app/docs/api/api/v1/carts/checkout.md +102 -0
- data/examples/complex-test-app/docs/api/api/v1/carts/index.md +10 -0
- data/examples/complex-test-app/docs/api/api/v1/carts/show.md +73 -0
- data/examples/complex-test-app/docs/api/api/v1/home/index.md +9 -0
- data/examples/complex-test-app/docs/api/api/v1/home/list.md +47 -0
- data/examples/complex-test-app/docs/api/api/v1/notes/create.md +94 -0
- data/examples/complex-test-app/docs/api/api/v1/notes/index.md +10 -0
- data/examples/complex-test-app/docs/api/api/v1/notes/list.md +61 -0
- data/examples/complex-test-app/docs/api/api/v1/orders/cancel.md +69 -0
- data/examples/complex-test-app/docs/api/api/v1/orders/create.md +150 -0
- data/examples/complex-test-app/docs/api/api/v1/orders/destroy.md +37 -0
- data/examples/complex-test-app/docs/api/api/v1/orders/index.md +13 -0
- data/examples/complex-test-app/docs/api/api/v1/orders/list.md +71 -0
- data/examples/complex-test-app/docs/api/api/v1/orders/show.md +83 -0
- data/examples/complex-test-app/docs/api/api/v1/products/index.md +11 -0
- data/examples/complex-test-app/docs/api/api/v1/products/list.md +83 -0
- data/examples/complex-test-app/docs/api/api/v1/products/search.md +88 -0
- data/examples/complex-test-app/docs/api/api/v1/products/show.md +71 -0
- data/examples/complex-test-app/docs/api/api/v1/profiles/index.md +10 -0
- data/examples/complex-test-app/docs/api/api/v1/profiles/show.md +61 -0
- data/examples/complex-test-app/docs/api/api/v1/profiles/update.md +91 -0
- data/examples/complex-test-app/docs/api/api/v2/products/index.md +9 -0
- data/examples/complex-test-app/docs/api/api/v2/products/list.md +77 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/admin/products/create.sh +18 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/admin/products/destroy.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/admin/products/list.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/auth/login.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/cart-items/create.sh +16 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/cart-items/destroy.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/carts/checkout.sh +13 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/carts/show.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/home/list.sh +8 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/notes/create.sh +15 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/notes/list.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/orders/cancel.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/orders/create.sh +29 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/orders/destroy.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/orders/list.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/orders/show.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/products/list.sh +8 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/products/search.sh +8 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/products/show.sh +8 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/profiles/show.sh +9 -0
- data/examples/complex-test-app/docs/api/curl/api/v1/profiles/update.sh +16 -0
- data/examples/complex-test-app/docs/api/curl/api/v2/products/list.sh +8 -0
- data/examples/complex-test-app/docs/api/dataset.json +5109 -0
- data/examples/complex-test-app/docs/api/postman/collection.json +2568 -0
- data/examples/complex-test-app/generate.rb +14 -0
- data/examples/complex-test-app/reqcord.yml +28 -0
- data/examples/complex-test-app/test/integration/admin_test.rb +70 -0
- data/examples/complex-test-app/test/integration/cart_test.rb +64 -0
- data/examples/complex-test-app/test/integration/home_and_auth_test.rb +53 -0
- data/examples/complex-test-app/test/integration/orders_test.rb +127 -0
- data/examples/complex-test-app/test/integration/products_test.rb +66 -0
- data/examples/reqcord.yml +58 -0
- data/examples/spec-app/.rspec +1 -0
- data/examples/spec-app/README.md +36 -0
- data/examples/spec-app/app.rb +209 -0
- data/examples/spec-app/docs/api/README.md +45 -0
- data/examples/spec-app/docs/api/api/v1/customers/create.md +95 -0
- data/examples/spec-app/docs/api/api/v1/customers/index.md +11 -0
- data/examples/spec-app/docs/api/api/v1/customers/list.md +67 -0
- data/examples/spec-app/docs/api/api/v1/customers/show.md +65 -0
- data/examples/spec-app/docs/api/api/v1/tasks/complete.md +51 -0
- data/examples/spec-app/docs/api/api/v1/tasks/create.md +90 -0
- data/examples/spec-app/docs/api/api/v1/tasks/destroy.md +35 -0
- data/examples/spec-app/docs/api/api/v1/tasks/index.md +14 -0
- data/examples/spec-app/docs/api/api/v1/tasks/list.md +65 -0
- data/examples/spec-app/docs/api/api/v1/tasks/show.md +65 -0
- data/examples/spec-app/docs/api/api/v1/tasks/update.md +74 -0
- data/examples/spec-app/docs/api/api/v1/users/create.md +95 -0
- data/examples/spec-app/docs/api/api/v1/users/index.md +11 -0
- data/examples/spec-app/docs/api/api/v1/users/list.md +67 -0
- data/examples/spec-app/docs/api/api/v1/users/show.md +65 -0
- data/examples/spec-app/docs/api/curl/api/v1/customers/create.sh +17 -0
- data/examples/spec-app/docs/api/curl/api/v1/customers/list.sh +9 -0
- data/examples/spec-app/docs/api/curl/api/v1/customers/show.sh +9 -0
- data/examples/spec-app/docs/api/curl/api/v1/tasks/complete.sh +8 -0
- data/examples/spec-app/docs/api/curl/api/v1/tasks/create.sh +15 -0
- data/examples/spec-app/docs/api/curl/api/v1/tasks/destroy.sh +8 -0
- data/examples/spec-app/docs/api/curl/api/v1/tasks/list.sh +8 -0
- data/examples/spec-app/docs/api/curl/api/v1/tasks/show.sh +8 -0
- data/examples/spec-app/docs/api/curl/api/v1/tasks/update.sh +14 -0
- data/examples/spec-app/docs/api/curl/api/v1/users/create.sh +17 -0
- data/examples/spec-app/docs/api/curl/api/v1/users/list.sh +9 -0
- data/examples/spec-app/docs/api/curl/api/v1/users/show.sh +9 -0
- data/examples/spec-app/docs/api/dataset.json +2402 -0
- data/examples/spec-app/docs/api/postman/collection.json +1290 -0
- data/examples/spec-app/generate.rb +14 -0
- data/examples/spec-app/reqcord.yml +27 -0
- data/examples/spec-app/spec/requests/customers_spec.rb +71 -0
- data/examples/spec-app/spec/requests/tasks_spec.rb +78 -0
- data/examples/spec-app/spec/requests/users_spec.rb +68 -0
- data/examples/spec-app/spec/spec_helper.rb +17 -0
- data/examples/test-app/README.md +57 -0
- data/examples/test-app/app.rb +212 -0
- data/examples/test-app/docs/api/README.md +45 -0
- data/examples/test-app/docs/api/api/v1/customers/create.md +95 -0
- data/examples/test-app/docs/api/api/v1/customers/index.md +11 -0
- data/examples/test-app/docs/api/api/v1/customers/list.md +67 -0
- data/examples/test-app/docs/api/api/v1/customers/show.md +65 -0
- data/examples/test-app/docs/api/api/v1/tasks/complete.md +51 -0
- data/examples/test-app/docs/api/api/v1/tasks/create.md +90 -0
- data/examples/test-app/docs/api/api/v1/tasks/destroy.md +35 -0
- data/examples/test-app/docs/api/api/v1/tasks/index.md +14 -0
- data/examples/test-app/docs/api/api/v1/tasks/list.md +65 -0
- data/examples/test-app/docs/api/api/v1/tasks/show.md +65 -0
- data/examples/test-app/docs/api/api/v1/tasks/update.md +74 -0
- data/examples/test-app/docs/api/api/v1/users/create.md +95 -0
- data/examples/test-app/docs/api/api/v1/users/index.md +11 -0
- data/examples/test-app/docs/api/api/v1/users/list.md +67 -0
- data/examples/test-app/docs/api/api/v1/users/show.md +65 -0
- data/examples/test-app/docs/api/curl/api/v1/customers/create.sh +17 -0
- data/examples/test-app/docs/api/curl/api/v1/customers/list.sh +9 -0
- data/examples/test-app/docs/api/curl/api/v1/customers/show.sh +9 -0
- data/examples/test-app/docs/api/curl/api/v1/tasks/complete.sh +8 -0
- data/examples/test-app/docs/api/curl/api/v1/tasks/create.sh +15 -0
- data/examples/test-app/docs/api/curl/api/v1/tasks/destroy.sh +8 -0
- data/examples/test-app/docs/api/curl/api/v1/tasks/list.sh +8 -0
- data/examples/test-app/docs/api/curl/api/v1/tasks/show.sh +8 -0
- data/examples/test-app/docs/api/curl/api/v1/tasks/update.sh +14 -0
- data/examples/test-app/docs/api/curl/api/v1/users/create.sh +17 -0
- data/examples/test-app/docs/api/curl/api/v1/users/list.sh +9 -0
- data/examples/test-app/docs/api/curl/api/v1/users/show.sh +9 -0
- data/examples/test-app/docs/api/dataset.json +2402 -0
- data/examples/test-app/docs/api/postman/collection.json +1290 -0
- data/examples/test-app/generate.rb +14 -0
- data/examples/test-app/reqcord.yml +28 -0
- data/examples/test-app/test/integration/customers_test.rb +72 -0
- data/examples/test-app/test/integration/tasks_test.rb +80 -0
- data/examples/test-app/test/integration/users_test.rb +72 -0
- data/lib/reqcord/capture/collector.rb +31 -0
- data/lib/reqcord/capture/integration_patch.rb +209 -0
- data/lib/reqcord/capture/minitest_context.rb +34 -0
- data/lib/reqcord/capture/rspec_context.rb +42 -0
- data/lib/reqcord/capture/test_context.rb +25 -0
- data/lib/reqcord/capture.rb +19 -0
- data/lib/reqcord/configuration.rb +198 -0
- data/lib/reqcord/dataset.rb +176 -0
- data/lib/reqcord/endpoint.rb +263 -0
- data/lib/reqcord/errors.rb +9 -0
- data/lib/reqcord/exporters/curl.rb +68 -0
- data/lib/reqcord/exporters/markdown.rb +295 -0
- data/lib/reqcord/exporters/postman.rb +206 -0
- data/lib/reqcord/exporters.rb +32 -0
- data/lib/reqcord/generator.rb +364 -0
- data/lib/reqcord/railtie.rb +51 -0
- data/lib/reqcord/renderers/curl.rb +56 -0
- data/lib/reqcord/renderers/payload.rb +69 -0
- data/lib/reqcord/request_example.rb +104 -0
- data/lib/reqcord/response_example.rb +72 -0
- data/lib/reqcord/route_collector.rb +242 -0
- data/lib/reqcord/sanitizers/sanitizer.rb +140 -0
- data/lib/reqcord/schema.rb +187 -0
- data/lib/reqcord/support.rb +58 -0
- data/lib/reqcord/version.rb +5 -0
- data/lib/reqcord.rb +78 -0
- data/lib/tasks/reqcord.rake +99 -0
- data/reqcord.gemspec +46 -0
- metadata +317 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# List Orders
|
|
2
|
+
|
|
3
|
+
`GET /api/v1/orders`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Authorization | `Bearer {{token}}` |
|
|
12
|
+
| Accept | `application/json` |
|
|
13
|
+
|
|
14
|
+
## Query Parameters
|
|
15
|
+
|
|
16
|
+
| Field | Type | Required | Values |
|
|
17
|
+
| --- | --- | --- | --- |
|
|
18
|
+
| `status` | string | no | `"pending"` \| `"shipped"` |
|
|
19
|
+
|
|
20
|
+
## cURL
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
curl --request GET \
|
|
24
|
+
--url "http://localhost:3000/api/v1/orders" \
|
|
25
|
+
--header "Authorization: Bearer {{token}}" \
|
|
26
|
+
--header "Accept: application/json"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Responses
|
|
30
|
+
|
|
31
|
+
### 200 OK
|
|
32
|
+
|
|
33
|
+
#### Fields
|
|
34
|
+
|
|
35
|
+
| Field | Type | Required | Values |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `[].id` | integer | yes | `2` |
|
|
38
|
+
| `[].user_id` | integer | yes | `1` |
|
|
39
|
+
| `[].status` | string | yes | `"pending"` \| `"shipped"` |
|
|
40
|
+
| `[].currency` | string | yes | `"USD"` |
|
|
41
|
+
| `[].total_cents` | integer | yes | `3200` |
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
"id": 1,
|
|
47
|
+
"user_id": 1,
|
|
48
|
+
"status": "pending",
|
|
49
|
+
"currency": "USD",
|
|
50
|
+
"total_cents": 2700
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": 2,
|
|
54
|
+
"user_id": 1,
|
|
55
|
+
"status": "shipped",
|
|
56
|
+
"currency": "USD",
|
|
57
|
+
"total_cents": 3200
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 401 Unauthorized
|
|
63
|
+
|
|
64
|
+
#### Fields
|
|
65
|
+
|
|
66
|
+
| Field | Type | Required | Values |
|
|
67
|
+
| --- | --- | --- | --- |
|
|
68
|
+
| `error` | string | yes | `"Unauthorized"` |
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"error": "Unauthorized"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
Resource: [Orders](index.md)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Get Order
|
|
2
|
+
|
|
3
|
+
`GET /api/v1/orders/:id`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Authorization | `Bearer {{token}}` |
|
|
12
|
+
| Accept | `application/json` |
|
|
13
|
+
|
|
14
|
+
## Path Parameters
|
|
15
|
+
|
|
16
|
+
| Field | Type | Required | Values |
|
|
17
|
+
| --- | --- | --- | --- |
|
|
18
|
+
| `id` | string | yes | `"1"` |
|
|
19
|
+
|
|
20
|
+
## cURL
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
curl --request GET \
|
|
24
|
+
--url "http://localhost:3000/api/v1/orders/1" \
|
|
25
|
+
--header "Authorization: Bearer {{token}}" \
|
|
26
|
+
--header "Accept: application/json"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Responses
|
|
30
|
+
|
|
31
|
+
### 200 OK
|
|
32
|
+
|
|
33
|
+
#### Fields
|
|
34
|
+
|
|
35
|
+
| Field | Type | Required | Values |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `id` | integer | yes | `1` |
|
|
38
|
+
| `user_id` | integer | yes | `1` |
|
|
39
|
+
| `status` | string | yes | `"pending"` |
|
|
40
|
+
| `currency` | string | yes | `"USD"` |
|
|
41
|
+
| `total_cents` | integer | yes | `2700` |
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"id": 1,
|
|
46
|
+
"user_id": 1,
|
|
47
|
+
"status": "pending",
|
|
48
|
+
"currency": "USD",
|
|
49
|
+
"total_cents": 2700
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 403 Forbidden
|
|
54
|
+
|
|
55
|
+
#### Fields
|
|
56
|
+
|
|
57
|
+
| Field | Type | Required | Values |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| `error` | string | yes | `"Forbidden"` |
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"error": "Forbidden"
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 404 Not Found
|
|
68
|
+
|
|
69
|
+
#### Fields
|
|
70
|
+
|
|
71
|
+
| Field | Type | Required | Values |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| `error` | string | yes | `"Not Found"` |
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"error": "Not Found"
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
Resource: [Orders](index.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Products
|
|
2
|
+
|
|
3
|
+
Namespace: `api/v1`
|
|
4
|
+
|
|
5
|
+
API version: `v1`
|
|
6
|
+
|
|
7
|
+
| Method | Path | Description |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `GET` | [`/api/v1/products`](list.md) | List Products |
|
|
10
|
+
| `GET` | [`/api/v1/products/:id`](show.md) | Get Product |
|
|
11
|
+
| `GET` | [`/api/v1/products/search`](search.md) | Search Products |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# List Products
|
|
2
|
+
|
|
3
|
+
`GET /api/v1/products`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Accept | `application/json` |
|
|
12
|
+
|
|
13
|
+
## Query Parameters
|
|
14
|
+
|
|
15
|
+
| Field | Type | Required | Values |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `filter.category` | string | no | `"mugs"` \| `"tea"` |
|
|
18
|
+
| `sort` | string | no | `"price_asc"` \| `"price_desc"` |
|
|
19
|
+
| `page` | integer | no | `2` |
|
|
20
|
+
| `per_page` | integer | no | `2` |
|
|
21
|
+
|
|
22
|
+
## cURL
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
curl --request GET \
|
|
26
|
+
--url "http://localhost:3000/api/v1/products" \
|
|
27
|
+
--header "Accept: application/json"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Responses
|
|
31
|
+
|
|
32
|
+
### 200 OK
|
|
33
|
+
|
|
34
|
+
#### Fields
|
|
35
|
+
|
|
36
|
+
| Field | Type | Required | Values |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `data[].id` | integer | yes | `2` |
|
|
39
|
+
| `data[].sku` | string | yes | `"TEA-002"` |
|
|
40
|
+
| `data[].name` | string | yes | `"Sencha"` |
|
|
41
|
+
| `data[].category` | string | yes | `"mugs"` \| `"tea"` |
|
|
42
|
+
| `data[].price_cents` | integer | yes | `1500` |
|
|
43
|
+
| `data[].tags[]` | string | yes | `"ceramic"` \| `"green"` \| `"insulated"` |
|
|
44
|
+
| `meta.page` | integer | yes | `1` |
|
|
45
|
+
| `meta.per_page` | integer | yes | `2` |
|
|
46
|
+
| `meta.total` | integer | yes | `4` |
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"data": [
|
|
51
|
+
{
|
|
52
|
+
"id": 1,
|
|
53
|
+
"sku": "TEA-001",
|
|
54
|
+
"name": "Earl Grey",
|
|
55
|
+
"category": "tea",
|
|
56
|
+
"price_cents": 1200,
|
|
57
|
+
"tags": [
|
|
58
|
+
"black",
|
|
59
|
+
"bergamot"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": 2,
|
|
64
|
+
"sku": "TEA-002",
|
|
65
|
+
"name": "Sencha",
|
|
66
|
+
"category": "tea",
|
|
67
|
+
"price_cents": 1500,
|
|
68
|
+
"tags": [
|
|
69
|
+
"green"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"meta": {
|
|
74
|
+
"page": 1,
|
|
75
|
+
"per_page": 2,
|
|
76
|
+
"total": 4
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
Resource: [Products](index.md)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Search Products
|
|
2
|
+
|
|
3
|
+
`GET /api/v1/products/search`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Accept | `application/json` |
|
|
12
|
+
|
|
13
|
+
## Query Parameters
|
|
14
|
+
|
|
15
|
+
| Field | Type | Required | Values |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `q` | string | yes | `"mug"` |
|
|
18
|
+
|
|
19
|
+
## cURL
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl --request GET \
|
|
23
|
+
--url "http://localhost:3000/api/v1/products/search?q=mug" \
|
|
24
|
+
--header "Accept: application/json"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Responses
|
|
28
|
+
|
|
29
|
+
### 200 OK
|
|
30
|
+
|
|
31
|
+
#### Fields
|
|
32
|
+
|
|
33
|
+
| Field | Type | Required | Values |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| `query` | string | yes | `"mug"` |
|
|
36
|
+
| `results[].id` | integer | yes | `4` |
|
|
37
|
+
| `results[].sku` | string | yes | `"MUG-002"` |
|
|
38
|
+
| `results[].name` | string | yes | `"Travel Mug"` |
|
|
39
|
+
| `results[].category` | string | yes | `"mugs"` |
|
|
40
|
+
| `results[].price_cents` | integer | yes | `3200` |
|
|
41
|
+
| `results[].tags[]` | string | yes | `"insulated"` |
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"query": "mug",
|
|
46
|
+
"results": [
|
|
47
|
+
{
|
|
48
|
+
"id": 3,
|
|
49
|
+
"sku": "MUG-001",
|
|
50
|
+
"name": "Stoneware Mug",
|
|
51
|
+
"category": "mugs",
|
|
52
|
+
"price_cents": 2400,
|
|
53
|
+
"tags": [
|
|
54
|
+
"ceramic"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": 4,
|
|
59
|
+
"sku": "MUG-002",
|
|
60
|
+
"name": "Travel Mug",
|
|
61
|
+
"category": "mugs",
|
|
62
|
+
"price_cents": 3200,
|
|
63
|
+
"tags": [
|
|
64
|
+
"steel",
|
|
65
|
+
"insulated"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 400 Bad Request
|
|
73
|
+
|
|
74
|
+
#### Fields
|
|
75
|
+
|
|
76
|
+
| Field | Type | Required | Values |
|
|
77
|
+
| --- | --- | --- | --- |
|
|
78
|
+
| `error` | string | yes | `"q is required"` |
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"error": "q is required"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
Resource: [Products](index.md)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Get Product
|
|
2
|
+
|
|
3
|
+
`GET /api/v1/products/:id`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Accept | `application/json` |
|
|
12
|
+
|
|
13
|
+
## Path Parameters
|
|
14
|
+
|
|
15
|
+
| Field | Type | Required | Values |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `id` | string | yes | `"3"` |
|
|
18
|
+
|
|
19
|
+
## cURL
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl --request GET \
|
|
23
|
+
--url "http://localhost:3000/api/v1/products/3" \
|
|
24
|
+
--header "Accept: application/json"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Responses
|
|
28
|
+
|
|
29
|
+
### 200 OK
|
|
30
|
+
|
|
31
|
+
#### Fields
|
|
32
|
+
|
|
33
|
+
| Field | Type | Required | Values |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| `id` | integer | yes | `3` |
|
|
36
|
+
| `sku` | string | yes | `"MUG-001"` |
|
|
37
|
+
| `name` | string | yes | `"Stoneware Mug"` |
|
|
38
|
+
| `category` | string | yes | `"mugs"` |
|
|
39
|
+
| `price_cents` | integer | yes | `2400` |
|
|
40
|
+
| `tags[]` | string | yes | `"ceramic"` |
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"id": 3,
|
|
45
|
+
"sku": "MUG-001",
|
|
46
|
+
"name": "Stoneware Mug",
|
|
47
|
+
"category": "mugs",
|
|
48
|
+
"price_cents": 2400,
|
|
49
|
+
"tags": [
|
|
50
|
+
"ceramic"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 404 Not Found
|
|
56
|
+
|
|
57
|
+
#### Fields
|
|
58
|
+
|
|
59
|
+
| Field | Type | Required | Values |
|
|
60
|
+
| --- | --- | --- | --- |
|
|
61
|
+
| `error` | string | yes | `"Not Found"` |
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"error": "Not Found"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Resource: [Products](index.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Get Profile
|
|
2
|
+
|
|
3
|
+
`GET /api/v1/profile`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Authorization | `Bearer {{token}}` |
|
|
12
|
+
| Accept | `application/json` |
|
|
13
|
+
|
|
14
|
+
## cURL
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
curl --request GET \
|
|
18
|
+
--url "http://localhost:3000/api/v1/profile" \
|
|
19
|
+
--header "Authorization: Bearer {{token}}" \
|
|
20
|
+
--header "Accept: application/json"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Responses
|
|
24
|
+
|
|
25
|
+
### 200 OK
|
|
26
|
+
|
|
27
|
+
#### Fields
|
|
28
|
+
|
|
29
|
+
| Field | Type | Required | Values |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| `id` | integer | yes | `1` |
|
|
32
|
+
| `name` | string | yes | `"Ada Lovelace"` |
|
|
33
|
+
| `email` | string | yes | `"ada@example.com"` |
|
|
34
|
+
| `locale` | string | yes | `"en"` |
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"id": 1,
|
|
39
|
+
"name": "Ada Lovelace",
|
|
40
|
+
"email": "ada@example.com",
|
|
41
|
+
"locale": "en"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 401 Unauthorized
|
|
46
|
+
|
|
47
|
+
#### Fields
|
|
48
|
+
|
|
49
|
+
| Field | Type | Required | Values |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| `error` | string | yes | `"Unauthorized"` |
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"error": "Unauthorized"
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
Resource: [Profiles](index.md)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Update Profile
|
|
2
|
+
|
|
3
|
+
`PATCH /api/v1/profile` (also `PUT`)
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v1`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Authorization | `Bearer {{token}}` |
|
|
12
|
+
| Content-Type | `application/json` |
|
|
13
|
+
| Accept | `application/json` |
|
|
14
|
+
|
|
15
|
+
## Body Parameters
|
|
16
|
+
|
|
17
|
+
| Field | Type | Required | Values |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| `profile.name` | string | yes | `"Ada L."` |
|
|
20
|
+
| `profile.locale` | string | yes | `"tr"` |
|
|
21
|
+
|
|
22
|
+
## Example Request
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"profile": {
|
|
27
|
+
"name": "Ada L.",
|
|
28
|
+
"locale": "tr"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## cURL
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
curl --request PATCH \
|
|
37
|
+
--url "http://localhost:3000/api/v1/profile" \
|
|
38
|
+
--header "Authorization: Bearer {{token}}" \
|
|
39
|
+
--header "Content-Type: application/json" \
|
|
40
|
+
--header "Accept: application/json" \
|
|
41
|
+
--data '{
|
|
42
|
+
"profile": {
|
|
43
|
+
"name": "Ada L.",
|
|
44
|
+
"locale": "tr"
|
|
45
|
+
}
|
|
46
|
+
}'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Responses
|
|
50
|
+
|
|
51
|
+
### 200 OK
|
|
52
|
+
|
|
53
|
+
#### Fields
|
|
54
|
+
|
|
55
|
+
| Field | Type | Required | Values |
|
|
56
|
+
| --- | --- | --- | --- |
|
|
57
|
+
| `id` | integer | yes | `1` |
|
|
58
|
+
| `name` | string | yes | `"Ada L."` |
|
|
59
|
+
| `email` | string | yes | `"ada@example.com"` |
|
|
60
|
+
| `locale` | string | yes | `"tr"` |
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"id": 1,
|
|
65
|
+
"name": "Ada L.",
|
|
66
|
+
"email": "ada@example.com",
|
|
67
|
+
"locale": "tr"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 422 Unprocessable Content
|
|
72
|
+
|
|
73
|
+
#### Fields
|
|
74
|
+
|
|
75
|
+
| Field | Type | Required | Values |
|
|
76
|
+
| --- | --- | --- | --- |
|
|
77
|
+
| `errors.locale[]` | string | yes | `"is not included in the list"` |
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"errors": {
|
|
82
|
+
"locale": [
|
|
83
|
+
"is not included in the list"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
Resource: [Profiles](index.md)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# List Products
|
|
2
|
+
|
|
3
|
+
`GET /api/v2/products`
|
|
4
|
+
|
|
5
|
+
Namespace: `api/v2`
|
|
6
|
+
|
|
7
|
+
## Headers
|
|
8
|
+
|
|
9
|
+
| Header | Value |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Accept | `application/json` |
|
|
12
|
+
|
|
13
|
+
## Query Parameters
|
|
14
|
+
|
|
15
|
+
| Field | Type | Required | Values |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `cursor` | string | no | `"eyJpZCI6Mn0"` |
|
|
18
|
+
|
|
19
|
+
## cURL
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl --request GET \
|
|
23
|
+
--url "http://localhost:3000/api/v2/products" \
|
|
24
|
+
--header "Accept: application/json"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Responses
|
|
28
|
+
|
|
29
|
+
### 200 OK
|
|
30
|
+
|
|
31
|
+
#### Fields
|
|
32
|
+
|
|
33
|
+
| Field | Type | Required | Values |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| `items[].id` | integer | yes | `2` |
|
|
36
|
+
| `items[].sku` | string | yes | `"TEA-002"` |
|
|
37
|
+
| `items[].name` | string | yes | `"Sencha"` |
|
|
38
|
+
| `items[].category` | string | yes | `"mugs"` \| `"tea"` |
|
|
39
|
+
| `items[].price_cents` | integer | yes | `1500` |
|
|
40
|
+
| `items[].tags[]` | string | yes | `"green"` \| `"insulated"` |
|
|
41
|
+
| `items[].price` | string | yes | `"15.00"` |
|
|
42
|
+
| `next_cursor` | null | string | yes | `"eyJpZCI6Mn0"` |
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"items": [
|
|
47
|
+
{
|
|
48
|
+
"id": 1,
|
|
49
|
+
"sku": "TEA-001",
|
|
50
|
+
"name": "Earl Grey",
|
|
51
|
+
"category": "tea",
|
|
52
|
+
"price_cents": 1200,
|
|
53
|
+
"tags": [
|
|
54
|
+
"black",
|
|
55
|
+
"bergamot"
|
|
56
|
+
],
|
|
57
|
+
"price": "12.00"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": 2,
|
|
61
|
+
"sku": "TEA-002",
|
|
62
|
+
"name": "Sencha",
|
|
63
|
+
"category": "tea",
|
|
64
|
+
"price_cents": 1500,
|
|
65
|
+
"tags": [
|
|
66
|
+
"green"
|
|
67
|
+
],
|
|
68
|
+
"price": "15.00"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"next_cursor": "eyJpZCI6Mn0"
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
Resource: [Products](index.md)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Create Product
|
|
5
|
+
# POST /api/v1/admin/products
|
|
6
|
+
curl --request POST \
|
|
7
|
+
--url "http://localhost:3000/api/v1/admin/products" \
|
|
8
|
+
--header "X-Api-Key: {{api_key}}" \
|
|
9
|
+
--header "Content-Type: application/json" \
|
|
10
|
+
--header "Accept: application/json" \
|
|
11
|
+
--data '{
|
|
12
|
+
"product": {
|
|
13
|
+
"sku": "TEA-003",
|
|
14
|
+
"name": "Jasmine",
|
|
15
|
+
"category": "tea",
|
|
16
|
+
"price_cents": 1400
|
|
17
|
+
}
|
|
18
|
+
}'
|