workarea-api 4.4.7 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +35 -0
  3. data/.github/workflows/ci.yml +35 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +2 -0
  6. data/.stylelintrc.json +8 -0
  7. data/CHANGELOG.md +15 -11
  8. data/Gemfile +3 -2
  9. data/README.md +13 -0
  10. data/Rakefile +14 -5
  11. data/admin/app/controllers/workarea/api/admin/categories_controller.rb +6 -0
  12. data/admin/app/controllers/workarea/api/admin/content_assets_controller.rb +6 -0
  13. data/admin/app/controllers/workarea/api/admin/content_controller.rb +6 -0
  14. data/admin/app/controllers/workarea/api/admin/discounts_controller.rb +7 -0
  15. data/admin/app/controllers/workarea/api/admin/email_signups_controller.rb +20 -4
  16. data/admin/app/controllers/workarea/api/admin/fulfillments_controller.rb +6 -1
  17. data/admin/app/controllers/workarea/api/admin/inventory_skus_controller.rb +7 -0
  18. data/admin/app/controllers/workarea/api/admin/navigation_menus_controller.rb +7 -0
  19. data/admin/app/controllers/workarea/api/admin/navigation_taxons_controller.rb +7 -0
  20. data/admin/app/controllers/workarea/api/admin/orders_controller.rb +19 -1
  21. data/admin/app/controllers/workarea/api/admin/pages_controller.rb +7 -0
  22. data/admin/app/controllers/workarea/api/admin/payment_profiles_controller.rb +7 -0
  23. data/admin/app/controllers/workarea/api/admin/payment_transactions_controller.rb +7 -0
  24. data/admin/app/controllers/workarea/api/admin/payments_controller.rb +7 -0
  25. data/admin/app/controllers/workarea/api/admin/pricing_skus_controller.rb +7 -0
  26. data/admin/app/controllers/workarea/api/admin/products_controller.rb +11 -4
  27. data/admin/app/controllers/workarea/api/admin/promo_code_lists_controller.rb +7 -0
  28. data/admin/app/controllers/workarea/api/admin/redirects_controller.rb +7 -0
  29. data/admin/app/controllers/workarea/api/admin/releases_controller.rb +7 -0
  30. data/admin/app/controllers/workarea/api/admin/shipping_services_controller.rb +7 -0
  31. data/admin/app/controllers/workarea/api/admin/shippings_controller.rb +7 -0
  32. data/admin/app/controllers/workarea/api/admin/swagger_controller.rb +33 -0
  33. data/admin/app/controllers/workarea/api/admin/tax_categories_controller.rb +2 -0
  34. data/admin/app/controllers/workarea/api/admin/users_controller.rb +28 -14
  35. data/admin/app/models/workarea/api/admin/date_filtering.rb +27 -0
  36. data/admin/lib/workarea/api/admin/engine.rb +11 -0
  37. data/admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb +14 -2
  38. data/admin/test/documentation/workarea/api/admin/global_functionality_documentation_test.rb +140 -0
  39. data/admin/test/documentation/workarea/api/admin/orders_documentation_test.rb +13 -6
  40. data/admin/test/documentation/workarea/api/admin/users_documentation_test.rb +14 -2
  41. data/admin/test/dummy/config/initializers/session_store.rb +3 -1
  42. data/admin/test/integration/workarea/api/admin/categories_integration_test.rb +32 -0
  43. data/admin/test/integration/workarea/api/admin/content_assets_integration_test.rb +32 -0
  44. data/admin/test/integration/workarea/api/admin/content_integration_test.rb +32 -0
  45. data/admin/test/integration/workarea/api/admin/discounts_integration_test.rb +32 -0
  46. data/admin/test/integration/workarea/api/admin/email_signups_integration_test.rb +38 -1
  47. data/admin/test/integration/workarea/api/admin/fulfillments_integration_test.rb +22 -0
  48. data/admin/test/integration/workarea/api/admin/inventory_skus_integration_test.rb +32 -0
  49. data/admin/test/integration/workarea/api/admin/navigation_menus_integration_test.rb +32 -0
  50. data/admin/test/integration/workarea/api/admin/navigation_taxons_integration_test.rb +32 -0
  51. data/admin/test/integration/workarea/api/admin/orders_integration_test.rb +41 -2
  52. data/admin/test/integration/workarea/api/admin/pages_integration_test.rb +32 -0
  53. data/admin/test/integration/workarea/api/admin/payment_profiles_integration_test.rb +32 -0
  54. data/admin/test/integration/workarea/api/admin/payment_transactions_integration_test.rb +32 -0
  55. data/admin/test/integration/workarea/api/admin/payments_integration_test.rb +32 -0
  56. data/admin/test/integration/workarea/api/admin/pricing_skus_integration_test.rb +32 -0
  57. data/admin/test/integration/workarea/api/admin/products_integration_test.rb +35 -0
  58. data/admin/test/integration/workarea/api/admin/promo_code_lists_integration_test.rb +31 -0
  59. data/admin/test/integration/workarea/api/admin/redirects_integration_test.rb +31 -0
  60. data/admin/test/integration/workarea/api/admin/releases_integration_test.rb +31 -0
  61. data/admin/test/integration/workarea/api/admin/shipping_services_integration_test.rb +31 -0
  62. data/admin/test/integration/workarea/api/admin/shippings_integration_test.rb +31 -0
  63. data/admin/test/integration/workarea/api/admin/tax_categories_integration_test.rb +31 -0
  64. data/admin/test/integration/workarea/api/admin/users_integration_test.rb +44 -1
  65. data/app/views/workarea/api/docs/nav.haml +12 -0
  66. data/doc/api/admin/categories/bulk_upserting_categories.json +8 -4
  67. data/doc/api/admin/categories/creating_a_category.json +11 -8
  68. data/doc/api/admin/categories/listing_categories.json +8 -5
  69. data/doc/api/admin/categories/removing_a_category.json +8 -4
  70. data/doc/api/admin/categories/showing_a_category.json +10 -7
  71. data/doc/api/admin/categories/updating_a_category.json +9 -5
  72. data/doc/api/admin/category_product_rules/creating_a_category_product_rule.json +11 -8
  73. data/doc/api/admin/category_product_rules/listing_category_product_rules.json +10 -7
  74. data/doc/api/admin/category_product_rules/removing_a_category_product_rule.json +8 -4
  75. data/doc/api/admin/category_product_rules/updating_a_category_product_rule.json +8 -4
  76. data/doc/api/admin/content/bulk_upserting_content.json +8 -4
  77. data/doc/api/admin/content/creating_content.json +11 -8
  78. data/doc/api/admin/content/listing_content.json +8 -5
  79. data/doc/api/admin/content/showing_content.json +10 -7
  80. data/doc/api/admin/content/updating_content.json +8 -4
  81. data/doc/api/admin/content_assets/bulk_upserting_content_assets.json +8 -4
  82. data/doc/api/admin/content_assets/creating_a_content_asset.json +11 -8
  83. data/doc/api/admin/content_assets/listing_content_assets.json +8 -5
  84. data/doc/api/admin/content_assets/removing_a_content_asset.json +8 -4
  85. data/doc/api/admin/content_assets/showing_a_content_asset.json +10 -7
  86. data/doc/api/admin/content_assets/updating_a_content_asset.json +9 -5
  87. data/doc/api/admin/discounts/creating_a_discount.json +11 -8
  88. data/doc/api/admin/discounts/listing_discounts.json +8 -5
  89. data/doc/api/admin/discounts/removing_a_discount.json +8 -4
  90. data/doc/api/admin/discounts/showing_a_discount.json +10 -7
  91. data/doc/api/admin/discounts/updating_discounts.json +8 -4
  92. data/doc/api/admin/email_signups/listing_email_signups.json +7 -4
  93. data/doc/api/admin/email_signups/showing_an_email_signup.json +10 -12
  94. data/doc/api/admin/fulfillment/listing_fulfillments.json +7 -4
  95. data/doc/api/admin/fulfillment/marking_items_as_canceled.json +9 -6
  96. data/doc/api/admin/fulfillment/marking_items_as_shipped.json +9 -6
  97. data/doc/api/admin/fulfillment/showing_fulfillment.json +7 -4
  98. data/doc/api/admin/index.json +653 -578
  99. data/doc/api/admin/inventory_skus/bulk_upserting_inventory_skus.json +8 -4
  100. data/doc/api/admin/inventory_skus/creating_an_inventory_sku.json +9 -6
  101. data/doc/api/admin/inventory_skus/listing_inventory_skus.json +7 -4
  102. data/doc/api/admin/inventory_skus/removing_an_inventory_sku.json +6 -2
  103. data/doc/api/admin/inventory_skus/showing_an_inventory_sku.json +7 -4
  104. data/doc/api/admin/inventory_skus/updating_an_inventory_sku.json +6 -2
  105. data/doc/api/admin/navigation_menus/creating_a_menu.json +11 -8
  106. data/doc/api/admin/navigation_menus/listing_menus.json +8 -5
  107. data/doc/api/admin/navigation_menus/removing_a_navigation_menu.json +8 -4
  108. data/doc/api/admin/navigation_menus/showing_a_navigation_menu.json +10 -7
  109. data/doc/api/admin/navigation_menus/updating_a_navigation_menus.json +8 -4
  110. data/doc/api/admin/navigation_taxonomy/bulk_upserting_navigation_taxons.json +8 -4
  111. data/doc/api/admin/navigation_taxonomy/creating_a_taxon.json +10 -7
  112. data/doc/api/admin/navigation_taxonomy/listing_taxons.json +7 -4
  113. data/doc/api/admin/navigation_taxonomy/removing_a_navigation_taxon.json +8 -4
  114. data/doc/api/admin/navigation_taxonomy/showing_a_navigation_taxon.json +9 -6
  115. data/doc/api/admin/navigation_taxonomy/updating_a_navigation_taxons.json +8 -4
  116. data/doc/api/admin/orders/listing_orders.json +8 -5
  117. data/doc/api/admin/orders/showing_an_order.json +8 -5
  118. data/doc/api/admin/pages/bulk_upserting_pages.json +8 -4
  119. data/doc/api/admin/pages/creating_a_page.json +11 -8
  120. data/doc/api/admin/pages/listing_pages.json +8 -5
  121. data/doc/api/admin/pages/removing_a_page.json +8 -4
  122. data/doc/api/admin/pages/showing_a_page.json +10 -7
  123. data/doc/api/admin/pages/updating_a_page.json +9 -5
  124. data/doc/api/admin/payment_profiles/bulk_upserting_payment_profiles.json +8 -4
  125. data/doc/api/admin/payment_profiles/creating_a_payment_profile.json +10 -7
  126. data/doc/api/admin/payment_profiles/listing_payment_profiles.json +7 -4
  127. data/doc/api/admin/payment_profiles/removing_a_payment_profile.json +8 -4
  128. data/doc/api/admin/payment_profiles/showing_a_payment_profile.json +9 -6
  129. data/doc/api/admin/payment_profiles/updating_a_payment_profiles.json +8 -4
  130. data/doc/api/admin/payment_transactions/listing_payment_transactions.json +7 -4
  131. data/doc/api/admin/payment_transactions/showing_a_payment_transaction.json +9 -6
  132. data/doc/api/admin/payments/listing_payments.json +7 -4
  133. data/doc/api/admin/payments/showing_an_payment.json +7 -4
  134. data/doc/api/admin/prices/creating_a_pricing_sku_price.json +8 -5
  135. data/doc/api/admin/prices/listing_pricing_sku_prices.json +8 -5
  136. data/doc/api/admin/prices/removing_a_pricing_sku_price.json +8 -4
  137. data/doc/api/admin/prices/updating_a_pricing_sku_price.json +8 -4
  138. data/doc/api/admin/pricing_skus/bulk_upserting_pricing_skus.json +8 -4
  139. data/doc/api/admin/pricing_skus/creating_an_pricing_sku.json +10 -7
  140. data/doc/api/admin/pricing_skus/listing_pricing_skus.json +8 -5
  141. data/doc/api/admin/pricing_skus/removing_an_pricing_sku.json +6 -2
  142. data/doc/api/admin/pricing_skus/showing_an_pricing_sku.json +8 -5
  143. data/doc/api/admin/pricing_skus/updating_an_pricing_sku.json +6 -2
  144. data/doc/api/admin/product_images/creating_a_product_image_from_base64.json +11 -8
  145. data/doc/api/admin/product_images/creating_a_product_image_from_url.json +11 -8
  146. data/doc/api/admin/product_images/listing_product_images.json +10 -7
  147. data/doc/api/admin/product_images/removing_a_product_image.json +8 -4
  148. data/doc/api/admin/product_images/updating_a_product_image.json +8 -4
  149. data/doc/api/admin/products/bulk_upserting_products.json +8 -4
  150. data/doc/api/admin/products/creating_a_product.json +11 -8
  151. data/doc/api/admin/products/listing_products.json +8 -5
  152. data/doc/api/admin/products/removing_a_product.json +8 -4
  153. data/doc/api/admin/products/showing_a_product.json +10 -7
  154. data/doc/api/admin/products/updating_a_product.json +9 -5
  155. data/doc/api/admin/promo_code_lists/bulk_upserting_promo_code_lists.json +8 -4
  156. data/doc/api/admin/promo_code_lists/creating_a_promo_code_list.json +10 -7
  157. data/doc/api/admin/promo_code_lists/listing_promo_code_lists.json +7 -4
  158. data/doc/api/admin/promo_code_lists/removing_a_promo_code_list.json +8 -4
  159. data/doc/api/admin/promo_code_lists/showing_a_promo_code_list.json +9 -6
  160. data/doc/api/admin/promo_code_lists/updating_a_promo_code_list.json +8 -4
  161. data/doc/api/admin/recommendation_settings/showing_recommendation_settings.json +9 -6
  162. data/doc/api/admin/recommendation_settings/updating_recommendation_settings.json +8 -4
  163. data/doc/api/admin/redirects/bulk_upserting_redirects.json +8 -4
  164. data/doc/api/admin/redirects/creating_a_redirect.json +10 -7
  165. data/doc/api/admin/redirects/listing_redirects.json +7 -4
  166. data/doc/api/admin/redirects/removing_a_redirect.json +8 -4
  167. data/doc/api/admin/redirects/showing_a_redirect.json +9 -6
  168. data/doc/api/admin/redirects/updating_a_redirects.json +8 -4
  169. data/doc/api/admin/release_changes/adding_changes_to_a_release.json +10 -6
  170. data/doc/api/admin/releases/bulk_upserting_releases.json +8 -4
  171. data/doc/api/admin/releases/creating_a_release.json +11 -8
  172. data/doc/api/admin/releases/listing_releases.json +8 -5
  173. data/doc/api/admin/releases/removing_a_release.json +8 -4
  174. data/doc/api/admin/releases/showing_a_release.json +10 -7
  175. data/doc/api/admin/releases/updating_a_release.json +9 -5
  176. data/doc/api/admin/saved_addresses/creating_a_saved_address.json +10 -7
  177. data/doc/api/admin/saved_addresses/listing_saved_address.json +9 -6
  178. data/doc/api/admin/saved_addresses/removing_a_saved_address.json +8 -4
  179. data/doc/api/admin/saved_addresses/updating_a_saved_address.json +8 -4
  180. data/doc/api/admin/saved_credit_cards/creating_a_saved_credit_card.json +11 -8
  181. data/doc/api/admin/saved_credit_cards/listing_saved_credit_cards.json +9 -6
  182. data/doc/api/admin/saved_credit_cards/removing_a_saved_credit_card.json +8 -4
  183. data/doc/api/admin/saved_credit_cards/updating_a_saved_credit_card.json +8 -4
  184. data/doc/api/admin/shipping/listing_shipments.json +7 -4
  185. data/doc/api/admin/shipping/showing_a_shipment.json +9 -6
  186. data/doc/api/admin/shipping_rates/creating_a_shipping_rate.json +10 -7
  187. data/doc/api/admin/shipping_rates/listing_shipping_rates.json +9 -6
  188. data/doc/api/admin/shipping_rates/removing_a_shipping_rate.json +8 -4
  189. data/doc/api/admin/shipping_rates/updating_a_shipping_rate.json +8 -4
  190. data/doc/api/admin/shipping_services/bulk_upserting_shipping_services.json +8 -4
  191. data/doc/api/admin/shipping_services/creating_a_shipping_service.json +10 -7
  192. data/doc/api/admin/shipping_services/listing_shipping_services.json +7 -4
  193. data/doc/api/admin/shipping_services/removing_a_shipping_service.json +8 -4
  194. data/doc/api/admin/shipping_services/showing_a_shipping_service.json +9 -6
  195. data/doc/api/admin/shipping_services/updating_a_shipping_service.json +9 -5
  196. data/doc/api/admin/tax_categories/bulk_upserting_tax_categories.json +8 -4
  197. data/doc/api/admin/tax_categories/creating_a_tax_category.json +10 -7
  198. data/doc/api/admin/tax_categories/listing_tax_categories.json +7 -4
  199. data/doc/api/admin/tax_categories/removing_a_tax_category.json +8 -4
  200. data/doc/api/admin/tax_categories/showing_a_tax_category.json +9 -6
  201. data/doc/api/admin/tax_categories/updating_a_tax_categories.json +8 -4
  202. data/doc/api/admin/tax_rates/creating_a_tax_rate.json +12 -9
  203. data/doc/api/admin/tax_rates/listing_tax_rates.json +10 -7
  204. data/doc/api/admin/tax_rates/removing_a_tax_rate.json +8 -4
  205. data/doc/api/admin/tax_rates/updating_a_tax_rate.json +8 -4
  206. data/doc/api/admin/users/bulk_upserting_users.json +8 -4
  207. data/doc/api/admin/users/creating_a_user.json +11 -8
  208. data/doc/api/admin/users/listing_users.json +8 -5
  209. data/doc/api/admin/users/removing_a_user.json +8 -4
  210. data/doc/api/admin/users/showing_a_user.json +10 -12
  211. data/doc/api/admin/users/updating_a_user.json +9 -5
  212. data/doc/api/admin/variants/creating_a_product_variant.json +11 -8
  213. data/doc/api/admin/variants/listing_product_variants.json +10 -7
  214. data/doc/api/admin/variants/removing_a_product_variant.json +8 -4
  215. data/doc/api/admin/variants/updating_a_product_variant.json +8 -4
  216. data/doc/api/storefront/accounts/creating_an_account.json +8 -7
  217. data/doc/api/storefront/accounts/getting_account_details.json +9 -8
  218. data/doc/api/storefront/accounts/updating_an_account.json +9 -8
  219. data/doc/api/storefront/analytics/saving_a_category_view.json +19 -6
  220. data/doc/api/storefront/analytics/saving_a_product_view.json +19 -6
  221. data/doc/api/storefront/analytics/saving_a_search.json +19 -6
  222. data/doc/api/storefront/assets/showing_an_asset.json +10 -9
  223. data/doc/api/storefront/authentication/creating_an_authentication_token.json +10 -9
  224. data/doc/api/storefront/authentication/refreshing_an_authentication_token.json +10 -9
  225. data/doc/api/storefront/authentication/using_an_authentication_token.json +11 -10
  226. data/doc/api/storefront/cart/adding_a_promo_code.json +11 -10
  227. data/doc/api/storefront/cart/adding_an_item.json +11 -10
  228. data/doc/api/storefront/cart/creating_a_new_cart_for_a_user.json +10 -9
  229. data/doc/api/storefront/cart/creating_a_new_guest_cart.json +8 -7
  230. data/doc/api/storefront/cart/delete_an_item.json +11 -10
  231. data/doc/api/storefront/cart/listing_user_s_carts.json +10 -9
  232. data/doc/api/storefront/cart/showing_cart.json +11 -10
  233. data/doc/api/storefront/cart/updating_an_item.json +11 -10
  234. data/doc/api/storefront/categories/showing_a_category.json +9 -8
  235. data/doc/api/storefront/categories/showing_a_listing_of_categories.json +9 -8
  236. data/doc/api/storefront/checkout/completing_a_checkout.json +10 -9
  237. data/doc/api/storefront/checkout/showing_a_checkout.json +11 -10
  238. data/doc/api/storefront/checkout/updating_a_checkout.json +10 -9
  239. data/doc/api/storefront/contacts/creating_a_contact.json +8 -7
  240. data/doc/api/storefront/email_signups/creating_an_email_signup.json +8 -7
  241. data/doc/api/storefront/email_signups/showing_an_email_signup_content.json +8 -7
  242. data/doc/api/storefront/index.json +263 -258
  243. data/doc/api/storefront/menus/listing_menus.json +9 -8
  244. data/doc/api/storefront/menus/showing_a_menu.json +11 -10
  245. data/doc/api/storefront/orders/listing_the_user_s_orders.json +10 -9
  246. data/doc/api/storefront/orders/showing_an_order.json +11 -10
  247. data/doc/api/storefront/pages/showing_a_page.json +9 -8
  248. data/doc/api/storefront/password_resets/sending_a_forgot_password_email.json +9 -7
  249. data/doc/api/storefront/personalized_recommendations/showing_recommendations_with_a_session_id.json +12 -12
  250. data/doc/api/storefront/personalized_recommendations/showing_recommendations_with_authentication.json +11 -10
  251. data/doc/api/storefront/products/showing_a_product.json +9 -8
  252. data/doc/api/storefront/products/showing_a_product_with_a_specific_sku_selected.json +9 -8
  253. data/doc/api/storefront/recent_views/showing_recent_views_from_authentication.json +11 -10
  254. data/doc/api/storefront/recent_views/showing_recent_views_with_a_session_id.json +12 -12
  255. data/doc/api/storefront/recent_views/updating_recent_views_with_a_session_id.json +7 -5
  256. data/doc/api/storefront/recent_views/updating_recent_views_with_authentication.json +9 -7
  257. data/doc/api/storefront/saved_addresses/creating_a_saved_address.json +8 -7
  258. data/doc/api/storefront/saved_addresses/deleting_a_saved_address.json +8 -6
  259. data/doc/api/storefront/saved_addresses/listing_the_user_s_saved_addresses.json +10 -9
  260. data/doc/api/storefront/saved_addresses/showing_a_saved_address.json +9 -8
  261. data/doc/api/storefront/saved_addresses/updating_a_saved_address.json +9 -8
  262. data/doc/api/storefront/saved_credit_cards/creating_a_saved_credit_card.json +8 -7
  263. data/doc/api/storefront/saved_credit_cards/deleting_a_saved_credit_card.json +8 -6
  264. data/doc/api/storefront/saved_credit_cards/listing_the_user_s_saved_credit_cards.json +10 -9
  265. data/doc/api/storefront/saved_credit_cards/showing_a_saved_credit_card.json +9 -8
  266. data/doc/api/storefront/saved_credit_cards/updating_a_saved_credit_card.json +9 -8
  267. data/doc/api/storefront/searches/showing_search_autocomplete_suggestions.json +10 -9
  268. data/doc/api/storefront/searches/showing_search_results.json +9 -8
  269. data/doc/api/storefront/segmentation/specifying_session_count_for_segmentation.json +93 -0
  270. data/doc/api/storefront/segmentation/using_session_ids_for_segmenting_non_authenticated_users.json +93 -0
  271. data/doc/api/storefront/system_content/showing_system_content.json +9 -8
  272. data/doc/api/storefront/system_content/showing_the_home_page.json +9 -8
  273. data/doc/api/storefront/taxons/showing_a_taxon.json +11 -10
  274. data/doc/api/storefront/validation_errors/checkout_validation_errors.json +10 -9
  275. data/doc/api/storefront/validation_errors/general_validation_errors.json +5 -4
  276. data/lib/workarea/api/documentation_test.rb +10 -1
  277. data/lib/workarea/api/version.rb +1 -1
  278. data/storefront/app/controllers/workarea/api/storefront/analytics_controller.rb +31 -19
  279. data/storefront/app/controllers/workarea/api/storefront/application_controller.rb +15 -2
  280. data/storefront/app/controllers/workarea/api/storefront/authentication.rb +6 -9
  281. data/storefront/app/controllers/workarea/api/storefront/categories_controller.rb +3 -1
  282. data/storefront/app/controllers/workarea/api/storefront/checkouts_controller.rb +0 -1
  283. data/storefront/app/controllers/workarea/api/storefront/menus_controller.rb +3 -1
  284. data/storefront/app/controllers/workarea/api/storefront/pages_controller.rb +3 -1
  285. data/storefront/app/controllers/workarea/api/storefront/products_controller.rb +3 -1
  286. data/storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb +13 -26
  287. data/storefront/app/controllers/workarea/api/storefront/recommendations_controller.rb +2 -8
  288. data/storefront/app/controllers/workarea/api/storefront/searches_controller.rb +0 -12
  289. data/storefront/app/views/workarea/api/storefront/categories/show.json.jbuilder +1 -1
  290. data/storefront/app/views/workarea/api/storefront/email_signups/show.json.jbuilder +1 -1
  291. data/storefront/app/views/workarea/api/storefront/menus/_menu.json.jbuilder +1 -1
  292. data/storefront/app/views/workarea/api/storefront/pages/show.json.jbuilder +1 -1
  293. data/storefront/app/views/workarea/api/storefront/recent_views/show.json.jbuilder +0 -1
  294. data/storefront/app/views/workarea/api/storefront/searches/show.json.jbuilder +1 -1
  295. data/storefront/app/views/workarea/api/storefront/system_content/show.json.jbuilder +1 -1
  296. data/storefront/config/initializers/config.rb +19 -0
  297. data/storefront/lib/workarea/api/storefront/visit.decorator +52 -0
  298. data/storefront/lib/workarea/api/storefront.rb +1 -0
  299. data/storefront/test/documentation/workarea/api/storefront/segmentation_documentation_test.rb +104 -0
  300. data/storefront/test/dummy/config/initializers/session_store.rb +3 -1
  301. data/storefront/test/integration/workarea/api/storefront/analytics_integration_test.rb +12 -7
  302. data/storefront/test/integration/workarea/api/storefront/recent_views_integration_test.rb +38 -33
  303. data/storefront/test/integration/workarea/api/storefront/recommendations_integration_test.rb +1 -1
  304. data/storefront/test/integration/workarea/api/storefront/searches_integration_test.rb +0 -36
  305. data/storefront/test/integration/workarea/api/storefront/segments_integration_test.rb +218 -0
  306. metadata +18 -12
  307. data/doc/api/admin/orders/viewing_orders_by_date_range.json +0 -68
  308. data/doc/api/storefront/analytics/saving_a_search_abandonment.json +0 -38
  309. data/doc/api/storefront/analytics/saving_filters.json +0 -38
  310. data/storefront/app/controllers/workarea/api/storefront/user_activity.rb +0 -36
  311. data/storefront/app/view_models/workarea/api/storefront/search_suggestion_view_model.rb +0 -21
