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.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/CHANGELOG.md +77 -0
  4. data/Gemfile +5 -0
  5. data/Gemfile.lock +171 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +239 -95
  8. data/Rakefile +13 -0
  9. data/docs/configuration.md +319 -0
  10. data/examples/complex-spec-app/.rspec +1 -0
  11. data/examples/complex-spec-app/README.md +21 -0
  12. data/examples/complex-spec-app/app.rb +363 -0
  13. data/examples/complex-spec-app/docs/api/README.md +104 -0
  14. data/examples/complex-spec-app/docs/api/api/v1/admin/products/create.md +117 -0
  15. data/examples/complex-spec-app/docs/api/api/v1/admin/products/destroy.md +51 -0
  16. data/examples/complex-spec-app/docs/api/api/v1/admin/products/index.md +11 -0
  17. data/examples/complex-spec-app/docs/api/api/v1/admin/products/list.md +106 -0
  18. data/examples/complex-spec-app/docs/api/api/v1/auth/index.md +9 -0
  19. data/examples/complex-spec-app/docs/api/api/v1/auth/login.md +76 -0
  20. data/examples/complex-spec-app/docs/api/api/v1/cart-items/create.md +91 -0
  21. data/examples/complex-spec-app/docs/api/api/v1/cart-items/destroy.md +51 -0
  22. data/examples/complex-spec-app/docs/api/api/v1/cart-items/index.md +10 -0
  23. data/examples/complex-spec-app/docs/api/api/v1/carts/checkout.md +102 -0
  24. data/examples/complex-spec-app/docs/api/api/v1/carts/index.md +10 -0
  25. data/examples/complex-spec-app/docs/api/api/v1/carts/show.md +73 -0
  26. data/examples/complex-spec-app/docs/api/api/v1/home/index.md +9 -0
  27. data/examples/complex-spec-app/docs/api/api/v1/home/list.md +47 -0
  28. data/examples/complex-spec-app/docs/api/api/v1/notes/create.md +94 -0
  29. data/examples/complex-spec-app/docs/api/api/v1/notes/index.md +10 -0
  30. data/examples/complex-spec-app/docs/api/api/v1/notes/list.md +61 -0
  31. data/examples/complex-spec-app/docs/api/api/v1/orders/cancel.md +69 -0
  32. data/examples/complex-spec-app/docs/api/api/v1/orders/create.md +150 -0
  33. data/examples/complex-spec-app/docs/api/api/v1/orders/destroy.md +37 -0
  34. data/examples/complex-spec-app/docs/api/api/v1/orders/index.md +13 -0
  35. data/examples/complex-spec-app/docs/api/api/v1/orders/list.md +78 -0
  36. data/examples/complex-spec-app/docs/api/api/v1/orders/show.md +83 -0
  37. data/examples/complex-spec-app/docs/api/api/v1/products/index.md +11 -0
  38. data/examples/complex-spec-app/docs/api/api/v1/products/list.md +83 -0
  39. data/examples/complex-spec-app/docs/api/api/v1/products/search.md +88 -0
  40. data/examples/complex-spec-app/docs/api/api/v1/products/show.md +71 -0
  41. data/examples/complex-spec-app/docs/api/api/v1/profiles/index.md +10 -0
  42. data/examples/complex-spec-app/docs/api/api/v1/profiles/show.md +61 -0
  43. data/examples/complex-spec-app/docs/api/api/v1/profiles/update.md +91 -0
  44. data/examples/complex-spec-app/docs/api/api/v2/products/index.md +9 -0
  45. data/examples/complex-spec-app/docs/api/api/v2/products/list.md +77 -0
  46. data/examples/complex-spec-app/docs/api/curl/api/v1/admin/products/create.sh +18 -0
  47. data/examples/complex-spec-app/docs/api/curl/api/v1/admin/products/destroy.sh +9 -0
  48. data/examples/complex-spec-app/docs/api/curl/api/v1/admin/products/list.sh +9 -0
  49. data/examples/complex-spec-app/docs/api/curl/api/v1/auth/login.sh +9 -0
  50. data/examples/complex-spec-app/docs/api/curl/api/v1/cart-items/create.sh +16 -0
  51. data/examples/complex-spec-app/docs/api/curl/api/v1/cart-items/destroy.sh +9 -0
  52. data/examples/complex-spec-app/docs/api/curl/api/v1/carts/checkout.sh +13 -0
  53. data/examples/complex-spec-app/docs/api/curl/api/v1/carts/show.sh +9 -0
  54. data/examples/complex-spec-app/docs/api/curl/api/v1/home/list.sh +8 -0
  55. data/examples/complex-spec-app/docs/api/curl/api/v1/notes/create.sh +15 -0
  56. data/examples/complex-spec-app/docs/api/curl/api/v1/notes/list.sh +9 -0
  57. data/examples/complex-spec-app/docs/api/curl/api/v1/orders/cancel.sh +9 -0
  58. data/examples/complex-spec-app/docs/api/curl/api/v1/orders/create.sh +29 -0
  59. data/examples/complex-spec-app/docs/api/curl/api/v1/orders/destroy.sh +9 -0
  60. data/examples/complex-spec-app/docs/api/curl/api/v1/orders/list.sh +9 -0
  61. data/examples/complex-spec-app/docs/api/curl/api/v1/orders/show.sh +9 -0
  62. data/examples/complex-spec-app/docs/api/curl/api/v1/products/list.sh +8 -0
  63. data/examples/complex-spec-app/docs/api/curl/api/v1/products/search.sh +8 -0
  64. data/examples/complex-spec-app/docs/api/curl/api/v1/products/show.sh +8 -0
  65. data/examples/complex-spec-app/docs/api/curl/api/v1/profiles/show.sh +9 -0
  66. data/examples/complex-spec-app/docs/api/curl/api/v1/profiles/update.sh +16 -0
  67. data/examples/complex-spec-app/docs/api/curl/api/v2/products/list.sh +8 -0
  68. data/examples/complex-spec-app/docs/api/dataset.json +5116 -0
  69. data/examples/complex-spec-app/docs/api/postman/collection.json +2519 -0
  70. data/examples/complex-spec-app/generate.rb +14 -0
  71. data/examples/complex-spec-app/reqcord.yml +28 -0
  72. data/examples/complex-spec-app/spec/requests/admin_spec.rb +67 -0
  73. data/examples/complex-spec-app/spec/requests/cart_spec.rb +61 -0
  74. data/examples/complex-spec-app/spec/requests/home_and_auth_spec.rb +49 -0
  75. data/examples/complex-spec-app/spec/requests/orders_spec.rb +124 -0
  76. data/examples/complex-spec-app/spec/requests/products_spec.rb +65 -0
  77. data/examples/complex-spec-app/spec/spec_helper.rb +17 -0
  78. data/examples/complex-test-app/README.md +40 -0
  79. data/examples/complex-test-app/app.rb +384 -0
  80. data/examples/complex-test-app/docs/api/README.md +104 -0
  81. data/examples/complex-test-app/docs/api/api/v1/admin/products/create.md +117 -0
  82. data/examples/complex-test-app/docs/api/api/v1/admin/products/destroy.md +51 -0
  83. data/examples/complex-test-app/docs/api/api/v1/admin/products/index.md +11 -0
  84. data/examples/complex-test-app/docs/api/api/v1/admin/products/list.md +106 -0
  85. data/examples/complex-test-app/docs/api/api/v1/auth/index.md +9 -0
  86. data/examples/complex-test-app/docs/api/api/v1/auth/login.md +76 -0
  87. data/examples/complex-test-app/docs/api/api/v1/cart-items/create.md +91 -0
  88. data/examples/complex-test-app/docs/api/api/v1/cart-items/destroy.md +51 -0
  89. data/examples/complex-test-app/docs/api/api/v1/cart-items/index.md +10 -0
  90. data/examples/complex-test-app/docs/api/api/v1/carts/checkout.md +102 -0
  91. data/examples/complex-test-app/docs/api/api/v1/carts/index.md +10 -0
  92. data/examples/complex-test-app/docs/api/api/v1/carts/show.md +73 -0
  93. data/examples/complex-test-app/docs/api/api/v1/home/index.md +9 -0
  94. data/examples/complex-test-app/docs/api/api/v1/home/list.md +47 -0
  95. data/examples/complex-test-app/docs/api/api/v1/notes/create.md +94 -0
  96. data/examples/complex-test-app/docs/api/api/v1/notes/index.md +10 -0
  97. data/examples/complex-test-app/docs/api/api/v1/notes/list.md +61 -0
  98. data/examples/complex-test-app/docs/api/api/v1/orders/cancel.md +69 -0
  99. data/examples/complex-test-app/docs/api/api/v1/orders/create.md +150 -0
  100. data/examples/complex-test-app/docs/api/api/v1/orders/destroy.md +37 -0
  101. data/examples/complex-test-app/docs/api/api/v1/orders/index.md +13 -0
  102. data/examples/complex-test-app/docs/api/api/v1/orders/list.md +71 -0
  103. data/examples/complex-test-app/docs/api/api/v1/orders/show.md +83 -0
  104. data/examples/complex-test-app/docs/api/api/v1/products/index.md +11 -0
  105. data/examples/complex-test-app/docs/api/api/v1/products/list.md +83 -0
  106. data/examples/complex-test-app/docs/api/api/v1/products/search.md +88 -0
  107. data/examples/complex-test-app/docs/api/api/v1/products/show.md +71 -0
  108. data/examples/complex-test-app/docs/api/api/v1/profiles/index.md +10 -0
  109. data/examples/complex-test-app/docs/api/api/v1/profiles/show.md +61 -0
  110. data/examples/complex-test-app/docs/api/api/v1/profiles/update.md +91 -0
  111. data/examples/complex-test-app/docs/api/api/v2/products/index.md +9 -0
  112. data/examples/complex-test-app/docs/api/api/v2/products/list.md +77 -0
  113. data/examples/complex-test-app/docs/api/curl/api/v1/admin/products/create.sh +18 -0
  114. data/examples/complex-test-app/docs/api/curl/api/v1/admin/products/destroy.sh +9 -0
  115. data/examples/complex-test-app/docs/api/curl/api/v1/admin/products/list.sh +9 -0
  116. data/examples/complex-test-app/docs/api/curl/api/v1/auth/login.sh +9 -0
  117. data/examples/complex-test-app/docs/api/curl/api/v1/cart-items/create.sh +16 -0
  118. data/examples/complex-test-app/docs/api/curl/api/v1/cart-items/destroy.sh +9 -0
  119. data/examples/complex-test-app/docs/api/curl/api/v1/carts/checkout.sh +13 -0
  120. data/examples/complex-test-app/docs/api/curl/api/v1/carts/show.sh +9 -0
  121. data/examples/complex-test-app/docs/api/curl/api/v1/home/list.sh +8 -0
  122. data/examples/complex-test-app/docs/api/curl/api/v1/notes/create.sh +15 -0
  123. data/examples/complex-test-app/docs/api/curl/api/v1/notes/list.sh +9 -0
  124. data/examples/complex-test-app/docs/api/curl/api/v1/orders/cancel.sh +9 -0
  125. data/examples/complex-test-app/docs/api/curl/api/v1/orders/create.sh +29 -0
  126. data/examples/complex-test-app/docs/api/curl/api/v1/orders/destroy.sh +9 -0
  127. data/examples/complex-test-app/docs/api/curl/api/v1/orders/list.sh +9 -0
  128. data/examples/complex-test-app/docs/api/curl/api/v1/orders/show.sh +9 -0
  129. data/examples/complex-test-app/docs/api/curl/api/v1/products/list.sh +8 -0
  130. data/examples/complex-test-app/docs/api/curl/api/v1/products/search.sh +8 -0
  131. data/examples/complex-test-app/docs/api/curl/api/v1/products/show.sh +8 -0
  132. data/examples/complex-test-app/docs/api/curl/api/v1/profiles/show.sh +9 -0
  133. data/examples/complex-test-app/docs/api/curl/api/v1/profiles/update.sh +16 -0
  134. data/examples/complex-test-app/docs/api/curl/api/v2/products/list.sh +8 -0
  135. data/examples/complex-test-app/docs/api/dataset.json +5109 -0
  136. data/examples/complex-test-app/docs/api/postman/collection.json +2568 -0
  137. data/examples/complex-test-app/generate.rb +14 -0
  138. data/examples/complex-test-app/reqcord.yml +28 -0
  139. data/examples/complex-test-app/test/integration/admin_test.rb +70 -0
  140. data/examples/complex-test-app/test/integration/cart_test.rb +64 -0
  141. data/examples/complex-test-app/test/integration/home_and_auth_test.rb +53 -0
  142. data/examples/complex-test-app/test/integration/orders_test.rb +127 -0
  143. data/examples/complex-test-app/test/integration/products_test.rb +66 -0
  144. data/examples/reqcord.yml +58 -0
  145. data/examples/spec-app/.rspec +1 -0
  146. data/examples/spec-app/README.md +36 -0
  147. data/examples/spec-app/app.rb +209 -0
  148. data/examples/spec-app/docs/api/README.md +45 -0
  149. data/examples/spec-app/docs/api/api/v1/customers/create.md +95 -0
  150. data/examples/spec-app/docs/api/api/v1/customers/index.md +11 -0
  151. data/examples/spec-app/docs/api/api/v1/customers/list.md +67 -0
  152. data/examples/spec-app/docs/api/api/v1/customers/show.md +65 -0
  153. data/examples/spec-app/docs/api/api/v1/tasks/complete.md +51 -0
  154. data/examples/spec-app/docs/api/api/v1/tasks/create.md +90 -0
  155. data/examples/spec-app/docs/api/api/v1/tasks/destroy.md +35 -0
  156. data/examples/spec-app/docs/api/api/v1/tasks/index.md +14 -0
  157. data/examples/spec-app/docs/api/api/v1/tasks/list.md +65 -0
  158. data/examples/spec-app/docs/api/api/v1/tasks/show.md +65 -0
  159. data/examples/spec-app/docs/api/api/v1/tasks/update.md +74 -0
  160. data/examples/spec-app/docs/api/api/v1/users/create.md +95 -0
  161. data/examples/spec-app/docs/api/api/v1/users/index.md +11 -0
  162. data/examples/spec-app/docs/api/api/v1/users/list.md +67 -0
  163. data/examples/spec-app/docs/api/api/v1/users/show.md +65 -0
  164. data/examples/spec-app/docs/api/curl/api/v1/customers/create.sh +17 -0
  165. data/examples/spec-app/docs/api/curl/api/v1/customers/list.sh +9 -0
  166. data/examples/spec-app/docs/api/curl/api/v1/customers/show.sh +9 -0
  167. data/examples/spec-app/docs/api/curl/api/v1/tasks/complete.sh +8 -0
  168. data/examples/spec-app/docs/api/curl/api/v1/tasks/create.sh +15 -0
  169. data/examples/spec-app/docs/api/curl/api/v1/tasks/destroy.sh +8 -0
  170. data/examples/spec-app/docs/api/curl/api/v1/tasks/list.sh +8 -0
  171. data/examples/spec-app/docs/api/curl/api/v1/tasks/show.sh +8 -0
  172. data/examples/spec-app/docs/api/curl/api/v1/tasks/update.sh +14 -0
  173. data/examples/spec-app/docs/api/curl/api/v1/users/create.sh +17 -0
  174. data/examples/spec-app/docs/api/curl/api/v1/users/list.sh +9 -0
  175. data/examples/spec-app/docs/api/curl/api/v1/users/show.sh +9 -0
  176. data/examples/spec-app/docs/api/dataset.json +2402 -0
  177. data/examples/spec-app/docs/api/postman/collection.json +1290 -0
  178. data/examples/spec-app/generate.rb +14 -0
  179. data/examples/spec-app/reqcord.yml +27 -0
  180. data/examples/spec-app/spec/requests/customers_spec.rb +71 -0
  181. data/examples/spec-app/spec/requests/tasks_spec.rb +78 -0
  182. data/examples/spec-app/spec/requests/users_spec.rb +68 -0
  183. data/examples/spec-app/spec/spec_helper.rb +17 -0
  184. data/examples/test-app/README.md +57 -0
  185. data/examples/test-app/app.rb +212 -0
  186. data/examples/test-app/docs/api/README.md +45 -0
  187. data/examples/test-app/docs/api/api/v1/customers/create.md +95 -0
  188. data/examples/test-app/docs/api/api/v1/customers/index.md +11 -0
  189. data/examples/test-app/docs/api/api/v1/customers/list.md +67 -0
  190. data/examples/test-app/docs/api/api/v1/customers/show.md +65 -0
  191. data/examples/test-app/docs/api/api/v1/tasks/complete.md +51 -0
  192. data/examples/test-app/docs/api/api/v1/tasks/create.md +90 -0
  193. data/examples/test-app/docs/api/api/v1/tasks/destroy.md +35 -0
  194. data/examples/test-app/docs/api/api/v1/tasks/index.md +14 -0
  195. data/examples/test-app/docs/api/api/v1/tasks/list.md +65 -0
  196. data/examples/test-app/docs/api/api/v1/tasks/show.md +65 -0
  197. data/examples/test-app/docs/api/api/v1/tasks/update.md +74 -0
  198. data/examples/test-app/docs/api/api/v1/users/create.md +95 -0
  199. data/examples/test-app/docs/api/api/v1/users/index.md +11 -0
  200. data/examples/test-app/docs/api/api/v1/users/list.md +67 -0
  201. data/examples/test-app/docs/api/api/v1/users/show.md +65 -0
  202. data/examples/test-app/docs/api/curl/api/v1/customers/create.sh +17 -0
  203. data/examples/test-app/docs/api/curl/api/v1/customers/list.sh +9 -0
  204. data/examples/test-app/docs/api/curl/api/v1/customers/show.sh +9 -0
  205. data/examples/test-app/docs/api/curl/api/v1/tasks/complete.sh +8 -0
  206. data/examples/test-app/docs/api/curl/api/v1/tasks/create.sh +15 -0
  207. data/examples/test-app/docs/api/curl/api/v1/tasks/destroy.sh +8 -0
  208. data/examples/test-app/docs/api/curl/api/v1/tasks/list.sh +8 -0
  209. data/examples/test-app/docs/api/curl/api/v1/tasks/show.sh +8 -0
  210. data/examples/test-app/docs/api/curl/api/v1/tasks/update.sh +14 -0
  211. data/examples/test-app/docs/api/curl/api/v1/users/create.sh +17 -0
  212. data/examples/test-app/docs/api/curl/api/v1/users/list.sh +9 -0
  213. data/examples/test-app/docs/api/curl/api/v1/users/show.sh +9 -0
  214. data/examples/test-app/docs/api/dataset.json +2402 -0
  215. data/examples/test-app/docs/api/postman/collection.json +1290 -0
  216. data/examples/test-app/generate.rb +14 -0
  217. data/examples/test-app/reqcord.yml +28 -0
  218. data/examples/test-app/test/integration/customers_test.rb +72 -0
  219. data/examples/test-app/test/integration/tasks_test.rb +80 -0
  220. data/examples/test-app/test/integration/users_test.rb +72 -0
  221. data/lib/reqcord/capture/collector.rb +31 -0
  222. data/lib/reqcord/capture/integration_patch.rb +209 -0
  223. data/lib/reqcord/capture/minitest_context.rb +34 -0
  224. data/lib/reqcord/capture/rspec_context.rb +42 -0
  225. data/lib/reqcord/capture/test_context.rb +25 -0
  226. data/lib/reqcord/capture.rb +19 -0
  227. data/lib/reqcord/configuration.rb +198 -0
  228. data/lib/reqcord/dataset.rb +176 -0
  229. data/lib/reqcord/endpoint.rb +263 -0
  230. data/lib/reqcord/errors.rb +9 -0
  231. data/lib/reqcord/exporters/curl.rb +68 -0
  232. data/lib/reqcord/exporters/markdown.rb +295 -0
  233. data/lib/reqcord/exporters/postman.rb +206 -0
  234. data/lib/reqcord/exporters.rb +32 -0
  235. data/lib/reqcord/generator.rb +364 -0
  236. data/lib/reqcord/railtie.rb +51 -0
  237. data/lib/reqcord/renderers/curl.rb +56 -0
  238. data/lib/reqcord/renderers/payload.rb +69 -0
  239. data/lib/reqcord/request_example.rb +104 -0
  240. data/lib/reqcord/response_example.rb +72 -0
  241. data/lib/reqcord/route_collector.rb +242 -0
  242. data/lib/reqcord/sanitizers/sanitizer.rb +140 -0
  243. data/lib/reqcord/schema.rb +187 -0
  244. data/lib/reqcord/support.rb +58 -0
  245. data/lib/reqcord/version.rb +5 -0
  246. data/lib/reqcord.rb +78 -0
  247. data/lib/tasks/reqcord.rake +99 -0
  248. data/reqcord.gemspec +46 -0
  249. metadata +317 -3
