harpiya_api 4.3.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +5 -0
  4. data/LICENSE +26 -0
  5. data/Rakefile +29 -0
  6. data/app/assets/javascripts/harpiya/api/main.js +36 -0
  7. data/app/assets/javascripts/harpiya/api/storefront/cart.js +49 -0
  8. data/app/controllers/concerns/harpiya/api/v2/storefront/order_concern.rb +52 -0
  9. data/app/controllers/harpiya/api/base_controller.rb +171 -0
  10. data/app/controllers/harpiya/api/errors_controller.rb +9 -0
  11. data/app/controllers/harpiya/api/v1/addresses_controller.rb +46 -0
  12. data/app/controllers/harpiya/api/v1/checkouts_controller.rb +106 -0
  13. data/app/controllers/harpiya/api/v1/classifications_controller.rb +20 -0
  14. data/app/controllers/harpiya/api/v1/countries_controller.rb +22 -0
  15. data/app/controllers/harpiya/api/v1/credit_cards_controller.rb +26 -0
  16. data/app/controllers/harpiya/api/v1/customer_returns_controller.rb +25 -0
  17. data/app/controllers/harpiya/api/v1/images_controller.rb +58 -0
  18. data/app/controllers/harpiya/api/v1/inventory_units_controller.rb +54 -0
  19. data/app/controllers/harpiya/api/v1/line_items_controller.rb +70 -0
  20. data/app/controllers/harpiya/api/v1/option_types_controller.rb +60 -0
  21. data/app/controllers/harpiya/api/v1/option_values_controller.rb +62 -0
  22. data/app/controllers/harpiya/api/v1/orders_controller.rb +156 -0
  23. data/app/controllers/harpiya/api/v1/payments_controller.rb +82 -0
  24. data/app/controllers/harpiya/api/v1/product_properties_controller.rb +73 -0
  25. data/app/controllers/harpiya/api/v1/products_controller.rb +131 -0
  26. data/app/controllers/harpiya/api/v1/promotions_controller.rb +30 -0
  27. data/app/controllers/harpiya/api/v1/properties_controller.rb +70 -0
  28. data/app/controllers/harpiya/api/v1/reimbursements_controller.rb +25 -0
  29. data/app/controllers/harpiya/api/v1/return_authorizations_controller.rb +70 -0
  30. data/app/controllers/harpiya/api/v1/shipments_controller.rb +196 -0
  31. data/app/controllers/harpiya/api/v1/states_controller.rb +36 -0
  32. data/app/controllers/harpiya/api/v1/stock_items_controller.rb +82 -0
  33. data/app/controllers/harpiya/api/v1/stock_locations_controller.rb +53 -0
  34. data/app/controllers/harpiya/api/v1/stock_movements_controller.rb +45 -0
  35. data/app/controllers/harpiya/api/v1/stores_controller.rb +56 -0
  36. data/app/controllers/harpiya/api/v1/taxonomies_controller.rb +67 -0
  37. data/app/controllers/harpiya/api/v1/taxons_controller.rb +100 -0
  38. data/app/controllers/harpiya/api/v1/users_controller.rb +97 -0
  39. data/app/controllers/harpiya/api/v1/variants_controller.rb +81 -0
  40. data/app/controllers/harpiya/api/v1/zones_controller.rb +55 -0
  41. data/app/controllers/harpiya/api/v2/base_controller.rb +167 -0
  42. data/app/controllers/harpiya/api/v2/platform/addresses_controller.rb +19 -0
  43. data/app/controllers/harpiya/api/v2/platform/countries_controller.rb +19 -0
  44. data/app/controllers/harpiya/api/v2/platform/menu_items_controller.rb +35 -0
  45. data/app/controllers/harpiya/api/v2/platform/menus_controller.rb +19 -0
  46. data/app/controllers/harpiya/api/v2/platform/option_types_controller.rb +15 -0
  47. data/app/controllers/harpiya/api/v2/platform/option_values_controller.rb +19 -0
  48. data/app/controllers/harpiya/api/v2/platform/products_controller.rb +27 -0
  49. data/app/controllers/harpiya/api/v2/platform/resource_controller.rb +102 -0
  50. data/app/controllers/harpiya/api/v2/platform/taxons_controller.rb +27 -0
  51. data/app/controllers/harpiya/api/v2/platform/users_controller.rb +23 -0
  52. data/app/controllers/harpiya/api/v2/resource_controller.rb +59 -0
  53. data/app/controllers/harpiya/api/v2/storefront/account/addresses_controller.rb +75 -0
  54. data/app/controllers/harpiya/api/v2/storefront/account/credit_cards_controller.rb +39 -0
  55. data/app/controllers/harpiya/api/v2/storefront/account/orders_controller.rb +46 -0
  56. data/app/controllers/harpiya/api/v2/storefront/account_controller.rb +52 -0
  57. data/app/controllers/harpiya/api/v2/storefront/cart_controller.rb +195 -0
  58. data/app/controllers/harpiya/api/v2/storefront/checkout_controller.rb +136 -0
  59. data/app/controllers/harpiya/api/v2/storefront/countries_controller.rb +50 -0
  60. data/app/controllers/harpiya/api/v2/storefront/menus_controller.rb +42 -0
  61. data/app/controllers/harpiya/api/v2/storefront/order_status_controller.rb +34 -0
  62. data/app/controllers/harpiya/api/v2/storefront/products_controller.rb +55 -0
  63. data/app/controllers/harpiya/api/v2/storefront/stores_controller.rb +23 -0
  64. data/app/controllers/harpiya/api/v2/storefront/taxons_controller.rb +47 -0
  65. data/app/helpers/harpiya/api/api_helpers.rb +190 -0
  66. data/app/helpers/harpiya/api/v2/collection_options_helpers.rb +46 -0
  67. data/app/helpers/harpiya/api/v2/display_money_helper.rb +43 -0
  68. data/app/models/concerns/harpiya/user_api_authentication.rb +19 -0
  69. data/app/models/concerns/harpiya/user_api_methods.rb +7 -0
  70. data/app/models/harpiya/api_configuration.rb +8 -0
  71. data/app/models/harpiya/api_dependencies.rb +98 -0
  72. data/app/serializers/concerns/harpiya/api/v2/resource_serializer_concern.rb +16 -0
  73. data/app/serializers/harpiya/api/v2/base_serializer.rb +32 -0
  74. data/app/serializers/harpiya/api/v2/platform/address_serializer.rb +15 -0
  75. data/app/serializers/harpiya/api/v2/platform/base_serializer.rb +10 -0
  76. data/app/serializers/harpiya/api/v2/platform/country_serializer.rb +13 -0
  77. data/app/serializers/harpiya/api/v2/platform/image_serializer.rb +11 -0
  78. data/app/serializers/harpiya/api/v2/platform/menu_item_serializer.rb +22 -0
  79. data/app/serializers/harpiya/api/v2/platform/menu_serializer.rb +14 -0
  80. data/app/serializers/harpiya/api/v2/platform/option_type_serializer.rb +13 -0
  81. data/app/serializers/harpiya/api/v2/platform/option_value_serializer.rb +13 -0
  82. data/app/serializers/harpiya/api/v2/platform/product_property_serializer.rb +11 -0
  83. data/app/serializers/harpiya/api/v2/platform/product_serializer.rb +28 -0
  84. data/app/serializers/harpiya/api/v2/platform/state_serializer.rb +13 -0
  85. data/app/serializers/harpiya/api/v2/platform/store_serializer.rb +14 -0
  86. data/app/serializers/harpiya/api/v2/platform/taxon_image_serializer.rb +11 -0
  87. data/app/serializers/harpiya/api/v2/platform/taxon_serializer.rb +37 -0
  88. data/app/serializers/harpiya/api/v2/platform/taxonomy_serializer.rb +11 -0
  89. data/app/serializers/harpiya/api/v2/platform/user_serializer.rb +21 -0
  90. data/app/serializers/harpiya/api/v2/platform/variant_serializer.rb +15 -0
  91. data/app/serializers/harpiya/v2/storefront/address_serializer.rb +20 -0
  92. data/app/serializers/harpiya/v2/storefront/base_serializer.rb +10 -0
  93. data/app/serializers/harpiya/v2/storefront/cart_serializer.rb +36 -0
  94. data/app/serializers/harpiya/v2/storefront/country_serializer.rb +24 -0
  95. data/app/serializers/harpiya/v2/storefront/credit_card_serializer.rb +13 -0
  96. data/app/serializers/harpiya/v2/storefront/estimated_shipping_rate_serializer.rb +29 -0
  97. data/app/serializers/harpiya/v2/storefront/image_serializer.rb +11 -0
  98. data/app/serializers/harpiya/v2/storefront/line_item_serializer.rb +19 -0
  99. data/app/serializers/harpiya/v2/storefront/menu_item_serializer.rb +38 -0
  100. data/app/serializers/harpiya/v2/storefront/menu_serializer.rb +14 -0
  101. data/app/serializers/harpiya/v2/storefront/option_type_serializer.rb +13 -0
  102. data/app/serializers/harpiya/v2/storefront/option_value_serializer.rb +13 -0
  103. data/app/serializers/harpiya/v2/storefront/payment_method_serializer.rb +11 -0
  104. data/app/serializers/harpiya/v2/storefront/payment_serializer.rb +15 -0
  105. data/app/serializers/harpiya/v2/storefront/product_property_serializer.rb +19 -0
  106. data/app/serializers/harpiya/v2/storefront/product_serializer.rb +67 -0
  107. data/app/serializers/harpiya/v2/storefront/promotion_serializer.rb +12 -0
  108. data/app/serializers/harpiya/v2/storefront/shipment_serializer.rb +20 -0
  109. data/app/serializers/harpiya/v2/storefront/shipping_rate_serializer.rb +16 -0
  110. data/app/serializers/harpiya/v2/storefront/state_serializer.rb +11 -0
  111. data/app/serializers/harpiya/v2/storefront/stock_location_serializer.rb +11 -0
  112. data/app/serializers/harpiya/v2/storefront/store_credit_category_serializer.rb +11 -0
  113. data/app/serializers/harpiya/v2/storefront/store_credit_event_serializer.rb +15 -0
  114. data/app/serializers/harpiya/v2/storefront/store_credit_serializer.rb +17 -0
  115. data/app/serializers/harpiya/v2/storefront/store_credit_type_serializer.rb +11 -0
  116. data/app/serializers/harpiya/v2/storefront/store_serializer.rb +23 -0
  117. data/app/serializers/harpiya/v2/storefront/taxon_image_serializer.rb +11 -0
  118. data/app/serializers/harpiya/v2/storefront/taxon_serializer.rb +36 -0
  119. data/app/serializers/harpiya/v2/storefront/taxonomy_serializer.rb +11 -0
  120. data/app/serializers/harpiya/v2/storefront/user_serializer.rb +31 -0
  121. data/app/serializers/harpiya/v2/storefront/variant_serializer.rb +49 -0
  122. data/app/services/harpiya/api/error_handler.rb +40 -0
  123. data/app/views/harpiya/api/errors/gateway_error.rabl +2 -0
  124. data/app/views/harpiya/api/errors/invalid_api_key.rabl +2 -0
  125. data/app/views/harpiya/api/errors/invalid_resource.rabl +3 -0
  126. data/app/views/harpiya/api/errors/must_specify_api_key.rabl +2 -0
  127. data/app/views/harpiya/api/errors/not_found.rabl +2 -0
  128. data/app/views/harpiya/api/errors/unauthorized.rabl +2 -0
  129. data/app/views/harpiya/api/v1/addresses/show.rabl +10 -0
  130. data/app/views/harpiya/api/v1/adjustments/show.rabl +4 -0
  131. data/app/views/harpiya/api/v1/countries/index.rabl +7 -0
  132. data/app/views/harpiya/api/v1/countries/show.rabl +5 -0
  133. data/app/views/harpiya/api/v1/credit_cards/index.rabl +7 -0
  134. data/app/views/harpiya/api/v1/credit_cards/show.rabl +3 -0
  135. data/app/views/harpiya/api/v1/customer_returns/index.rabl +7 -0
  136. data/app/views/harpiya/api/v1/images/index.rabl +4 -0
  137. data/app/views/harpiya/api/v1/images/new.rabl +3 -0
  138. data/app/views/harpiya/api/v1/images/show.rabl +6 -0
  139. data/app/views/harpiya/api/v1/inventory_units/show.rabl +2 -0
  140. data/app/views/harpiya/api/v1/line_items/new.rabl +3 -0
  141. data/app/views/harpiya/api/v1/line_items/show.rabl +14 -0
  142. data/app/views/harpiya/api/v1/option_types/index.rabl +3 -0
  143. data/app/views/harpiya/api/v1/option_types/new.rabl +3 -0
  144. data/app/views/harpiya/api/v1/option_types/show.rabl +5 -0
  145. data/app/views/harpiya/api/v1/option_values/index.rabl +3 -0
  146. data/app/views/harpiya/api/v1/option_values/new.rabl +3 -0
  147. data/app/views/harpiya/api/v1/option_values/show.rabl +2 -0
  148. data/app/views/harpiya/api/v1/orders/address.rabl +0 -0
  149. data/app/views/harpiya/api/v1/orders/canceled.rabl +0 -0
  150. data/app/views/harpiya/api/v1/orders/cart.rabl +0 -0
  151. data/app/views/harpiya/api/v1/orders/complete.rabl +0 -0
  152. data/app/views/harpiya/api/v1/orders/could_not_apply_coupon.rabl +2 -0
  153. data/app/views/harpiya/api/v1/orders/could_not_transition.rabl +3 -0
  154. data/app/views/harpiya/api/v1/orders/index.rabl +7 -0
  155. data/app/views/harpiya/api/v1/orders/insufficient_quantity.rabl +2 -0
  156. data/app/views/harpiya/api/v1/orders/invalid_shipping_method.rabl +2 -0
  157. data/app/views/harpiya/api/v1/orders/mine.rabl +9 -0
  158. data/app/views/harpiya/api/v1/orders/order.rabl +10 -0
  159. data/app/views/harpiya/api/v1/orders/payment.rabl +3 -0
  160. data/app/views/harpiya/api/v1/orders/show.rabl +51 -0
  161. data/app/views/harpiya/api/v1/payments/credit_over_limit.rabl +2 -0
  162. data/app/views/harpiya/api/v1/payments/index.rabl +7 -0
  163. data/app/views/harpiya/api/v1/payments/new.rabl +5 -0
  164. data/app/views/harpiya/api/v1/payments/show.rabl +2 -0
  165. data/app/views/harpiya/api/v1/payments/update_forbidden.rabl +2 -0
  166. data/app/views/harpiya/api/v1/product_properties/index.rabl +7 -0
  167. data/app/views/harpiya/api/v1/product_properties/new.rabl +2 -0
  168. data/app/views/harpiya/api/v1/product_properties/show.rabl +2 -0
  169. data/app/views/harpiya/api/v1/products/index.rabl +9 -0
  170. data/app/views/harpiya/api/v1/products/new.rabl +3 -0
  171. data/app/views/harpiya/api/v1/products/product.rabl +1 -0
  172. data/app/views/harpiya/api/v1/products/show.rabl +36 -0
  173. data/app/views/harpiya/api/v1/promotions/handler.rabl +5 -0
  174. data/app/views/harpiya/api/v1/promotions/show.rabl +2 -0
  175. data/app/views/harpiya/api/v1/properties/index.rabl +7 -0
  176. data/app/views/harpiya/api/v1/properties/new.rabl +2 -0
  177. data/app/views/harpiya/api/v1/properties/show.rabl +2 -0
  178. data/app/views/harpiya/api/v1/reimbursements/index.rabl +7 -0
  179. data/app/views/harpiya/api/v1/return_authorizations/index.rabl +7 -0
  180. data/app/views/harpiya/api/v1/return_authorizations/new.rabl +3 -0
  181. data/app/views/harpiya/api/v1/return_authorizations/show.rabl +2 -0
  182. data/app/views/harpiya/api/v1/shared/stock_location_required.rabl +2 -0
  183. data/app/views/harpiya/api/v1/shipments/big.rabl +48 -0
  184. data/app/views/harpiya/api/v1/shipments/cannot_ready_shipment.rabl +2 -0
  185. data/app/views/harpiya/api/v1/shipments/mine.rabl +9 -0
  186. data/app/views/harpiya/api/v1/shipments/show.rabl +32 -0
  187. data/app/views/harpiya/api/v1/shipments/small.rabl +37 -0
  188. data/app/views/harpiya/api/v1/shipping_rates/show.rabl +2 -0
  189. data/app/views/harpiya/api/v1/states/index.rabl +12 -0
  190. data/app/views/harpiya/api/v1/states/show.rabl +2 -0
  191. data/app/views/harpiya/api/v1/stock_items/index.rabl +7 -0
  192. data/app/views/harpiya/api/v1/stock_items/show.rabl +5 -0
  193. data/app/views/harpiya/api/v1/stock_locations/index.rabl +7 -0
  194. data/app/views/harpiya/api/v1/stock_locations/show.rabl +8 -0
  195. data/app/views/harpiya/api/v1/stock_movements/index.rabl +7 -0
  196. data/app/views/harpiya/api/v1/stock_movements/show.rabl +5 -0
  197. data/app/views/harpiya/api/v1/stores/index.rabl +4 -0
  198. data/app/views/harpiya/api/v1/stores/show.rabl +2 -0
  199. data/app/views/harpiya/api/v1/tags/index.rabl +9 -0
  200. data/app/views/harpiya/api/v1/taxonomies/index.rabl +7 -0
  201. data/app/views/harpiya/api/v1/taxonomies/jstree.rabl +7 -0
  202. data/app/views/harpiya/api/v1/taxonomies/nested.rabl +11 -0
  203. data/app/views/harpiya/api/v1/taxonomies/new.rabl +3 -0
  204. data/app/views/harpiya/api/v1/taxonomies/show.rabl +15 -0
  205. data/app/views/harpiya/api/v1/taxons/index.rabl +10 -0
  206. data/app/views/harpiya/api/v1/taxons/jstree.rabl +7 -0
  207. data/app/views/harpiya/api/v1/taxons/new.rabl +3 -0
  208. data/app/views/harpiya/api/v1/taxons/show.rabl +6 -0
  209. data/app/views/harpiya/api/v1/taxons/taxons.rabl +5 -0
  210. data/app/views/harpiya/api/v1/users/index.rabl +7 -0
  211. data/app/views/harpiya/api/v1/users/new.rabl +3 -0
  212. data/app/views/harpiya/api/v1/users/show.rabl +11 -0
  213. data/app/views/harpiya/api/v1/variants/big.rabl +14 -0
  214. data/app/views/harpiya/api/v1/variants/index.rabl +9 -0
  215. data/app/views/harpiya/api/v1/variants/new.rabl +2 -0
  216. data/app/views/harpiya/api/v1/variants/show.rabl +3 -0
  217. data/app/views/harpiya/api/v1/variants/small.rabl +18 -0
  218. data/app/views/harpiya/api/v1/zones/index.rabl +7 -0
  219. data/app/views/harpiya/api/v1/zones/show.rabl +6 -0
  220. data/config/initializers/doorkeeper.rb +48 -0
  221. data/config/initializers/json_api_mime_types.rb +8 -0
  222. data/config/initializers/rabl.rb +9 -0
  223. data/config/initializers/user_class_extensions.rb +7 -0
  224. data/config/locales/en.yml +36 -0
  225. data/config/routes.rb +295 -0
  226. data/db/migrate/20100107141738_add_api_key_to_harpiya_users.rb +7 -0
  227. data/db/migrate/20120411123334_resize_api_key_field.rb +7 -0
  228. data/db/migrate/20120530054546_rename_api_key_to_harpiya_api_key.rb +7 -0
  229. data/db/migrate/20131017162334_add_index_to_user_harpiya_api_key.rb +7 -0
  230. data/db/migrate/20180320110726_create_doorkeeper_tables.rb +69 -0
  231. data/docs/oauth/index.yml +140 -0
  232. data/docs/v2/platform/index.yaml +599 -0
  233. data/docs/v2/storefront/index.yaml +5585 -0
  234. data/harpiya_api.gemspec +36 -0
  235. data/lib/harpiya/api.rb +11 -0
  236. data/lib/harpiya/api/controller_setup.rb +19 -0
  237. data/lib/harpiya/api/engine.rb +30 -0
  238. data/lib/harpiya/api/responders.rb +11 -0
  239. data/lib/harpiya/api/responders/rabl_template.rb +28 -0
  240. data/lib/harpiya/api/testing_support/caching.rb +10 -0
  241. data/lib/harpiya/api/testing_support/helpers.rb +44 -0
  242. data/lib/harpiya/api/testing_support/setup.rb +16 -0
  243. data/lib/harpiya/api/testing_support/v2/base.rb +13 -0
  244. data/lib/harpiya/api/testing_support/v2/current_order.rb +79 -0
  245. data/lib/harpiya/api/testing_support/v2/platform_contexts.rb +213 -0
  246. data/lib/harpiya_api.rb +4 -0
  247. data/script/rails +9 -0
  248. data/spec/fixtures/thinking-cat.jpg +0 -0
  249. metadata +418 -0