@@ -4,42 +4,6 @@ module Workarea
4
4
  module Api
5
5
  module Storefront
6
6
  class SearchesIntegrationTest < IntegrationTest
7
- def test_showing_search_autocomplete
8
- create_product(name: 'Foo')
9
- create_category(name: 'Foo Category')
10
- create_page(name: 'Foo Page')
11
-
12
- Metrics::SearchByDay.save_search('foo', 3)
13
- travel_to 1.weeks.from_now
14
- GenerateInsights.generate_all!
15
- BulkIndexSearches.perform
16
-
17
- get storefront_api.searches_path(q: 'foo')
18
- results = JSON.parse(response.body)['results']
19
- assert_equal(4, results.length)
20
-
21
- search = results.detect { |r| r['type'] == 'Searches' }
22
- assert(search.present?)
23
- assert_equal('foo', search['value'])
24
- assert_equal(storefront_api.search_path(q: 'foo'), search['url'])
25
-
26
- product = results.detect { |r| r['type'] == 'Products' }
27
- assert(product.present?)
28
- assert_equal('Foo', product['value'])
29
- assert_match(/product_images/, product['image'])
30
- assert_equal(storefront_api.product_path('foo'), product['url'])
31
-
32
- category = results.detect { |r| r['type'] == 'Categories' }
33
- assert(category.present?)
34
- assert_equal('Foo Category', category['value'])
35
- assert_equal(storefront_api.category_path('foo-category'), category['url'])
36
-
37
- page = results.detect { |r| r['type'] == 'Pages' }
38
- assert(page.present?)
39
- assert_equal('Foo Page', page['value'])
40
- assert_equal(storefront_api.page_path('foo-page'), page['url'])
41
- end
42
-
43
7
  def test_shows_search_results