@@ -0,0 +1,104 @@
1
+ # API Documentation
2
+
3
+ Generated by Reqcord from the application's integration tests.
4
+
5
+ Base URL: `http://localhost:3000`
6
+
7
+ ## Placeholders
8
+
9
+ | Header | Replace with |
10
+ | --- | --- |
11
+ | Authorization | `Bearer {{token}}` |
12
+ | X-Api-Key | `{{api_key}}` |
13
+
14
+ ## Products
15
+
16
+ Namespace: `api/v1/admin`
17
+
18
+ | Method | Path | Description |
19
+ | --- | --- | --- |
20
+ | `GET` | [`/api/v1/admin/products`](api/v1/admin/products/list.md) | List Products |
21
+ | `POST` | [`/api/v1/admin/products`](api/v1/admin/products/create.md) | Create Product |
22
+ | `DELETE` | [`/api/v1/admin/products/:id`](api/v1/admin/products/destroy.md) | Delete Product |
23
+
24
+ ## Auth
25
+
26
+ Namespace: `api/v1`
27
+
28
+ | Method | Path | Description |
29
+ | --- | --- | --- |
30
+ | `POST` | [`/api/v1/auth/login`](api/v1/auth/login.md) | Login |
31
+
32
+ ## Cart Items
33
+
34
+ Namespace: `api/v1`
35
+
36
+ | Method | Path | Description |
37
+ | --- | --- | --- |
38
+ | `POST` | [`/api/v1/cart/items`](api/v1/cart-items/create.md) | Create Cart Item |
39
+ | `DELETE` | [`/api/v1/cart/items/:sku`](api/v1/cart-items/destroy.md) | Delete Cart Item |
40
+
41
+ ## Carts
42
+
43
+ Namespace: `api/v1`
44
+
45
+ | Method | Path | Description |
46
+ | --- | --- | --- |
47
+ | `GET` | [`/api/v1/cart`](api/v1/carts/show.md) | Get Cart |
48
+ | `POST` | [`/api/v1/cart/checkout`](api/v1/carts/checkout.md) | Checkout Cart |
49
+
50
+ ## Home
51
+
52
+ Namespace: `api/v1`
53
+
54
+ | Method | Path | Description |
55
+ | --- | --- | --- |
56
+ | `GET` | [`/api/v1`](api/v1/home/list.md) | Home |
57
+
58
+ ## Notes
59
+
60
+ Namespace: `api/v1`
61
+
62
+ | Method | Path | Description |
63
+ | --- | --- | --- |
64
+ | `GET` | [`/api/v1/orders/:order_id/notes`](api/v1/notes/list.md) | List Notes |
65
+ | `POST` | [`/api/v1/orders/:order_id/notes`](api/v1/notes/create.md) | Create Note |
66
+
67
+ ## Orders
68
+
69
+ Namespace: `api/v1`
70
+
71
+ | Method | Path | Description |
72
+ | --- | --- | --- |
73
+ | `GET` | [`/api/v1/orders`](api/v1/orders/list.md) | List Orders |
74
+ | `POST` | [`/api/v1/orders`](api/v1/orders/create.md) | Create Order |
75
+ | `DELETE` | [`/api/v1/orders/:id`](api/v1/orders/destroy.md) | Delete Order |
76
+ | `GET` | [`/api/v1/orders/:id`](api/v1/orders/show.md) | Get Order |
77
+ | `POST` | [`/api/v1/orders/:id/cancel`](api/v1/orders/cancel.md) | Cancel Order |
78
+
79
+ ## Products
80
+
81
+ Namespace: `api/v1`
82
+
83
+ | Method | Path | Description |
84
+ | --- | --- | --- |
85
+ | `GET` | [`/api/v1/products`](api/v1/products/list.md) | List Products |
86
+ | `GET` | [`/api/v1/products/:id`](api/v1/products/show.md) | Get Product |
87
+ | `GET` | [`/api/v1/products/search`](api/v1/products/search.md) | Search Products |
88
+
89
+ ## Profiles
90
+
91
+ Namespace: `api/v1`
92
+
93
+ | Method | Path | Description |
94
+ | --- | --- | --- |
95
+ | `GET` | [`/api/v1/profile`](api/v1/profiles/show.md) | Get Profile |
96
+ | `PATCH` | [`/api/v1/profile`](api/v1/profiles/update.md) | Update Profile |
97
+
98
+ ## Products
99
+
100
+ Namespace: `api/v2`
101
+
102
+ | Method | Path | Description |
103
+ | --- | --- | --- |
104
+ | `GET` | [`/api/v2/products`](api/v2/products/list.md) | List Products |
@@ -0,0 +1,117 @@
1
+ # Create Product
2
+
3
+ `POST /api/v1/admin/products`
4
+
5
+ Namespace: `api/v1/admin`
6
+
7
+ ## Headers
8
+
9
+ | Header | Value |
10
+ | --- | --- |
11
+ | X-Api-Key | `{{api_key}}` |
12
+ | Content-Type | `application/json` |
13
+ | Accept | `application/json` |
14
+
15
+ ## Body Parameters
16
+
17
+ | Field | Type | Required | Values |
18
+ | --- | --- | --- | --- |
19
+ | `product.sku` | string | yes | `"TEA-003"` |
20
+ | `product.name` | string | yes | `"Jasmine"` |
21
+ | `product.category` | string | yes | `"tea"` |
22
+ | `product.price_cents` | integer | yes | `1400` |
23
+
24
+ ## Example Request
25
+
26
+ ```json
27
+ {
28
+ "product": {
29
+ "sku": "TEA-003",
30
+ "name": "Jasmine",
31
+ "category": "tea",
32
+ "price_cents": 1400
33
+ }
34
+ }
35
+ ```
36
+
37
+ ## cURL
38
+
39
+ ```bash
40
+ curl --request POST \
41
+ --url "http://localhost:3000/api/v1/admin/products" \
42
+ --header "X-Api-Key: {{api_key}}" \
43
+ --header "Content-Type: application/json" \
44
+ --header "Accept: application/json" \
45
+ --data '{
46
+ "product": {
47
+ "sku": "TEA-003",
48
+ "name": "Jasmine",
49
+ "category": "tea",
50
+ "price_cents": 1400
51
+ }
52
+ }'
53
+ ```
54
+
55
+ ## Responses
56
+
57
+ ### 201 Created
58
+
59
+ #### Fields
60
+
61
+ | Field | Type | Required | Values |
62
+ | --- | --- | --- | --- |
63
+ | `id` | integer | yes | `5` |
64
+ | `cost_cents` | integer | yes | `0` |
65
+ | `tags` | array | yes | - |
66
+ | `sku` | string | yes | `"TEA-003"` |
67
+ | `name` | string | yes | `"Jasmine"` |
68
+ | `category` | string | yes | `"tea"` |
69
+ | `price_cents` | integer | yes | `1400` |
70
+
71
+ ```json
72
+ {
73
+ "id": 5,
74
+ "cost_cents": 0,
75
+ "tags": [],
76
+ "sku": "TEA-003",
77
+ "name": "Jasmine",
78
+ "category": "tea",
79
+ "price_cents": 1400
80
+ }
81
+ ```
82
+
83
+ ### 409 Conflict
84
+
85
+ #### Fields
86
+
87
+ | Field | Type | Required | Values |
88
+ | --- | --- | --- | --- |
89
+ | `error` | string | yes | `"sku TEA-001 already exists"` |
90
+
91
+ ```json
92
+ {
93
+ "error": "sku TEA-001 already exists"
94
+ }
95
+ ```
96
+
97
+ ### 422 Unprocessable Content
98
+
99
+ #### Fields
100
+
101
+ | Field | Type | Required | Values |
102
+ | --- | --- | --- | --- |
103
+ | `errors.sku[]` | string | yes | `"can't be blank"` |
104
+
105
+ ```json
106
+ {
107
+ "errors": {
108
+ "sku": [
109
+ "can't be blank"
110
+ ]
111
+ }
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ Resource: [Products](index.md)
@@ -0,0 +1,51 @@
1
+ # Delete Product
2
+
3
+ `DELETE /api/v1/admin/products/:id`
4
+
5
+ Namespace: `api/v1/admin`
6
+
7
+ ## Headers
8
+
9
+ | Header | Value |
10
+ | --- | --- |
11
+ | X-Api-Key | `{{api_key}}` |
12
+ | Accept | `application/json` |
13
+
14
+ ## Path Parameters
15
+
16
+ | Field | Type | Required | Values |
17
+ | --- | --- | --- | --- |
18
+ | `id` | string | yes | `"4"` |
19
+
20
+ ## cURL
21
+
22
+ ```bash
23
+ curl --request DELETE \
24
+ --url "http://localhost:3000/api/v1/admin/products/4" \
25
+ --header "X-Api-Key: {{api_key}}" \
26
+ --header "Accept: application/json"
27
+ ```
28
+
29
+ ## Responses
30
+
31
+ ### 204 No Content
32
+
33
+ _No response body._
34
+
35
+ ### 404 Not Found
36
+
37
+ #### Fields
38
+
39
+ | Field | Type | Required | Values |
40
+ | --- | --- | --- | --- |
41
+ | `error` | string | yes | `"Not Found"` |
42
+
43
+ ```json
44
+ {
45
+ "error": "Not Found"
46
+ }
47
+ ```
48
+
49
+ ---
50
+
51
+ Resource: [Products](index.md)
@@ -0,0 +1,11 @@
1
+ # Products
2
+
3
+ Namespace: `api/v1/admin`
4
+
5
+ API version: `v1`
6
+
7
+ | Method | Path | Description |
8
+ | --- | --- | --- |
9
+ | `GET` | [`/api/v1/admin/products`](list.md) | List Products |
10
+ | `POST` | [`/api/v1/admin/products`](create.md) | Create Product |
11
+ | `DELETE` | [`/api/v1/admin/products/:id`](destroy.md) | Delete Product |
@@ -0,0 +1,106 @@
1
+ # List Products
2
+
3
+ `GET /api/v1/admin/products`
4
+
5
+ Namespace: `api/v1/admin`
6
+
7
+ ## Headers
8
+
9
+ | Header | Value |
10
+ | --- | --- |
11
+ | X-Api-Key | `{{api_key}}` |
12
+ | Accept | `application/json` |
13
+
14
+ ## cURL
15
+
16
+ ```bash
17
+ curl --request GET \
18
+ --url "http://localhost:3000/api/v1/admin/products" \
19
+ --header "X-Api-Key: {{api_key}}" \
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 | `4` |
32
+ | `[].sku` | string | yes | `"MUG-002"` |
33
+ | `[].name` | string | yes | `"Travel Mug"` |
34
+ | `[].category` | string | yes | `"mugs"` |
35
+ | `[].price_cents` | integer | yes | `3200` |
36
+ | `[].cost_cents` | integer | yes | `1400` |
37
+ | `[].tags[]` | string | yes | `"insulated"` |
38
+
39
+ ```json
40
+ [
41
+ {
42
+ "id": 1,
43
+ "sku": "TEA-001",
44
+ "name": "Earl Grey",
45
+ "category": "tea",
46
+ "price_cents": 1200,
47
+ "cost_cents": 500,
48
+ "tags": [
49
+ "black",
50
+ "bergamot"
51
+ ]
52
+ },
53
+ {
54
+ "id": 2,
55
+ "sku": "TEA-002",
56
+ "name": "Sencha",
57
+ "category": "tea",
58
+ "price_cents": 1500,
59
+ "cost_cents": 700,
60
+ "tags": [
61
+ "green"
62
+ ]
63
+ },
64
+ {
65
+ "id": 3,
66
+ "sku": "MUG-001",
67
+ "name": "Stoneware Mug",
68
+ "category": "mugs",
69
+ "price_cents": 2400,
70
+ "cost_cents": 900,
71
+ "tags": [
72
+ "ceramic"
73
+ ]
74
+ },
75
+ {
76
+ "id": 4,
77
+ "sku": "MUG-002",
78
+ "name": "Travel Mug",
79
+ "category": "mugs",
80
+ "price_cents": 3200,
81
+ "cost_cents": 1400,
82
+ "tags": [
83
+ "steel",
84
+ "insulated"
85
+ ]
86
+ }
87
+ ]
88
+ ```
89
+
90
+ ### 401 Unauthorized
91
+
92
+ #### Fields
93
+
94
+ | Field | Type | Required | Values |
95
+ | --- | --- | --- | --- |
96
+ | `error` | string | yes | `"API key required"` |
97
+
98
+ ```json
99
+ {
100
+ "error": "API key required"
101
+ }
102
+ ```
103
+
104
+ ---
105
+
106
+ Resource: [Products](index.md)
@@ -0,0 +1,9 @@
1
+ # Auth
2
+
3
+ Namespace: `api/v1`
4
+
5
+ API version: `v1`
6
+
7
+ | Method | Path | Description |
8
+ | --- | --- | --- |
9
+ | `POST` | [`/api/v1/auth/login`](login.md) | Login |
@@ -0,0 +1,76 @@
1
+ # Login
2
+
3
+ `POST /api/v1/auth/login`
4
+
5
+ Namespace: `api/v1`
6
+
7
+ ## Headers
8
+
9
+ | Header | Value |
10
+ | --- | --- |
11
+ | Content-Type | `application/x-www-form-urlencoded` |
12
+
13
+ ## Body Parameters
14
+
15
+ | Field | Type | Required | Values |
16
+ | --- | --- | --- | --- |
17
+ | `email` | string | yes | `"ada@example.com"` |
18
+ | `password` | string | yes | `"{{password}}"` |
19
+
20
+ ## Example Request
21
+
22
+ Sent as `application/x-www-form-urlencoded`; the cURL below carries it in that encoding.
23
+
24
+ ```json
25
+ {
26
+ "email": "ada@example.com",
27
+ "password": "{{password}}"
28
+ }
29
+ ```
30
+
31
+ ## cURL
32
+
33
+ ```bash
34
+ curl --request POST \
35
+ --url "http://localhost:3000/api/v1/auth/login" \
36
+ --header "Content-Type: application/x-www-form-urlencoded" \
37
+ --data 'email=ada%40example.com&password=%7B%7Bpassword%7D%7D'
38
+ ```
39
+
40
+ ## Responses
41
+
42
+ ### 200 OK
43
+
44
+ #### Fields
45
+
46
+ | Field | Type | Required | Values |
47
+ | --- | --- | --- | --- |
48
+ | `token` | string | yes | `"{{token}}"` |
49
+ | `token_type` | string | yes | `"Bearer"` |
50
+ | `expires_in` | integer | yes | `3600` |
51
+
52
+ ```json
53
+ {
54
+ "token": "{{token}}",
55
+ "token_type": "Bearer",
56
+ "expires_in": 3600
57
+ }
58
+ ```
59
+
60
+ ### 401 Unauthorized
61
+
62
+ #### Fields
63
+
64
+ | Field | Type | Required | Values |
65
+ | --- | --- | --- | --- |
66
+ | `error` | string | yes | `"Invalid email or password"` |
67
+
68
+ ```json
69
+ {
70
+ "error": "Invalid email or password"
71
+ }
72
+ ```
73
+
74
+ ---
75
+
76
+ Resource: [Auth](index.md)
@@ -0,0 +1,91 @@
1
+ # Create Cart Item
2
+
3
+ `POST /api/v1/cart/items`
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
+ | `item.sku` | string | yes | `"TEA-002"` |
20
+ | `item.quantity` | integer | yes | `3` |
21
+
22
+ ## Example Request
23
+
24
+ ```json
25
+ {
26
+ "item": {
27
+ "sku": "TEA-002",
28
+ "quantity": 3
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## cURL
34
+
35
+ ```bash
36
+ curl --request POST \
37
+ --url "http://localhost:3000/api/v1/cart/items" \
38
+ --header "Authorization: Bearer {{token}}" \
39
+ --header "Content-Type: application/json" \
40
+ --header "Accept: application/json" \
41
+ --data '{
42
+ "item": {
43
+ "sku": "TEA-002",
44
+ "quantity": 3
45
+ }
46
+ }'
47
+ ```
48
+
49
+ ## Responses
50
+
51
+ ### 201 Created
52
+
53
+ #### Fields
54
+
55
+ | Field | Type | Required | Values |
56
+ | --- | --- | --- | --- |
57
+ | `sku` | string | yes | `"TEA-002"` |
58
+ | `name` | string | yes | `"Sencha"` |
59
+ | `quantity` | integer | yes | `3` |
60
+ | `unit_price_cents` | integer | yes | `1500` |
61
+
62
+ ```json
63
+ {
64
+ "sku": "TEA-002",
65
+ "name": "Sencha",
66
+ "quantity": 3,
67
+ "unit_price_cents": 1500
68
+ }
69
+ ```
70
+
71
+ ### 422 Unprocessable Content
72
+
73
+ #### Fields
74
+
75
+ | Field | Type | Required | Values |
76
+ | --- | --- | --- | --- |
77
+ | `errors.sku[]` | string | yes | `"TEA-999 is not a known product"` |
78
+
79
+ ```json
80
+ {
81
+ "errors": {
82
+ "sku": [
83
+ "TEA-999 is not a known product"
84
+ ]
85
+ }
86
+ }
87
+ ```
88
+
89
+ ---
90
+
91
+ Resource: [Cart Items](index.md)
@@ -0,0 +1,51 @@
1
+ # Delete Cart Item
2
+
3
+ `DELETE /api/v1/cart/items/:sku`
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
+ | `sku` | string | yes | `"TEA-001"` |
19
+
20
+ ## cURL
21
+
22
+ ```bash
23
+ curl --request DELETE \
24
+ --url "http://localhost:3000/api/v1/cart/items/TEA-001" \
25
+ --header "Authorization: Bearer {{token}}" \
26
+ --header "Accept: application/json"
27
+ ```
28
+
29
+ ## Responses
30
+
31
+ ### 204 No Content
32
+
33
+ _No response body._
34
+
35
+ ### 404 Not Found
36
+
37
+ #### Fields
38
+
39
+ | Field | Type | Required | Values |
40
+ | --- | --- | --- | --- |
41
+ | `error` | string | yes | `"Not Found"` |
42
+
43
+ ```json
44
+ {
45
+ "error": "Not Found"
46
+ }
47
+ ```
48
+
49
+ ---
50
+
51
+ Resource: [Cart Items](index.md)
@@ -0,0 +1,10 @@
1
+ # Cart Items
2
+
3
+ Namespace: `api/v1`
4
+
5
+ API version: `v1`
6
+
7
+ | Method | Path | Description |
8
+ | --- | --- | --- |
9
+ | `POST` | [`/api/v1/cart/items`](create.md) | Create Cart Item |
10
+ | `DELETE` | [`/api/v1/cart/items/:sku`](destroy.md) | Delete Cart Item |