@@ -0,0 +1,140 @@
1
+ openapi: 3.0.0
2
+ servers:
3
+ - url: 'https://demo.harpiyacommerce.org'
4
+ description: demo
5
+ - url: 'http://localhost:3000'
6
+ description: localhost
7
+ info:
8
+ version: 1.0.0
9
+ title: Harpiya OAuth 2.0 Authentication
10
+ description: "For API v2 Harpiya uses [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) gem for handling OAuth athentication. \n\nHarpiya supports new token creation and refreshing of existing tokens."
11
+ contact:
12
+ name: Spark Solutions
13
+ url: 'https://sparksolutions.co'
14
+ email: we@sparksolutions.co
15
+ license:
16
+ url: 'https://github.com/harpiya/harpiya/blob/master/license.md'
17
+ name: BSD-3-Clause
18
+ paths:
19
+ /harpiya_oauth/token:
20
+ post:
21
+ description: Creates or refreshes a Bearer token required to authorize calls API calls
22
+ tags:
23
+ - Token
24
+ operationId: Create or Refresh Token
25
+ responses:
26
+ '200':
27
+ description: Token was succesfully created or refreshed
28
+ content:
29
+ application/json:
30
+ schema:
31
+ $ref: '#/components/schemas/Token'
32
+ examples:
33
+ create token:
34
+ value:
35
+ access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjA
36
+ token_type: Bearer
37
+ expires_in: 7200
38
+ refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
39
+ created_at: 1581873931
40
+ refresh token:
41
+ value:
42
+ access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98
43
+ token_type: Bearer
44
+ expires_in: 7200
45
+ refresh_token: j92BxulqIIYtiiaBsuAM1TzGsGSVxaykT4kk8OYHGNY
46
+ created_at: 1581876572
47
+ requestBody:
48
+ required: true
49
+ content:
50
+ application/json:
51
+ schema:
52
+ oneOf:
53
+ - $ref: '#/components/schemas/CreateTokenBody'
54
+ - $ref: '#/components/schemas/RefreshTokenBody'
55
+ examples:
56
+ create token:
57
+ value:
58
+ grant_type: password
59
+ username: harpiya@example.com
60
+ password: harpiya123
61
+ refresh token:
62
+ value:
63
+ grant_type: refresh_token
64
+ refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
65
+ description: ''
66
+ components:
67
+ schemas:
68
+ Token:
69
+ properties:
70
+ access_token:
71
+ type: string
72
+ example: 2480c16561d1391ea81ca5336b651e9a29f4524f6dee8c7f3f02a600159189c3
73
+ token_type:
74
+ type: string
75
+ example: Bearer
76
+ default: Bearer
77
+ expires_in:
78
+ type: integer
79
+ example: 7200
80
+ description: Time (in seconds) after which the access token will expire
81
+ refresh_token:
82
+ type: string
83
+ example: f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c
84
+ created_at:
85
+ type: integer
86
+ example: 1539863418
87
+ x-examples:
88
+ create token:
89
+ access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjA
90
+ token_type: Bearer
91
+ expires_in: 7200
92
+ refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
93
+ created_at: 1581873931
94
+ refresh token:
95
+ access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98
96
+ token_type: Bearer
97
+ expires_in: 7200
98
+ refresh_token: j92BxulqIIYtiiaBsuAM1TzGsGSVxaykT4kk8OYHGNY
99
+ created_at: 1581876572
100
+ CreateTokenBody:
101
+ type: object
102
+ x-examples:
103
+ example-1:
104
+ grant_type: password
105
+ username: harpiya@example.com
106
+ password: harpiya123
107
+ properties:
108
+ grant_type:
109
+ type: string
110
+ default: password
111
+ description: Use `password` to create a token and `refresh_token` to refresh it
112
+ username:
113
+ type: string
114
+ description: User email address
115
+ example: harpiya@example.com
116
+ password:
117
+ type: string
118
+ description: User password
119
+ example: harpiya123
120
+ required:
121
+ - grant_type
122
+ - username
123
+ - password
124
+ RefreshTokenBody:
125
+ type: object
126
+ properties:
127
+ grant_type:
128
+ type: string
129
+ default: refresh_token
130
+ refresh_token:
131
+ type: string
132
+ description: Refresh token obtained from the create token response
133
+ example: "27af95fd57a424e5d01aaf5eab1324a8d5c0ca57daf384fae39f811a5144330143301'"
134
+ required:
135
+ - grant_type
136
+ - refresh_token
137
+ x-examples:
138
+ example-1:
139
+ grant_type: refresh_token
140
+ refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
@@ -0,0 +1,599 @@
1
+ ---
2
+ openapi: 3.0.1
3
+ info:
4
+ title: Platform API V2
5
+ version: v2
6
+ paths:
7
+ "/api/v2/platform/addresses":
8
+ get:
9
+ summary: Returns a list of an Addresses
10
+ tags:
11
+ - Addresses
12
+ security:
13
+ - bearer_auth: []
14
+ parameters:
15
+ - name: page
16
+ in: query
17
+ example: 1
18
+ schema:
19
+ type: integer
20
+ - name: per_page
21
+ in: query
22
+ example: 50
23
+ schema:
24
+ type: integer
25
+ - name: include
26
+ in: query
27
+ descripton: 'Select which associated resources you would like to fetch, see:
28
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
29
+ example: user,country,state
30
+ schema:
31
+ type: string
32
+ - name: filter
33
+ in: query
34
+ descripton: ''
35
+ example: user_id_eq=1&firstname_cont=Joh
36
+ schema:
37
+ type: string
38
+ responses:
39
+ '200':
40
+ description: Records returned
41
+ content:
42
+ application/json:
43
+ example:
44
+ data:
45
+ - id: '1'
46
+ type: address
47
+ attributes:
48
+ firstname: John
49
+ lastname: Doe
50
+ address1: 10 Lovely Street
51
+ address2: Northwest
52
+ city: Herndon
53
+ zipcode: '35005'
54
+ phone: 555-555-0199
55
+ state_name:
56
+ alternative_phone: 555-555-0199
57
+ company: Company
58
+ created_at: '2021-04-01T18:55:03.630Z'
59
+ updated_at: '2021-04-01T18:55:03.630Z'
60
+ deleted_at:
61
+ label:
62
+ relationships:
63
+ country:
64
+ data:
65
+ id: '1'
66
+ type: country
67
+ state:
68
+ data:
69
+ id: '1'
70
+ type: state
71
+ user:
72
+ data:
73
+ - id: '2'
74
+ type: address
75
+ attributes:
76
+ firstname: John
77
+ lastname: Doe
78
+ address1: 10 Lovely Street
79
+ address2: Northwest
80
+ city: Herndon
81
+ zipcode: '35005'
82
+ phone: 555-555-0199
83
+ state_name:
84
+ alternative_phone: 555-555-0199
85
+ company: Company
86
+ created_at: '2021-04-01T18:55:03.634Z'
87
+ updated_at: '2021-04-01T18:55:03.634Z'
88
+ deleted_at:
89
+ label:
90
+ relationships:
91
+ country:
92
+ data:
93
+ id: '1'
94
+ type: country
95
+ state:
96
+ data:
97
+ id: '2'
98
+ type: state
99
+ user:
100
+ data:
101
+ meta:
102
+ count: 2
103
+ total_count: 2
104
+ total_pages: 1
105
+ links:
106
+ self: http://www.example.com/api/v2/platform/addresses?page=1&per_page=&include=&filter=
107
+ next: http://www.example.com/api/v2/platform/addresses?include=&page=1&per_page=
108
+ prev: http://www.example.com/api/v2/platform/addresses?include=&page=1&per_page=
109
+ last: http://www.example.com/api/v2/platform/addresses?include=&page=1&per_page=
110
+ first: http://www.example.com/api/v2/platform/addresses?include=&page=1&per_page=
111
+ '401':
112
+ description: Authentication Failed
113
+ content:
114
+ application/json:
115
+ example:
116
+ error: The access token is invalid
117
+ post:
118
+ summary: Creates an Address
119
+ tags:
120
+ - Addresses
121
+ security:
122
+ - bearer_auth: []
123
+ parameters:
124
+ - name: include
125
+ in: query
126
+ descripton: 'Select which associated resources you would like to fetch, see:
127
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
128
+ example: user,country,state
129
+ schema:
130
+ type: string
131
+ responses:
132
+ '201':
133
+ description: record created
134
+ content:
135
+ application/json:
136
+ example:
137
+ data:
138
+ id: '1'
139
+ type: address
140
+ attributes:
141
+ firstname: John
142
+ lastname: Doe
143
+ address1: 10 Lovely Street
144
+ address2: Northwest
145
+ city: Herndon
146
+ zipcode: '35005'
147
+ phone: 555-555-0199
148
+ state_name:
149
+ alternative_phone: 555-555-0199
150
+ company: Company
151
+ created_at: '2021-04-01T18:55:03.796Z'
152
+ updated_at: '2021-04-01T18:55:03.796Z'
153
+ deleted_at:
154
+ label:
155
+ relationships:
156
+ country:
157
+ data:
158
+ id: '1'
159
+ type: country
160
+ state:
161
+ data:
162
+ id: '1'
163
+ type: state
164
+ user:
165
+ data:
166
+ id: '1'
167
+ type: user
168
+ '422':
169
+ description: invalid request
170
+ content:
171
+ application/json:
172
+ example:
173
+ error: First Name can't be blank, Last Name can't be blank, Address
174
+ can't be blank, City can't be blank, Country can't be blank, Zip
175
+ Code can't be blank, and Phone can't be blank
176
+ errors:
177
+ firstname:
178
+ - can't be blank
179
+ lastname:
180
+ - can't be blank
181
+ address1:
182
+ - can't be blank
183
+ city:
184
+ - can't be blank
185
+ country:
186
+ - can't be blank
187
+ zipcode:
188
+ - can't be blank
189
+ phone:
190
+ - can't be blank
191
+ requestBody:
192
+ content:
193
+ application/json:
194
+ schema:
195
+ "$ref": "#/components/schemas/address_params"
196
+ "/api/v2/platform/addresses/{id}":
197
+ get:
198
+ summary: Returns an Address
199
+ tags:
200
+ - Addresses
201
+ security:
202
+ - bearer_auth: []
203
+ parameters:
204
+ - name: id
205
+ in: path
206
+ required: true
207
+ schema:
208
+ type: string
209
+ - name: include
210
+ in: query
211
+ descripton: 'Select which associated resources you would like to fetch, see:
212
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
213
+ example: user,country,state
214
+ schema:
215
+ type: string
216
+ responses:
217
+ '200':
218
+ description: Record found
219
+ content:
220
+ application/json:
221
+ example:
222
+ data:
223
+ id: '1'
224
+ type: address
225
+ attributes:
226
+ firstname: John
227
+ lastname: Doe
228
+ address1: 10 Lovely Street
229
+ address2: Northwest
230
+ city: Herndon
231
+ zipcode: '35005'
232
+ phone: 555-555-0199
233
+ state_name:
234
+ alternative_phone: 555-555-0199
235
+ company: Company
236
+ created_at: '2021-04-01T18:55:03.828Z'
237
+ updated_at: '2021-04-01T18:55:03.828Z'
238
+ deleted_at:
239
+ label:
240
+ relationships:
241
+ country:
242
+ data:
243
+ id: '1'
244
+ type: country
245
+ state:
246
+ data:
247
+ id: '1'
248
+ type: state
249
+ user:
250
+ data:
251
+ '404':
252
+ description: Record not found
253
+ content:
254
+ application/json:
255
+ example:
256
+ error: The resource you were looking for could not be found.
257
+ '401':
258
+ description: Authentication Failed
259
+ content:
260
+ application/json:
261
+ example:
262
+ error: The access token is invalid
263
+ put:
264
+ summary: Updates an Address
265
+ tags:
266
+ - Addresses
267
+ security:
268
+ - bearer_auth: []
269
+ parameters:
270
+ - name: id
271
+ in: path
272
+ required: true
273
+ schema:
274
+ type: string
275
+ - name: include
276
+ in: query
277
+ descripton: 'Select which associated resources you would like to fetch, see:
278
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
279
+ example: user,country,state
280
+ schema:
281
+ type: string
282
+ responses:
283
+ '200':
284
+ description: record updated
285
+ content:
286
+ application/json:
287
+ example:
288
+ data:
289
+ id: '1'
290
+ type: address
291
+ attributes:
292
+ firstname: Jack
293
+ lastname: Doe
294
+ address1: 10 Lovely Street
295
+ address2: Northwest
296
+ city: Herndon
297
+ zipcode: '35005'
298
+ phone: 555-555-0199
299
+ state_name:
300
+ alternative_phone: 555-555-0199
301
+ company: Company
302
+ created_at: '2021-04-01T18:55:03.885Z'
303
+ updated_at: '2021-04-01T18:55:03.895Z'
304
+ deleted_at:
305
+ label:
306
+ relationships:
307
+ country:
308
+ data:
309
+ id: '1'
310
+ type: country
311
+ state:
312
+ data:
313
+ id: '1'
314
+ type: state
315
+ user:
316
+ data:
317
+ '422':
318
+ description: invalid request
319
+ content:
320
+ application/json:
321
+ example:
322
+ error: First Name can't be blank and Last Name can't be blank
323
+ errors:
324
+ firstname:
325
+ - can't be blank
326
+ lastname:
327
+ - can't be blank
328
+ '404':
329
+ description: Record not found
330
+ content:
331
+ application/json:
332
+ example:
333
+ error: The resource you were looking for could not be found.
334
+ '401':
335
+ description: Authentication Failed
336
+ content:
337
+ application/json:
338
+ example:
339
+ error: The access token is invalid
340
+ requestBody:
341
+ content:
342
+ application/json:
343
+ schema:
344
+ "$ref": "#/components/schemas/address_params"
345
+ delete:
346
+ summary: Deletes an Address
347
+ tags:
348
+ - Addresses
349
+ security:
350
+ - bearer_auth: []
351
+ parameters:
352
+ - name: id
353
+ in: path
354
+ required: true
355
+ schema:
356
+ type: string
357
+ responses:
358
+ '204':
359
+ description: Record deleted
360
+ '404':
361
+ description: Record not found
362
+ content:
363
+ application/json:
364
+ example:
365
+ error: The resource you were looking for could not be found.
366
+ '401':
367
+ description: Authentication Failed
368
+ content:
369
+ application/json:
370
+ example:
371
+ error: The access token is invalid
372
+ "/api/v2/platform/countries":
373
+ get:
374
+ summary: Returns a list of Countries
375
+ tags:
376
+ - Countries
377
+ security:
378
+ - bearer_auth: []
379
+ responses:
380
+ '200':
381
+ description: Records returned
382
+ content:
383
+ application/json:
384
+ example:
385
+ data:
386
+ - id: '1'
387
+ type: country
388
+ attributes:
389
+ iso_name: ISO_NAME_11
390
+ iso: I11
391
+ iso3: IS11
392
+ name: NAME_11
393
+ numcode: 840
394
+ states_required: false
395
+ updated_at: '2021-04-01T18:55:04.007Z'
396
+ zipcode_required: true
397
+ relationships:
398
+ states:
399
+ data: []
400
+ - id: '2'
401
+ type: country
402
+ attributes:
403
+ iso_name: ISO_NAME_12
404
+ iso: I12
405
+ iso3: IS12
406
+ name: NAME_12
407
+ numcode: 840
408
+ states_required: false
409
+ updated_at: '2021-04-01T18:55:04.009Z'
410
+ zipcode_required: true
411
+ relationships:
412
+ states:
413
+ data: []
414
+ meta:
415
+ count: 2
416
+ total_count: 2
417
+ total_pages: 1
418
+ links:
419
+ self: http://www.example.com/api/v2/platform/countries
420
+ next: http://www.example.com/api/v2/platform/countries?page=1
421
+ prev: http://www.example.com/api/v2/platform/countries?page=1
422
+ last: http://www.example.com/api/v2/platform/countries?page=1
423
+ first: http://www.example.com/api/v2/platform/countries?page=1
424
+ '401':
425
+ description: Authentication Failed
426
+ content:
427
+ application/json:
428
+ example:
429
+ error: The access token is invalid
430
+ "/api/v2/platform/countries/{id}":
431
+ get:
432
+ summary: Returns a Country
433
+ tags:
434
+ - Countries
435
+ security:
436
+ - bearer_auth: []
437
+ parameters:
438
+ - name: id
439
+ in: path
440
+ required: true
441
+ schema:
442
+ type: string
443
+ responses:
444
+ '200':
445
+ description: Record found
446
+ content:
447
+ application/json:
448
+ example:
449
+ data:
450
+ id: '1'
451
+ type: country
452
+ attributes:
453
+ iso_name: ISO_NAME_15
454
+ iso: I15
455
+ iso3: IS15
456
+ name: NAME_15
457
+ numcode: 840
458
+ states_required: false
459
+ updated_at: '2021-04-01T18:55:04.046Z'
460
+ zipcode_required: true
461
+ relationships:
462
+ states:
463
+ data: []
464
+ '404':
465
+ description: Record not found
466
+ content:
467
+ application/json:
468
+ example:
469
+ error: The resource you were looking for could not be found.
470
+ '401':
471
+ description: Authentication Failed
472
+ content:
473
+ application/json:
474
+ example:
475
+ error: The access token is invalid
476
+ servers:
477
+ - url: https://{defaultHost}
478
+ variables:
479
+ defaultHost:
480
+ default: localhost:3000
481
+ components:
482
+ securitySchemes:
483
+ bearer_auth:
484
+ type: http
485
+ scheme: bearer
486
+ schemas:
487
+ address_params:
488
+ type: object
489
+ properties:
490
+ country_id:
491
+ type: integer
492
+ state_id:
493
+ type: integer
494
+ state_name:
495
+ type: string
496
+ address1:
497
+ type: string
498
+ city:
499
+ type: string
500
+ zipcode:
501
+ type: string
502
+ phone:
503
+ type: string
504
+ alternative_phone:
505
+ type: string
506
+ firstname:
507
+ type: string
508
+ lastname:
509
+ type: string
510
+ label:
511
+ type: string
512
+ company:
513
+ type: string
514
+ user_id:
515
+ type: integer
516
+ resources_list:
517
+ type: object
518
+ properties:
519
+ data:
520
+ type: array
521
+ items:
522
+ allOf:
523
+ - "$ref": "#/components/schemas/resource_properties"
524
+ meta:
525
+ type: object
526
+ properties:
527
+ count:
528
+ type: integer
529
+ total_count:
530
+ type: integer
531
+ total_pages:
532
+ type: integer
533
+ required:
534
+ - count
535
+ - total_count
536
+ - total_pages
537
+ links:
538
+ type: object
539
+ properties:
540
+ self:
541
+ type: string
542
+ next:
543
+ type: string
544
+ prev:
545
+ type: string
546
+ last:
547
+ type: string
548
+ first:
549
+ type: string
550
+ required:
551
+ - self
552
+ - next
553
+ - prev
554
+ - last
555
+ - first
556
+ required:
557
+ - data
558
+ - meta
559
+ - links
560
+ resource_properties:
561
+ type: object
562
+ properties:
563
+ id:
564
+ type: string
565
+ type:
566
+ type: string
567
+ attributes:
568
+ type: object
569
+ relationships:
570
+ type: object
571
+ required:
572
+ - id
573
+ - type
574
+ - attributes
575
+ - relationships
576
+ resource:
577
+ type: object
578
+ properties:
579
+ data:
580
+ "$ref": "#/components/schemas/resource_properties"
581
+ required:
582
+ - data
583
+ error:
584
+ type: object
585
+ properties:
586
+ error:
587
+ type: string
588
+ required:
589
+ - error
590
+ validation_errors:
591
+ type: object
592
+ properties:
593
+ error:
594
+ type: string
595
+ errors:
596
+ type: object
597
+ required:
598
+ - error
599
+ - errors