44
8
  Search::Settings.current.update_attributes!(terms_facets: %w(Color Size))
45
9
  create_product(
@@ -0,0 +1,218 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Api
5
+ module Storefront
6
+ class SegmentsIntegrationTest < IntegrationTest
7
+ include AuthenticationTest
8
+
9
+ def test_sessions_functionality
10
+ first_time = Segment::FirstTimeVisitor.instance
11
+ returning = Segment::ReturningVisitor.instance
12
+
13
+ get storefront_api.system_content_path('home_page')
14
+ assert_equal(first_time.id.to_s, response.headers['X-Workarea-Segments'])
15
+
16
+ get storefront_api.system_content_path('home_page'), params: { sessions: 1 }
17
+ assert_equal(first_time.id.to_s, response.headers['X-Workarea-Segments'])
18
+
19
+ get storefront_api.system_content_path('home_page'), params: { sessions: 2 }
20
+ assert_equal(returning.id.to_s, response.headers['X-Workarea-Segments'])
21
+ end
22
+
23
+ def test_current_email_functionality
24
+ first_time = Segment::FirstTimeCustomer.instance
25
+ returning = Segment::ReturningCustomer.instance
26
+
27
+ Metrics::User.save_order(email: 'first-time@workarea.com', revenue: 1.to_m)
28
+ Metrics::User.save_order(email: 'returning@workarea.com', revenue: 1.to_m)
29
+ Metrics::User.save_order(email: 'returning@workarea.com', revenue: 1.to_m)
30
+
31
+ get storefront_api.system_content_path('home_page')
32
+ assert(response.headers['X-Workarea-Segments'].blank?)
33
+
34
+ get storefront_api.system_content_path('home_page'), params: { email: 'first-time@workarea.com' }
35
+ assert_equal(first_time.id.to_s, response.headers['X-Workarea-Segments'])
36
+
37
+ get storefront_api.system_content_path('home_page'), params: { email: 'returning@workarea.com' }
38
+ assert_equal(returning.id.to_s, response.headers['X-Workarea-Segments'])
39
+ end
40
+
41
+ def test_session_ids_for_metrics
42
+ first_time = Segment::FirstTimeCustomer.instance
43
+ returning = Segment::ReturningCustomer.instance
44
+
45
+ Metrics::User.create!(id: '1', orders: 1)
46
+ Metrics::User.create!(id: '2', orders: 2)
47
+
48
+ get storefront_api.system_content_path('home_page')
49
+ assert(response.headers['X-Workarea-Segments'].blank?)
50
+
51
+ get storefront_api.system_content_path('home_page'), params: { session_id: '1' }
52
+ assert_equal(first_time.id.to_s, response.headers['X-Workarea-Segments'])
53
+
54
+ get storefront_api.system_content_path('home_page'), params: { session_id: '2' }
55
+ assert_equal(returning.id.to_s, response.headers['X-Workarea-Segments'])
56
+ end
57
+
58
+ def test_products_active_by_segment
59
+ segment_one = create_segment(rules: [Segment::Rules::Sessions.new(minimum: 1, maximum: 1)])
60
+ segment_two = create_segment(rules: [Segment::Rules::Sessions.new(minimum: 2, maximum: 2)])
61
+ product_one = create_product(active: true, active_segment_ids: [segment_two.id])
62
+ product_two = create_product(active: true, active_segment_ids: [segment_one.id])
63
+
64
+ assert_raise InvalidDisplay do
65
+ get storefront_api.product_path(product_one), params: { sessions: 0 }
66
+ assert(response.not_found?)
67
+ end
68
+
69
+ assert_raise InvalidDisplay do
70
+ get storefront_api.product_path(product_two), params: { sessions: 0 }
71
+ assert(response.not_found?)
72
+ end
73
+
74
+ get storefront_api.search_path(q: '*'), params: { sessions: 0 }
75
+ assert(JSON.parse(response.body)['products'].empty?)
76
+
77
+ assert_raise InvalidDisplay do
78
+ get storefront_api.product_path(product_one), params: { sessions: 1 }
79
+ assert(response.not_found?)
80
+ end
81
+
82
+ get storefront_api.product_path(product_two), params: { sessions: 1 }
83
+ assert(response.ok?)
84
+
85
+ get storefront_api.search_path(q: '*'), params: { sessions: 1 }
86
+ products = JSON.parse(response.body)['products']
87
+ assert_equal([product_two.id], products.map { |p| p['id'] })
88
+
89
+ get storefront_api.product_path(product_one), params: { sessions: 2 }
90
+ assert(response.ok?)
91
+
92
+ assert_raise InvalidDisplay do
93
+ get storefront_api.product_path(product_two), params: { sessions: 2 }
94
+ assert(response.not_found?)
95
+ end
96
+
97
+ get storefront_api.search_path(q: '*'), params: { sessions: 2 }
98
+ products = JSON.parse(response.body)['products']
99
+ assert_equal([product_one.id], products.map { |p| p['id'] })
100
+
101
+ segment_one.rules.first.update!(minimum: 1, maximum: nil)
102
+ segment_two.rules.first.update!(minimum: 1, maximum: nil)
103
+
104
+ get storefront_api.product_path(product_one), params: { sessions: 1 }
105
+ assert(response.ok?)
106
+
107
+ get storefront_api.product_path(product_two), params: { sessions: 1 }
108
+ assert(response.ok?)
109
+
110
+ get storefront_api.search_path(q: '*'), params: { sessions: 1 }
111
+ products = JSON.parse(response.body)['products']
112
+ assert_equal(2, products.count)
113
+ assert_includes(products.map { |r| r['id'] }, product_one.id)
114
+ assert_includes(products.map { |r| r['id'] }, product_two.id)
115
+ end
116
+
117
+ def test_content_active_by_segment
118
+ segment_one = create_segment(rules: [Segment::Rules::Sessions.new(minimum: 1, maximum: 1)])
119
+ segment_two = create_segment(rules: [Segment::Rules::Sessions.new(minimum: 2, maximum: 2)])
120
+
121
+ content = Content.for('home_page')
122
+ foo = content.blocks.create!(
123
+ type: 'html',
124
+ data: { 'html' => '<p>Foo</p>' },
125
+ active_segment_ids: [segment_one.id]
126
+ )
127
+ bar = content.blocks.create!(
128
+ type: 'html',
129
+ data: { 'html' => '<p>Bar</p>' },
130
+ active_segment_ids: [segment_two.id]
131
+ )
132
+
133
+ get storefront_api.system_content_path('home_page'), params: { sessions: 1 }
134
+ content_blocks = JSON.parse(response.body)['content_blocks']
135
+ assert_equal([foo.id.to_s], content_blocks.map { |cb| cb['id'] })
136
+
137
+ get storefront_api.system_content_path('home_page'), params: { sessions: 2 }
138
+ content_blocks = JSON.parse(response.body)['content_blocks']
139
+ assert_equal([bar.id.to_s], content_blocks.map { |cb| cb['id'] })
140
+
141
+ segment_one.rules.first.update!(minimum: 1, maximum: nil)
142
+ segment_two.rules.first.update!(minimum: 1, maximum: nil)
143
+
144
+ get storefront_api.system_content_path('home_page'), params: { sessions: 1 }
145
+ content_blocks = JSON.parse(response.body)['content_blocks']
146
+ assert_equal([foo.id.to_s, bar.id.to_s], content_blocks.map { |cb| cb['id'] })
147
+ end
148
+
149
+ def test_logged_in_based_segments
150
+ logged_in = create_segment(rules: [Segment::Rules::LoggedIn.new(logged_in: true)])
151
+ logged_out = create_segment(rules: [Segment::Rules::LoggedIn.new(logged_in: false)])
152
+
153
+ get storefront_api.system_content_path('home_page')
154
+ assert_equal(logged_out.id.to_s, response.headers['X-Workarea-Segments'])
155
+
156
+ user = create_user
157
+ post storefront_api.authentication_tokens_path,
158
+ params: { email: user.email, password: user.password }
159
+
160
+ token = JSON.parse(response.body)['token']
161
+ get storefront_api.system_content_path('home_page'),
162
+ headers: { 'HTTP_AUTHORIZATION' => encode_credentials(token) }
163
+ assert_equal(logged_in.id.to_s, response.headers['X-Workarea-Segments'])
164
+ end
165
+
166
+ def test_http_caching_headers_for_segmented_content
167
+ Workarea.config.strip_http_caching_in_tests = false
168
+ segment = create_segment(rules: [Segment::Rules::Sessions.new(maximum: 999)])
169
+
170
+ get storefront_api.system_content_path('home_page')
171
+ refute_match(/private/, response.headers['Cache-Control'])
172
+ assert_match(/public/, response.headers['Cache-Control'])
173
+ assert(response.headers['X-Workarea-Segmented-Content'].blank?)
174
+
175
+ content = Content.for('home_page')
176
+ content.blocks.create!(
177
+ type: 'html',
178
+ data: { 'html' => '<p>Foo</p>' },
179
+ active_segment_ids: [segment.id]
180
+ )
181
+
182
+ get storefront_api.system_content_path('home_page')
183
+ assert_match(/private/, response.headers['Cache-Control'])
184
+ refute_match(/public/, response.headers['Cache-Control'])
185
+ assert_equal('true', response.headers['X-Workarea-Segmented-Content'])
186
+
187
+ product = create_product(active: true, active_segment_ids: [])
188
+ get storefront_api.product_path(product)
189
+ assert(response.ok?)
190
+ refute_match(/private/, response.headers['Cache-Control'])
191
+ assert_match(/public/, response.headers['Cache-Control'])
192
+ assert(response.headers['X-Workarea-Segmented-Content'].blank?)
193
+
194
+ product.update!(active_segment_ids: [segment.id])
195
+ get storefront_api.product_path(product)
196
+ assert(response.ok?)
197
+ assert_match(/private/, response.headers['Cache-Control'])
198
+ refute_match(/public/, response.headers['Cache-Control'])
199
+ assert_equal('true', response.headers['X-Workarea-Segmented-Content'])
200
+
201
+ category = create_category(active: true, active_segment_ids: [])
202
+ get storefront_api.category_path(category)
203
+ assert(response.ok?)
204
+ refute_match(/private/, response.headers['Cache-Control'])
205
+ assert_match(/public/, response.headers['Cache-Control'])
206
+ assert(response.headers['X-Workarea-Segmented-Content'].blank?)
207
+
208
+ category.update!(product_ids: [product.id])
209
+ get storefront_api.category_path(category)
210
+ assert(response.ok?)
211
+ assert_match(/private/, response.headers['Cache-Control'])
212
+ refute_match(/public/, response.headers['Cache-Control'])
213
+ assert_equal('true', response.headers['X-Workarea-Segmented-Content'])
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.7
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-22 00:00:00.000000000 Z
12
+ date: 2019-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: workarea
@@ -37,28 +37,28 @@ dependencies:
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.4.7
40
+ version: 4.5.0
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 4.4.7
47
+ version: 4.5.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: workarea-api-admin
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 4.4.7
54
+ version: 4.5.0
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 4.4.7
61
+ version: 4.5.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: raddocs
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -97,10 +97,14 @@ extensions: []
97
97
  extra_rdoc_files: []
98
98
  files:
99
99
  - ".editorconfig"
100
+ - ".eslintrc.json"
100
101
  - ".github/ISSUE_TEMPLATE/bug_report.md"
101
102
  - ".github/ISSUE_TEMPLATE/documentation-request.md"
102
103
  - ".github/ISSUE_TEMPLATE/feature_request.md"
104
+ - ".github/workflows/ci.yml"
103
105
  - ".gitignore"
106
+ - ".rubocop.yml"
107
+ - ".stylelintrc.json"
104
108
  - ".yardopts"
105
109
  - CHANGELOG.md
106
110
  - CODE_OF_CONDUCT.md
@@ -149,6 +153,7 @@ files:
149
153
  - admin/app/controllers/workarea/api/admin/users_controller.rb
150
154
  - admin/app/controllers/workarea/api/admin/variants_controller.rb
151
155
  - admin/app/models/workarea/api/admin/bulk_upsert.rb
156
+ - admin/app/models/workarea/api/admin/date_filtering.rb
152
157
  - admin/app/models/workarea/user.decorator
153
158
  - admin/app/views/workarea/admin/users/_api_permissions.html.haml
154
159
  - admin/app/workers/workarea/perform_api_bulk_upsert.rb
@@ -167,6 +172,7 @@ files:
167
172
  - admin/test/documentation/workarea/api/admin/discounts_documentation_test.rb
168
173
  - admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
169
174
  - admin/test/documentation/workarea/api/admin/fulfillment_documentation_test.rb
175
+ - admin/test/documentation/workarea/api/admin/global_functionality_documentation_test.rb
170
176
  - admin/test/documentation/workarea/api/admin/inventory_skus_documentation_test.rb
171
177
  - admin/test/documentation/workarea/api/admin/navigation_menus_documentation_test.rb
172
178
  - admin/test/documentation/workarea/api/admin/navigation_taxons_documentation_test.rb
@@ -350,7 +356,6 @@ files:
350
356
  - doc/api/admin/navigation_taxonomy/updating_a_navigation_taxons.json
351
357
  - doc/api/admin/orders/listing_orders.json
352
358
  - doc/api/admin/orders/showing_an_order.json
353
- - doc/api/admin/orders/viewing_orders_by_date_range.json
354
359
  - doc/api/admin/pages/bulk_upserting_pages.json
355
360
  - doc/api/admin/pages/creating_a_page.json
356
361
  - doc/api/admin/pages/listing_pages.json
@@ -455,8 +460,6 @@ files:
455
460
  - doc/api/storefront/analytics/saving_a_category_view.json
456
461
  - doc/api/storefront/analytics/saving_a_product_view.json
457
462
  - doc/api/storefront/analytics/saving_a_search.json
458
- - doc/api/storefront/analytics/saving_a_search_abandonment.json
459
- - doc/api/storefront/analytics/saving_filters.json
460
463
  - doc/api/storefront/assets/showing_an_asset.json
461
464
  - doc/api/storefront/authentication/creating_an_authentication_token.json
462
465
  - doc/api/storefront/authentication/refreshing_an_authentication_token.json
@@ -504,6 +507,8 @@ files:
504
507
  - doc/api/storefront/saved_credit_cards/updating_a_saved_credit_card.json
505
508
  - doc/api/storefront/searches/showing_search_autocomplete_suggestions.json
506
509
  - doc/api/storefront/searches/showing_search_results.json
510
+ - doc/api/storefront/segmentation/specifying_session_count_for_segmentation.json
511
+ - doc/api/storefront/segmentation/using_session_ids_for_segmenting_non_authenticated_users.json
507
512
  - doc/api/storefront/system_content/showing_system_content.json
508
513
  - doc/api/storefront/system_content/showing_the_home_page.json
509
514
  - doc/api/storefront/taxons/showing_a_taxon.json
@@ -544,7 +549,6 @@ files:
544
549
  - storefront/app/controllers/workarea/api/storefront/searches_controller.rb
545
550
  - storefront/app/controllers/workarea/api/storefront/system_content_controller.rb
546
551
  - storefront/app/controllers/workarea/api/storefront/taxons_controller.rb
547
- - storefront/app/controllers/workarea/api/storefront/user_activity.rb
548
552
  - storefront/app/controllers/workarea/storefront/application_controller.decorator
549
553
  - storefront/app/helpers/workarea/api/storefront/application_helper.rb
550
554
  - storefront/app/helpers/workarea/api/storefront/checkouts_helper.rb
@@ -552,7 +556,6 @@ files:
552
556
  - storefront/app/models/workarea/catalog/category.decorator
553
557
  - storefront/app/models/workarea/user.decorator
554
558
  - storefront/app/models/workarea/user/authentication_token.rb
555
- - storefront/app/view_models/workarea/api/storefront/search_suggestion_view_model.rb
556
559
  - storefront/app/views/workarea/api/storefront/accounts/_account.json.jbuilder
557
560
  - storefront/app/views/workarea/api/storefront/accounts/create.json.jbuilder
558
561
  - storefront/app/views/workarea/api/storefront/accounts/show.json.jbuilder
@@ -612,6 +615,7 @@ files:
612
615
  - storefront/config/routes.rb
613
616
  - storefront/lib/workarea/api/storefront.rb
614
617
  - storefront/lib/workarea/api/storefront/engine.rb
618
+ - storefront/lib/workarea/api/storefront/visit.decorator
615
619
  - storefront/test/documentation/workarea/api/storefront/accounts_documentation_test.rb
616
620
  - storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
617
621
  - storefront/test/documentation/workarea/api/storefront/assets_documentation_test.rb
@@ -632,6 +636,7 @@ files:
632
636
  - storefront/test/documentation/workarea/api/storefront/saved_addresses_documentation_test.rb
633
637
  - storefront/test/documentation/workarea/api/storefront/saved_credit_cards_documentation_test.rb
634
638
  - storefront/test/documentation/workarea/api/storefront/searches_documentation_test.rb
639
+ - storefront/test/documentation/workarea/api/storefront/segmentation_documentation_test.rb
635
640
  - storefront/test/documentation/workarea/api/storefront/system_content_documentation_test.rb
636
641
  - storefront/test/documentation/workarea/api/storefront/taxons_documentation_test.rb
637
642
  - storefront/test/documentation/workarea/api/storefront/validation_documentation_test.rb
@@ -709,6 +714,7 @@ files:
709
714
  - storefront/test/integration/workarea/api/storefront/saved_addresses_integration_test.rb
710
715
  - storefront/test/integration/workarea/api/storefront/saved_credit_cards_integration_test.rb
711
716
  - storefront/test/integration/workarea/api/storefront/searches_integration_test.rb
717
+ - storefront/test/integration/workarea/api/storefront/segments_integration_test.rb
712
718
  - storefront/test/integration/workarea/api/storefront/system_content_integration_test.rb
713
719
  - storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
714
720
  - storefront/test/integration/workarea/api/storefront/user_carts_integration_test.rb
@@ -737,7 +743,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
737
743
  - !ruby/object:Gem::Version
738
744
  version: '0'
739
745
  requirements: []
740
- rubygems_version: 3.0.4
746
+ rubygems_version: 3.0.6
741
747
  signing_key:
742
748
  specification_version: 4
743
749
  summary: Adds a JSON REST API to the Workarea Commerce Platform
@@ -1,68 +0,0 @@
1
- {
2
- "parameters": [
3
- {
4
- "name": "page",
5
- "description": "Current page"
6
- },
7
- {
8
- "name": "sort_by",
9
- "description": "Field on which to sort (see responses for possible values)"
10
- },
11
- {
12
- "name": "sort_direction",
13
- "description": "Direction to sort (asc or desc)"
14
- },
15
- {
16
- "name": "placed_at_greater_than",
17
- "description": "Start of a placed_at date range"
18
- },
19
- {
20
- "name": "placed_at_less_than",
21
- "description": "End of a placed_at date range"
22
- }
23
- ],
24
- "response_fields": [
25
-
26
- ],
27
- "requests": [
28
- {
29
- "request_headers": {
30
- },
31
- "request_query_parameters": {
32
- "page": "1",
33
- "sort_by": "created_at",
34
- "sort_direction": "desc",
35
- "placed_at_greater_than": "2019-08-07 17:00:42 UTC",
36
- "placed_at_less_than": "2019-08-09 17:00:42 UTC"
37
- },
38
- "response_headers": {
39
- "X-Frame-Options": "SAMEORIGIN",
40
- "X-XSS-Protection": "1; mode=block",
41
- "X-Content-Type-Options": "nosniff",
42
- "X-Download-Options": "noopen",
43
- "X-Permitted-Cross-Domain-Policies": "none",
44
- "Referrer-Policy": "strict-origin-when-cross-origin",
45
- "Content-Type": "application/json; charset=utf-8",
46
- "ETag": "W/\"5a66f81a72cdc929d9ed1ec28c9499ce\"",
47
- "Cache-Control": "no-cache, no-store, must-revalidate",
48
- "X-Request-Id": "cc63ad7b-4ad6-47b5-a439-204078b26056",
49
- "X-Runtime": "0.009877",
50
- "Expires": "0",
51
- "Content-Length": "2133"
52
- },
53
- "request_method": "GET",
54
- "request_path": "/api/admin/orders?page=1&sort_by=created_at&sort_direction=desc&placed_at_greater_than=2019-08-07+17%3A00%3A42+UTC&placed_at_less_than=2019-08-09+17%3A00%3A42+UTC",
55
- "request_body": null,
56
- "request_content_type": null,
57
- "response_status": 200,
58
- "response_status_text": "OK",
59
- "response_body": "{\n \"orders\": [\n {\n \"_id\": \"1002\",\n \"canceled_at\": null,\n \"checkout_by_id\": null,\n \"checkout_started_at\": null,\n \"copied_from_id\": null,\n \"created_at\": \"2019-08-22T17:00:39.443Z\",\n \"discount_ids\": [\n\n ],\n \"email\": \"bcrouse-new@workarea.com\",\n \"ip_address\": null,\n \"items\": [\n {\n \"_id\": \"5d5eca37d4322a04dfbf6a91\",\n \"category_ids\": [\n\n ],\n \"created_at\": \"2019-08-22T17:00:39.442Z\",\n \"customizations\": {\n },\n \"discountable\": true,\n \"free_gift\": false,\n \"price_adjustments\": [\n {\n \"_id\": \"5d5eca38d4322a04dfbf6ae7\",\n \"amount\": {\n \"cents\": 1000.0,\n \"currency_iso\": \"USD\"\n },\n \"calculator\": \"Workarea::Pricing::Calculators::ItemCalculator\",\n \"created_at\": null,\n \"data\": {\n \"on_sale\": false,\n \"original_price\": 5.0,\n \"tax_code\": null\n },\n \"description\": \"Item Subtotal\",\n \"price\": \"item\",\n \"quantity\": 2,\n \"updated_at\": null\n }\n ],\n \"product_attributes\": {\n \"_id\": \"169B1240D1\",\n \"tags\": [\n\n ],\n \"active\": {\n \"en\": true\n },\n \"subscribed_user_ids\": [\n\n ],\n \"details\": {\n \"en\": {\n \"Material\": [\n \"Cotton\"\n ],\n \"Style\": [\n \"12345\"\n ]\n }\n },\n \"filters\": {\n \"en\": {\n \"Material\": \"Cotton\",\n \"Style\": \"12345\"\n }\n },\n \"template\": \"generic\",\n \"purchasable\": true,\n \"name\": {\n \"en\": \"Test Product\"\n },\n \"digital\": false,\n \"slug\": \"test-product\",\n \"updated_at\": \"2019-08-22T17:00:39.093Z\",\n \"created_at\": \"2019-08-22T17:00:32.446Z\",\n \"variants\": [\n {\n \"_id\": \"5d5eca30d4322a04dfbf6a15\",\n \"active\": {\n \"en\": true\n },\n \"details\": {\n \"en\": {\n }\n },\n \"sku\": \"SKU\",\n \"name\": {\n \"en\": \"SKU\"\n },\n \"position\": 0\n }\n ],\n \"last_indexed_at\": \"2019-08-22T17:00:39.236Z\"\n },\n \"product_id\": \"169B1240D1\",\n \"quantity\": 2,\n \"sku\": \"SKU\",\n \"total_price\": {\n \"cents\": 1000.0,\n \"currency_iso\": \"USD\"\n },\n \"total_value\": {\n \"cents\": 1000.0,\n \"currency_iso\": \"USD\"\n },\n \"updated_at\": \"2019-08-22T17:00:39.442Z\",\n \"via\": null\n }\n ],\n \"lock_expires_at\": null,\n \"metrics_saved_at\": \"2019-08-22T17:00:42.193Z\",\n \"placed_at\": \"2019-08-08T17:00:39.079Z\",\n \"pricing_cache_key\": \"6efba16a1619c086556f7ed61b0c940ffbc37c4d\",\n \"promo_codes\": [\n\n ],\n \"reminded_at\": null,\n \"shipping_total\": {\n \"cents\": 100.0,\n \"currency_iso\": \"USD\"\n },\n \"source\": null,\n \"subscribed_user_ids\": [\n\n ],\n \"subtotal_price\": {\n \"cents\": 1000.0,\n \"currency_iso\": \"USD\"\n },\n \"tax_total\": {\n \"cents\": 0.0,\n \"currency_iso\": \"USD\"\n },\n \"token\": \"YVoRqLiQprDGh4cxL1Eg2UZw\",\n \"total_price\": {\n \"cents\": 1100.0,\n \"currency_iso\": \"USD\"\n },\n \"total_value\": {\n \"cents\": 1000.0,\n \"currency_iso\": \"USD\"\n },\n \"updated_at\": \"2019-08-22T17:00:42.361Z\",\n \"user_activity_id\": null,\n \"user_agent\": null,\n \"user_id\": null\n }\n ]\n}",
60
- "response_content_type": "application/json",
61
- "curl": "curl -g \"https://www.example.com/api/admin/orders?page=1&sort_by=created_at&sort_direction=desc&placed_at_greater_than=2019-08-07+17%3A00%3A42+UTC&placed_at_less_than=2019-08-09+17%3A00%3A42+UTC\" -X GET "
62
- }
63
- ],
64
- "resource": "Orders",
65
- "description": "Viewing orders by date range",
66
- "route": "/api/admin/orders",
67
- "http_method": "GET"
68
- }
@@ -1,38 +0,0 @@
1
- {
2
- "parameters": [
3
-
4
- ],
5
- "response_fields": [
6
-
7
- ],
8
- "requests": [
9
- {
10
- "request_headers": {
11
- "Content-Type": "application/json"
12
- },
13
- "request_query_parameters": {
14
- },
15
- "response_headers": {
16
- "Content-Type": "text/html; charset=utf-8",
17
- "Cache-Control": "no-cache",
18
- "X-Request-Id": "9c3731e3-d4e8-46d0-93d6-c74abb949b7c",
19
- "X-Runtime": "0.001960",
20
- "Content-Length": "0"
21
- },
22
- "request_method": "POST",
23
- "request_path": "/api/storefront/analytics/search_abandonment",
24
- "request_body": "{\"q\":\"foo\"}",
25
- "request_content_type": "application/json",
26
- "response_status": 200,
27
- "response_status_text": "OK",
28
- "response_body": null,
29
- "response_content_type": "text/html",
30
- "curl": "curl \"https://www.example.com/api/storefront/analytics/search_abandonment\" -d '{\"q\":\"foo\"}' -X POST \\\n\t-H \"Content-Type: application/json\""
31
- }
32
- ],
33
- "resource": "Analytics",
34
- "description": "Saving a search abandonment",
35
- "route": "/api/storefront/analytics/search_abandonment",
36
- "http_method": "POST",
37
- "explanation": " Saving a search abandonment will be reflected in admin reports. This\n is intended to be called when a customer performs a search, but\n leaves the screen without viewing a product.\n"
38
- }
@@ -1,38 +0,0 @@
1
- {
2
- "parameters": [
3
-
4
- ],
5
- "response_fields": [
6
-
7
- ],
8
- "requests": [
9
- {
10
- "request_headers": {
11
- "Content-Type": "application/json"
12
- },
13
- "request_query_parameters": {
14
- },
15
- "response_headers": {
16
- "Content-Type": "text/html; charset=utf-8",
17
- "Cache-Control": "no-cache",
18
- "X-Request-Id": "06a932d7-b02a-4cac-b2cb-abb346a351fe",
19
- "X-Runtime": "0.005257",
20
- "Content-Length": "0"
21
- },
22
- "request_method": "POST",
23
- "request_path": "/api/storefront/analytics/filters",
24
- "request_body": "{\"filters\":{\"color\":\"Red\"}}",
25
- "request_content_type": "application/json",
26
- "response_status": 200,
27
- "response_status_text": "OK",
28
- "response_body": null,
29
- "response_content_type": "text/html",
30
- "curl": "curl \"https://www.example.com/api/storefront/analytics/filters\" -d '{\"filters\":{\"color\":\"Red\"}}' -X POST \\\n\t-H \"Content-Type: application/json\""
31
- }
32
- ],
33
- "resource": "Analytics",
34
- "description": "Saving filters",
35
- "route": "/api/storefront/analytics/filters",
36
- "http_method": "POST",
37
- "explanation": " Saving a filter will be reflected in admin reports. This is intended\n to be called when a customer selects a filter on from a product\n listing (most likely categories or search results).\n"
38
- }
@@ -1,36 +0,0 @@
1
- module Workarea
2
- module Api
3
- module Storefront
4
- module UserActivity
5
- extend ActiveSupport::Concern
6
-
7
- def user_activity
8
- @user_activity ||= Recommendation::UserActivity.find_or_initialize_by(
9
- id: current_user_activity_id
10
- )
11
- end
12
-
13
- def current_user_activity_id
14
- if authentication?
15
- current_user.id
16
- else
17
- params[:session_id]
18
- end
19
- end
20
-
21
- def assert_current_user_activity_id
22
- if current_user_activity_id.blank?
23
- render(
24
- json: {
25
- problem: t('workarea.api.storefront.recent_views.missing_id')
26
- },
27
- status: :unprocessable_entity
28
- )
29
-
30
- return false
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,21 +0,0 @@
1
- module Workarea
2
- module Api
3
- module Storefront
4
- class SearchSuggestionViewModel < Workarea::Storefront::SearchSuggestionViewModel
5
- def url
6
- helpers = Api::Storefront::Engine.routes.url_helpers
7
-
8
- if suggestion_type == 'product'
9
- helpers.product_path(product)
10
- elsif suggestion_type == 'search'
11
- helpers.search_path(q: name)
12
- elsif suggestion_type == 'category'
13
- helpers.category_path(source['slug'])
14
- elsif suggestion_type == 'page'
15
- helpers.page_path(source['slug'])
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end