disco_app 0.12.7.pre.puma.pre.3 → 0.18.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (354) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +1 -5
  3. data/app/assets/components/disco_app/forms/model-form.es6.jsx +2 -7
  4. data/app/assets/images/disco_app/.keep +0 -0
  5. data/app/assets/images/disco_app/logo.png +0 -0
  6. data/app/assets/javascripts/disco_app/components/custom/shop_row.js.jsx +2 -1
  7. data/app/assets/javascripts/disco_app/components/ui-kit/forms/base_form.es6.jsx +16 -44
  8. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-checkbox.es6.jsx +10 -5
  9. data/app/clients/disco_app/api_client.rb +25 -19
  10. data/app/clients/disco_app/graphql_client.rb +85 -0
  11. data/app/controllers/disco_app/admin/app_settings_controller.rb +2 -0
  12. data/app/controllers/disco_app/admin/application_controller.rb +3 -1
  13. data/app/controllers/disco_app/admin/concerns/app_settings_controller.rb +2 -1
  14. data/app/controllers/disco_app/admin/concerns/authenticated_controller.rb +5 -3
  15. data/app/controllers/disco_app/admin/concerns/plans_controller.rb +3 -2
  16. data/app/controllers/disco_app/admin/concerns/shops_controller.rb +1 -0
  17. data/app/controllers/disco_app/admin/concerns/sources_controller.rb +52 -0
  18. data/app/controllers/disco_app/admin/concerns/subscriptions_controller.rb +3 -2
  19. data/app/controllers/disco_app/admin/plans_controller.rb +2 -0
  20. data/app/controllers/disco_app/admin/resources/shops_controller.rb +2 -0
  21. data/app/controllers/disco_app/admin/shops_controller.rb +2 -0
  22. data/app/controllers/disco_app/admin/sources_controller.rb +5 -0
  23. data/app/controllers/disco_app/admin/subscriptions_controller.rb +2 -0
  24. data/app/controllers/disco_app/charges_controller.rb +12 -8
  25. data/app/controllers/disco_app/concerns/app_proxy_controller.rb +6 -6
  26. data/app/controllers/disco_app/concerns/authenticated_controller.rb +31 -23
  27. data/app/controllers/disco_app/concerns/carrier_request_controller.rb +22 -11
  28. data/app/controllers/disco_app/concerns/user_authenticated_controller.rb +18 -0
  29. data/app/controllers/disco_app/concerns/webhooks_controller.rb +49 -0
  30. data/app/controllers/disco_app/flow/actions_controller.rb +9 -0
  31. data/app/controllers/disco_app/flow/concerns/actions_controller.rb +23 -0
  32. data/app/controllers/disco_app/flow/concerns/trigger_usage_controller.rb +29 -0
  33. data/app/controllers/disco_app/flow/concerns/verifies_flow_payload.rb +39 -0
  34. data/app/controllers/disco_app/flow/trigger_usage_controller.rb +9 -0
  35. data/app/controllers/disco_app/frame_controller.rb +0 -1
  36. data/app/controllers/disco_app/install_controller.rb +3 -6
  37. data/app/controllers/disco_app/subscriptions_controller.rb +12 -4
  38. data/app/controllers/disco_app/user_sessions_controller.rb +58 -0
  39. data/app/controllers/disco_app/webhooks_controller.rb +2 -43
  40. data/app/controllers/sessions_controller.rb +5 -6
  41. data/app/helpers/disco_app/application_helper.rb +7 -7
  42. data/app/jobs/application_job.rb +2 -0
  43. data/app/jobs/disco_app/app_installed_job.rb +2 -0
  44. data/app/jobs/disco_app/app_uninstalled_job.rb +2 -0
  45. data/app/jobs/disco_app/concerns/app_installed_job.rb +3 -4
  46. data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +2 -1
  47. data/app/jobs/disco_app/concerns/customers_data_request_job.rb +13 -0
  48. data/app/jobs/disco_app/concerns/customers_redact_job.rb +13 -0
  49. data/app/jobs/disco_app/concerns/render_asset_group_job.rb +2 -1
  50. data/app/jobs/disco_app/concerns/shop_redact_job.rb +13 -0
  51. data/app/jobs/disco_app/concerns/shop_update_job.rb +10 -3
  52. data/app/jobs/disco_app/concerns/subscription_changed_job.rb +2 -1
  53. data/app/jobs/disco_app/concerns/synchronise_carrier_service_job.rb +9 -8
  54. data/app/jobs/disco_app/concerns/synchronise_resources_job.rb +3 -6
  55. data/app/jobs/disco_app/concerns/synchronise_users_job.rb +18 -0
  56. data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +48 -18
  57. data/app/jobs/disco_app/customers_data_request_job.rb +5 -0
  58. data/app/jobs/disco_app/customers_redact_job.rb +5 -0
  59. data/app/jobs/disco_app/flow/process_action_job.rb +11 -0
  60. data/app/jobs/disco_app/flow/process_trigger_job.rb +11 -0
  61. data/app/jobs/disco_app/render_asset_group_job.rb +2 -0
  62. data/app/jobs/disco_app/send_subscription_job.rb +1 -1
  63. data/app/jobs/disco_app/shop_job.rb +12 -5
  64. data/app/jobs/disco_app/shop_redact_job.rb +5 -0
  65. data/app/jobs/disco_app/shop_update_job.rb +2 -0
  66. data/app/jobs/disco_app/subscription_changed_job.rb +2 -0
  67. data/app/jobs/disco_app/synchronise_carrier_service_job.rb +2 -0
  68. data/app/jobs/disco_app/synchronise_resources_job.rb +2 -0
  69. data/app/jobs/disco_app/synchronise_users_job.rb +5 -0
  70. data/app/jobs/disco_app/synchronise_webhooks_job.rb +2 -0
  71. data/app/models/application_record.rb +5 -0
  72. data/app/models/disco_app/app_settings.rb +3 -1
  73. data/app/models/disco_app/application_charge.rb +8 -2
  74. data/app/models/disco_app/concerns/app_settings.rb +2 -0
  75. data/app/models/disco_app/concerns/can_be_liquified.rb +34 -18
  76. data/app/models/disco_app/concerns/has_metafields.rb +100 -44
  77. data/app/models/disco_app/concerns/plan.rb +15 -7
  78. data/app/models/disco_app/concerns/plan_code.rb +5 -3
  79. data/app/models/disco_app/concerns/renders_assets.rb +15 -21
  80. data/app/models/disco_app/concerns/shop.rb +39 -16
  81. data/app/models/disco_app/concerns/source.rb +13 -0
  82. data/app/models/disco_app/concerns/subscription.rb +14 -7
  83. data/app/models/disco_app/concerns/synchronises.rb +16 -16
  84. data/app/models/disco_app/concerns/taggable.rb +8 -3
  85. data/app/models/disco_app/concerns/user.rb +21 -0
  86. data/app/models/disco_app/flow/action.rb +9 -0
  87. data/app/models/disco_app/flow/concerns/action.rb +27 -0
  88. data/app/models/disco_app/flow/concerns/trigger.rb +28 -0
  89. data/app/models/disco_app/flow/concerns/trigger_usage.rb +17 -0
  90. data/app/models/disco_app/flow/trigger.rb +9 -0
  91. data/app/models/disco_app/flow/trigger_usage.rb +9 -0
  92. data/app/models/disco_app/plan.rb +3 -1
  93. data/app/models/disco_app/plan_code.rb +3 -1
  94. data/app/models/disco_app/recurring_application_charge.rb +9 -2
  95. data/app/models/disco_app/session_storage.rb +5 -2
  96. data/app/models/disco_app/shop.rb +3 -1
  97. data/app/models/disco_app/source.rb +5 -0
  98. data/app/models/disco_app/subscription.rb +3 -1
  99. data/app/models/disco_app/user.rb +5 -0
  100. data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +16 -19
  101. data/app/resources/disco_app/admin/resources/shop_resource.rb +1 -0
  102. data/app/services/disco_app/carrier_request_service.rb +3 -3
  103. data/app/services/disco_app/charges_service.rb +28 -38
  104. data/app/services/disco_app/flow/create_action.rb +35 -0
  105. data/app/services/disco_app/flow/create_trigger.rb +34 -0
  106. data/app/services/disco_app/flow/process_action.rb +50 -0
  107. data/app/services/disco_app/flow/process_trigger.rb +72 -0
  108. data/app/services/disco_app/flow/update_trigger_usage.rb +42 -0
  109. data/app/services/disco_app/partner_app_service.rb +151 -0
  110. data/app/services/disco_app/proxy_service.rb +2 -2
  111. data/app/services/disco_app/request_validation_service.rb +2 -2
  112. data/app/services/disco_app/subscription_service.rb +62 -28
  113. data/app/services/disco_app/synchronise_resources_service.rb +54 -0
  114. data/app/services/disco_app/webhook_service.rb +9 -11
  115. data/app/views/disco_app/admin/sources/_form.html.erb +34 -0
  116. data/app/views/disco_app/admin/sources/edit.html.erb +7 -0
  117. data/app/views/disco_app/admin/sources/index.html.erb +32 -0
  118. data/app/views/disco_app/admin/sources/new.html.erb +7 -0
  119. data/app/views/disco_app/user_sessions/new.html.erb +12 -0
  120. data/app/views/layouts/admin/_nav_items.erb +7 -0
  121. data/app/views/layouts/admin.html.erb +1 -2
  122. data/app/views/layouts/application.html.erb +1 -2
  123. data/app/views/layouts/embedded_app.html.erb +2 -4
  124. data/app/views/layouts/embedded_app_modal.html.erb +2 -3
  125. data/app/views/shopify_app/sessions/new.html.erb +2 -4
  126. data/config/routes.rb +15 -3
  127. data/db/migrate/20150525000000_create_shops_if_not_existent.rb +81 -81
  128. data/db/migrate/20170315062548_create_disco_app_sources.rb +12 -0
  129. data/db/migrate/20170315062629_add_sources_to_shop_subscriptions.rb +16 -0
  130. data/db/migrate/20170327214540_create_disco_app_users.rb +14 -0
  131. data/db/migrate/20170606160751_fix_disco_app_users_index.rb +8 -0
  132. data/db/migrate/20181229100327_create_flow_actions_and_triggers.rb +32 -0
  133. data/db/migrate/20200405000000_create_flow_trigger_usages.rb +16 -0
  134. data/lib/disco_app/configuration.rb +12 -5
  135. data/lib/disco_app/constants.rb +4 -2
  136. data/lib/disco_app/engine.rb +1 -1
  137. data/lib/disco_app/session.rb +1 -0
  138. data/lib/disco_app/support/file_fixtures.rb +2 -1
  139. data/lib/disco_app/version.rb +3 -1
  140. data/lib/generators/disco_app/install/USAGE +5 -0
  141. data/lib/generators/disco_app/install/install_generator.rb +297 -0
  142. data/lib/generators/disco_app/{templates → install/templates}/assets/javascripts/application.js +0 -0
  143. data/lib/generators/disco_app/{templates → install/templates}/assets/javascripts/components.js +0 -0
  144. data/lib/generators/disco_app/{templates → install/templates}/assets/stylesheets/application.scss +0 -0
  145. data/lib/generators/disco_app/install/templates/config/appsignal.yml +12 -0
  146. data/lib/generators/disco_app/install/templates/config/cable.yml.tt +11 -0
  147. data/lib/generators/disco_app/{templates → install/templates}/config/database.yml.tt +7 -3
  148. data/lib/generators/disco_app/install/templates/config/environments/staging.rb +108 -0
  149. data/lib/generators/disco_app/{templates → install/templates}/config/puma.rb +0 -0
  150. data/lib/generators/disco_app/{templates → install/templates}/controllers/home_controller.rb +1 -0
  151. data/lib/generators/disco_app/{templates → install/templates}/initializers/disco_app.rb +5 -0
  152. data/lib/generators/disco_app/install/templates/initializers/session_store.rb +2 -0
  153. data/lib/generators/disco_app/install/templates/initializers/shopify_app.rb +11 -0
  154. data/lib/generators/disco_app/{templates → install/templates}/initializers/shopify_session_repository.rb +2 -1
  155. data/lib/generators/disco_app/install/templates/initializers/timber.rb +4 -0
  156. data/lib/generators/disco_app/install/templates/root/.editorconfig +9 -0
  157. data/lib/generators/disco_app/install/templates/root/.env +27 -0
  158. data/lib/generators/disco_app/install/templates/root/.env.local +29 -0
  159. data/lib/generators/disco_app/install/templates/root/.github/PULL_REQUEST_TEMPLATE.md +18 -0
  160. data/lib/generators/disco_app/install/templates/root/.gitignore +65 -0
  161. data/lib/generators/disco_app/install/templates/root/.rspec +1 -0
  162. data/lib/generators/disco_app/install/templates/root/.rubocop.yml +758 -0
  163. data/lib/generators/disco_app/install/templates/root/.tool-versions +2 -0
  164. data/lib/generators/disco_app/{templates → install/templates}/root/CHECKS +0 -0
  165. data/lib/generators/disco_app/{templates → install/templates}/root/Procfile +0 -0
  166. data/lib/generators/disco_app/install/templates/root/README.md +26 -0
  167. data/lib/generators/disco_app/install/templates/root/package.json.tt +17 -0
  168. data/lib/generators/disco_app/install/templates/spec/rails_helper.rb +40 -0
  169. data/lib/generators/disco_app/install/templates/spec/spec_helper.rb +24 -0
  170. data/lib/generators/disco_app/install/templates/spec/support/active_job.rb +13 -0
  171. data/lib/generators/disco_app/install/templates/spec/support/coveralls.rb +3 -0
  172. data/lib/generators/disco_app/install/templates/spec/support/database_cleaner.rb +17 -0
  173. data/lib/generators/disco_app/install/templates/spec/support/factory_bot.rb +3 -0
  174. data/lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb +13 -0
  175. data/lib/generators/disco_app/install/templates/spec/support/shared_examples/a_synchronise_job.rb +12 -0
  176. data/lib/generators/disco_app/install/templates/spec/support/shoulda.rb +6 -0
  177. data/lib/generators/disco_app/install/templates/spec/support/vcr.rb +14 -0
  178. data/lib/generators/disco_app/install/templates/spec/support/webmock.rb +8 -0
  179. data/lib/generators/disco_app/{templates → install/templates}/views/home/index.html.erb +0 -0
  180. data/lib/generators/disco_app/react/USAGE +5 -0
  181. data/lib/generators/disco_app/react/react_generator.rb +108 -0
  182. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/base_controller.rb +18 -0
  183. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/home_controller.rb +10 -0
  184. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/shops_controller.rb +11 -0
  185. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/users_controller.rb +11 -0
  186. data/lib/generators/disco_app/react/templates/app/controllers/embedded/home_controller.rb +13 -0
  187. data/lib/generators/disco_app/react/templates/app/models/api_response.rb +107 -0
  188. data/lib/generators/disco_app/react/templates/app/serializers/disco_app/shop_serializer.rb +13 -0
  189. data/lib/generators/disco_app/react/templates/app/serializers/disco_app/user_serializer.rb +13 -0
  190. data/lib/generators/disco_app/react/templates/app/serializers/empty_serializer.rb +5 -0
  191. data/lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb +76 -0
  192. data/lib/generators/disco_app/react/templates/app/views/embedded/home/index.html.erb +12 -0
  193. data/lib/generators/disco_app/react/templates/app/views/layouts/embedded.html.erb +10 -0
  194. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/App.jsx +77 -0
  195. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/HomePage.jsx +34 -0
  196. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/EmbeddedPage.jsx +70 -0
  197. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/ErrorBanner.jsx +58 -0
  198. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/PaginationWrapper.jsx +10 -0
  199. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/ScrollToTop.jsx +23 -0
  200. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/withApi.jsx +125 -0
  201. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/index.jsx +39 -0
  202. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js +19 -0
  203. data/lib/generators/disco_app/react/templates/app/webpack/packs/embedded.js +2 -0
  204. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/banners.scss +7 -0
  205. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/busy.scss +3 -0
  206. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/index.scss +3 -0
  207. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/pagination.scss +5 -0
  208. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded.scss +2 -0
  209. data/lib/generators/disco_app/react/templates/config/initializers/mime_types.rb +13 -0
  210. data/lib/generators/disco_app/react/templates/config/initializers/omniauth.rb +27 -0
  211. data/lib/generators/disco_app/react/templates/config/initializers/version.rb.tt +7 -0
  212. data/lib/generators/disco_app/react/templates/config/webpack/staging.js +5 -0
  213. data/lib/generators/disco_app/react/templates/config/webpack/test.js +5 -0
  214. data/lib/generators/disco_app/react/templates/config/webpacker.yml +96 -0
  215. data/lib/generators/disco_app/react/templates/root/.eslintignore +5 -0
  216. data/lib/generators/disco_app/react/templates/root/.eslintrc +69 -0
  217. data/lib/generators/disco_app/react/templates/root/.prettierrc +3 -0
  218. data/lib/generators/disco_app/react/templates/root/VERSION +1 -0
  219. data/lib/generators/disco_app/react/templates/root/babel.config.js +72 -0
  220. data/lib/generators/disco_app/react/templates/root/package.json.tt +84 -0
  221. data/lib/generators/disco_app/react/templates/root/postcss.config.js +14 -0
  222. data/lib/tasks/api.rake +0 -2
  223. data/lib/tasks/carrier_service.rake +0 -2
  224. data/lib/tasks/database.rake +1 -1
  225. data/lib/tasks/partner_app.rake +26 -0
  226. data/lib/tasks/sessions.rake +0 -2
  227. data/lib/tasks/shops.rake +0 -2
  228. data/lib/tasks/users.rake +8 -0
  229. data/lib/tasks/webhooks.rake +0 -2
  230. data/test/clients/disco_app/api_client_test.rb +3 -3
  231. data/test/controllers/disco_app/admin/shops_controller_test.rb +1 -0
  232. data/test/controllers/disco_app/charges_controller_test.rb +19 -21
  233. data/test/controllers/disco_app/flow/trigger_usage_controller_test.rb +41 -0
  234. data/test/controllers/disco_app/install_controller_test.rb +2 -1
  235. data/test/controllers/disco_app/subscriptions_controller_test.rb +6 -5
  236. data/test/controllers/disco_app/webhooks_controller_test.rb +6 -5
  237. data/test/controllers/home_controller_test.rb +2 -2
  238. data/test/controllers/proxy_controller_test.rb +3 -3
  239. data/test/disco_app_test.rb +3 -1
  240. data/test/dummy/Rakefile +1 -1
  241. data/test/dummy/app/assets/config/manifest.js +2 -0
  242. data/test/dummy/app/controllers/application_controller.rb +2 -0
  243. data/test/dummy/app/controllers/carrier_request_controller.rb +1 -0
  244. data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +2 -1
  245. data/test/dummy/app/controllers/home_controller.rb +1 -0
  246. data/test/dummy/app/controllers/proxy_controller.rb +2 -1
  247. data/test/dummy/app/javascript/packs/application.js +18 -0
  248. data/test/dummy/app/jobs/application_job.rb +2 -0
  249. data/test/dummy/app/jobs/carts_update_job.rb +1 -1
  250. data/test/dummy/app/jobs/disco_app/app_installed_job.rb +2 -3
  251. data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +3 -2
  252. data/test/dummy/app/jobs/products_create_job.rb +1 -1
  253. data/test/dummy/app/jobs/products_delete_job.rb +1 -1
  254. data/test/dummy/app/jobs/products_update_job.rb +1 -1
  255. data/test/dummy/app/models/application_record.rb +5 -0
  256. data/test/dummy/app/models/cart.rb +8 -7
  257. data/test/dummy/app/models/disco_app/shop.rb +8 -6
  258. data/test/dummy/app/models/js_configuration.rb +2 -1
  259. data/test/dummy/app/models/product.rb +4 -3
  260. data/test/dummy/app/models/widget_configuration.rb +2 -1
  261. data/test/dummy/babel.config.js +72 -0
  262. data/test/dummy/bin/bundle +1 -1
  263. data/test/dummy/bin/rails +1 -1
  264. data/test/dummy/bin/setup +8 -8
  265. data/test/dummy/bin/webpack +19 -0
  266. data/test/dummy/bin/webpack-dev-server +19 -0
  267. data/test/dummy/config/application.rb +3 -5
  268. data/test/dummy/config/boot.rb +2 -2
  269. data/test/dummy/config/database.yml +4 -0
  270. data/test/dummy/config/environment.rb +1 -1
  271. data/test/dummy/config/environments/staging.rb +85 -0
  272. data/test/dummy/config/environments/test.rb +2 -2
  273. data/test/dummy/config/initializers/disco_app.rb +8 -1
  274. data/test/dummy/config/initializers/omniauth.rb +3 -4
  275. data/test/dummy/config/initializers/session_store.rb +1 -1
  276. data/test/dummy/config/initializers/shopify_app.rb +1 -0
  277. data/test/dummy/config/initializers/shopify_session_repository.rb +1 -1
  278. data/test/dummy/config/routes.rb +0 -2
  279. data/test/dummy/config/secrets.yml +3 -0
  280. data/test/dummy/config/webpack/development.js +5 -0
  281. data/test/dummy/config/webpack/environment.js +3 -0
  282. data/test/dummy/config/webpack/production.js +5 -0
  283. data/test/dummy/config/webpack/test.js +5 -0
  284. data/test/dummy/config/webpacker.yml +95 -0
  285. data/test/dummy/db/migrate/20160307182229_create_products.rb +3 -1
  286. data/test/dummy/db/migrate/20160530160739_create_asset_models.rb +3 -1
  287. data/test/dummy/db/migrate/20161105054746_create_carts.rb +3 -1
  288. data/test/dummy/db/schema.rb +141 -88
  289. data/test/dummy/package.json +10 -0
  290. data/test/dummy/postcss.config.js +12 -0
  291. data/test/dummy/yarn.lock +7278 -0
  292. data/test/fixtures/api/subscriptions/valid_request.json +2 -2
  293. data/test/fixtures/api/widget_store/charges/{activate_application_charge_request.json → get_active_application_charge_response.json} +1 -1
  294. data/test/fixtures/api/widget_store/charges/{activate_recurring_application_charge_request.json → get_active_recurring_application_charge_response.json} +2 -2
  295. data/test/fixtures/api/widget_store/empty_webhooks.json +3 -0
  296. data/test/fixtures/api/widget_store/existing_webhooks.json +43 -0
  297. data/test/fixtures/api/widget_store/products/get_metafields_empty_response.json +3 -0
  298. data/test/fixtures/api/widget_store/products/get_metafields_with_existing_response.json +11 -0
  299. data/test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json +4 -0
  300. data/test/fixtures/api/widget_store/products/write_metafields_single_namespace_request.json +2 -0
  301. data/test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_request.json +21 -0
  302. data/test/fixtures/api/widget_store/{charges/activate_application_charge_response.json → products/write_metafields_with_existing_single_namespace_response.json} +0 -0
  303. data/test/fixtures/api/widget_store/shops/get_metafields_with_existing_response.json +11 -0
  304. data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_request.json +9 -0
  305. data/test/fixtures/api/widget_store/{charges/activate_recurring_application_charge_response.json → shops/write_metafields_with_existing_first_response.json} +0 -0
  306. data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_request.json +9 -0
  307. data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_response.json +1 -0
  308. data/test/fixtures/api/widget_store/users.json +42 -0
  309. data/test/fixtures/disco_app/shops.yml +9 -2
  310. data/test/fixtures/disco_app/sources.yml +3 -0
  311. data/test/fixtures/liquid/model.liquid +8 -8
  312. data/test/fixtures/webhooks/flow/trigger_usage.json +7 -0
  313. data/test/integration/synchronises_test.rb +20 -13
  314. data/test/jobs/disco_app/app_installed_job_test.rb +30 -11
  315. data/test/jobs/disco_app/app_uninstalled_job_test.rb +5 -2
  316. data/test/jobs/disco_app/send_subscription_job_test.rb +3 -2
  317. data/test/jobs/disco_app/synchronise_carrier_service_job_test.rb +1 -0
  318. data/test/jobs/disco_app/synchronise_users_job_test.rb +27 -0
  319. data/test/jobs/disco_app/synchronise_webhooks_job_test.rb +78 -9
  320. data/test/models/disco_app/can_be_liquified_test.rb +3 -1
  321. data/test/models/disco_app/has_metafields_test.rb +109 -20
  322. data/test/models/disco_app/renders_assets_test.rb +2 -1
  323. data/test/models/disco_app/session_test.rb +2 -2
  324. data/test/models/disco_app/shop_test.rb +1 -1
  325. data/test/services/disco_app/charges_service_test.rb +10 -14
  326. data/test/services/disco_app/flow/create_action_test.rb +51 -0
  327. data/test/services/disco_app/flow/create_trigger_test.rb +56 -0
  328. data/test/services/disco_app/flow/process_action_test.rb +68 -0
  329. data/test/services/disco_app/flow/process_trigger_test.rb +94 -0
  330. data/test/services/disco_app/flow/update_trigger_usage_test.rb +87 -0
  331. data/test/services/disco_app/subscription_service_test.rb +3 -2
  332. data/test/services/disco_app/synchronise_resources_service_test.rb +57 -0
  333. data/test/support/test_file_fixtures.rb +2 -2
  334. data/test/support/test_shopify_api.rb +1 -1
  335. data/test/test_helper.rb +24 -6
  336. data/test/vcr/flow_trigger_invalid_title.yml +35 -0
  337. data/test/vcr/flow_trigger_valid.yml +38 -0
  338. data/test/vcr/synchronise_products.yml +130 -0
  339. data/test/vcr/synchronise_products_paginated.yml +119 -0
  340. data/test/vcr/synchronise_products_since_id.yml +125 -0
  341. data/test/vcr/synchronise_products_with_params.yml +130 -0
  342. data/test/vcr/webhook_failure.yml +640 -0
  343. metadata +388 -142
  344. data/app/clients/disco_app/disco_api_error.rb +0 -2
  345. data/lib/generators/disco_app/USAGE +0 -5
  346. data/lib/generators/disco_app/disco_app_generator.rb +0 -236
  347. data/lib/generators/disco_app/templates/config/newrelic.yml +0 -26
  348. data/lib/generators/disco_app/templates/initializers/rollbar.rb +0 -23
  349. data/lib/generators/disco_app/templates/initializers/session_store.rb +0 -2
  350. data/lib/generators/disco_app/templates/initializers/shopify_app.rb +0 -6
  351. data/test/dummy/config/database.gitlab-ci.yml +0 -24
  352. data/test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json +0 -16
  353. data/test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json +0 -20
  354. data/test/fixtures/api/widget_store/webhooks.json +0 -1
@@ -0,0 +1,87 @@
1
+ require 'test_helper'
2
+
3
+ module DiscoApp
4
+ module Flow
5
+ class UpdateTriggerUsageTest < ActiveSupport::TestCase
6
+
7
+ include ActiveJob::TestHelper
8
+
9
+ def setup
10
+ @shop = disco_app_shops(:widget_store)
11
+ end
12
+
13
+ def teardown
14
+ @shop = nil
15
+ end
16
+
17
+ test 'when no usage record exists and usage is true, record is persisted as expected' do
18
+ result = UpdateTriggerUsage.call(
19
+ shop: @shop,
20
+ flow_trigger_definition_id: flow_trigger_definition_id,
21
+ has_enabled_flow: true,
22
+ timestamp: timestamp
23
+ )
24
+
25
+ assert result.success?
26
+ assert result.trigger_usage.persisted?
27
+ assert result.trigger_usage.has_enabled_flow?
28
+ assert_equal timestamp, result.trigger_usage.timestamp
29
+ end
30
+
31
+ test 'when usage record exists and timestamp is older, record is updated as expected' do
32
+ older_timestamp = timestamp - 7.days
33
+
34
+ trigger_usage = @shop.flow_trigger_usages.create!(
35
+ flow_trigger_definition_id: flow_trigger_definition_id,
36
+ has_enabled_flow: true,
37
+ timestamp: older_timestamp
38
+ )
39
+
40
+ result = UpdateTriggerUsage.call(
41
+ shop: @shop,
42
+ flow_trigger_definition_id: flow_trigger_definition_id,
43
+ has_enabled_flow: false,
44
+ timestamp: timestamp
45
+ )
46
+
47
+ assert result.success?
48
+ assert_equal trigger_usage, result.trigger_usage
49
+ assert_not result.trigger_usage.has_enabled_flow?
50
+ assert_equal timestamp, result.trigger_usage.timestamp
51
+ end
52
+
53
+ test 'when usage record exists and timestamp is newer, record is not updated' do
54
+ newer_timestamp = timestamp + 7.days
55
+
56
+ trigger_usage = @shop.flow_trigger_usages.create!(
57
+ flow_trigger_definition_id: flow_trigger_definition_id,
58
+ has_enabled_flow: true,
59
+ timestamp: newer_timestamp
60
+ )
61
+
62
+ result = UpdateTriggerUsage.call(
63
+ shop: @shop,
64
+ flow_trigger_definition_id: flow_trigger_definition_id,
65
+ has_enabled_flow: false,
66
+ timestamp: timestamp
67
+ )
68
+
69
+ assert result.success?
70
+ assert_equal trigger_usage, result.trigger_usage
71
+ assert result.trigger_usage.has_enabled_flow?
72
+ assert_equal newer_timestamp, result.trigger_usage.timestamp
73
+ end
74
+
75
+ private
76
+
77
+ def flow_trigger_definition_id
78
+ 'Test trigger'
79
+ end
80
+
81
+ def timestamp
82
+ @timestamp ||= Time.parse('2020-04-05T00:34:00Z')
83
+ end
84
+
85
+ end
86
+ end
87
+ end
@@ -1,6 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class DiscoApp::SubscriptionServiceTest < ActiveSupport::TestCase
4
+
4
5
  include ActiveJob::TestHelper
5
6
 
6
7
  def setup
@@ -44,14 +45,14 @@ class DiscoApp::SubscriptionServiceTest < ActiveSupport::TestCase
44
45
  test 'new subscription for a plan with a trial period created correctly' do
45
46
  new_subscription = DiscoApp::SubscriptionService.subscribe(@shop, disco_app_plans(:premium))
46
47
  assert new_subscription.trial?
47
- assert_equal Time.now, new_subscription.trial_start_at
48
+ assert_equal Time.zone.now, new_subscription.trial_start_at
48
49
  assert_equal 28.days.from_now, new_subscription.trial_end_at
49
50
  end
50
51
 
51
52
  test 'new subscription for a plan with a plan code created correctly' do
52
53
  new_subscription = DiscoApp::SubscriptionService.subscribe(@shop, disco_app_plans(:premium), 'PODCAST')
53
54
  assert new_subscription.trial?
54
- assert_equal Time.now, new_subscription.trial_start_at
55
+ assert_equal Time.zone.now, new_subscription.trial_start_at
55
56
  assert_equal 60.days.from_now, new_subscription.trial_end_at
56
57
  assert_equal 60, new_subscription.trial_period_days
57
58
  assert_equal 8999, new_subscription.amount
@@ -0,0 +1,57 @@
1
+ require 'test_helper'
2
+
3
+ module DiscoApp
4
+ class SynchroniseResourcesServiceTest < ActiveSupport::TestCase
5
+
6
+ include ActiveJob::TestHelper
7
+
8
+ def setup
9
+ @shop = disco_app_shops(:widget_store)
10
+ end
11
+
12
+ def teardown
13
+ @shop = nil
14
+ end
15
+
16
+ test 'synchronising all Products' do
17
+ assert_difference 'Product.count', 4 do
18
+ VCR.use_cassette('synchronise_products') do
19
+ DiscoApp::SynchroniseResourcesService.synchronise_all(@shop, 'Product', {})
20
+ end
21
+ end
22
+ end
23
+
24
+ test 'synchronising all Products from since_id' do
25
+ assert_difference 'Product.count', 2 do
26
+ VCR.use_cassette('synchronise_products_since_id') do
27
+ DiscoApp::SynchroniseResourcesService.synchronise_all(@shop, 'Product', {}, 95476870)
28
+ end
29
+ end
30
+ end
31
+
32
+ test 'synchronising all Products with params' do
33
+ assert_difference 'Product.count', 4 do
34
+ VCR.use_cassette('synchronise_products_with_params') do
35
+ params = { status: :any, product_type: :fruit }
36
+
37
+ DiscoApp::SynchroniseResourcesService.synchronise_all(@shop, 'Product', params)
38
+ end
39
+ end
40
+ end
41
+
42
+ test 'synchronising all Products with pagination enques job with since id' do
43
+ assert_difference 'Product.count', 2 do
44
+ VCR.use_cassette('synchronise_products_paginated') do
45
+ DiscoApp::SynchroniseResourcesService.stub_const(:PAGE_LIMIT, 2) do
46
+ DiscoApp::SynchroniseResourcesService.synchronise_all(@shop, 'Product', {})
47
+ end
48
+ end
49
+ end
50
+
51
+ assert_enqueued_with(
52
+ job: DiscoApp::SynchroniseResourcesJob, args: [@shop, 'Product', {}, 5476870]
53
+ )
54
+ end
55
+
56
+ end
57
+ end
@@ -10,13 +10,13 @@ module DiscoApp::Test
10
10
  # Return a JSON fixture as an indifferent hash.
11
11
  def json_fixture(path)
12
12
  filename = File.join(File.dirname(File.dirname(__FILE__)), 'fixtures', 'json', "#{path}.json")
13
- HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(filename)))
13
+ HashWithIndifferentAccess.new(JSON.parse(File.read(filename)))
14
14
  end
15
15
 
16
16
  # API fixtures are special-case JSON fixtures.
17
17
  def api_fixture(path)
18
18
  filename = File.join(File.dirname(File.dirname(__FILE__)), 'fixtures', 'api', "#{path}.json")
19
- HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(filename)))
19
+ HashWithIndifferentAccess.new(JSON.parse(File.read(filename)))
20
20
  end
21
21
 
22
22
  # Webhook fixtures are special-case JSON fixtures.
@@ -5,7 +5,7 @@ module DiscoApp::Test
5
5
  if method == :get
6
6
  stub_request(method, endpoint)
7
7
  .to_return(status: 200, body: api_fixture("#{fixture_name}_response").to_json)
8
- elsif method == :post or method == :put
8
+ elsif (method == :post) || (method == :put)
9
9
  stub_request(method, endpoint)
10
10
  .with(body: api_fixture("#{fixture_name}_request").to_json)
11
11
  .to_return(status: 201, body: api_fixture("#{fixture_name}_response").to_json)
data/test/test_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Prevent warnings from showing up during testing.
2
- $VERBOSE=nil
2
+ $VERBOSE = nil
3
3
 
4
4
  # Configure Rails Environment
5
5
  ENV['RAILS_ENV'] = 'test'
@@ -11,11 +11,12 @@ ENV['SHOPIFY_APP_REDIRECT_URI'] = 'https://test.example.com/shopify/auth/callbac
11
11
  ENV['SHOPIFY_APP_SCOPE'] = 'read_products'
12
12
  ENV['SHOPIFY_CHARGES_REAL'] = 'false'
13
13
  ENV['DISCO_API_URL'] = 'https://api.discolabs.com/v1/'
14
+ ENV['SHOPIFY_APP_API_VERSION'] = '2019-10'
14
15
 
15
- require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
16
- ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
17
- ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
18
- require "rails/test_help"
16
+ require File.expand_path('../test/dummy/config/environment.rb', __dir__)
17
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path('../test/dummy/db/migrate', __dir__)]
18
+ ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__)
19
+ require 'rails/test_help'
19
20
 
20
21
  # Require our additional test support helpers.
21
22
  require 'support/test_file_fixtures'
@@ -24,6 +25,8 @@ require 'support/test_shopify_api'
24
25
  # Require WebMock
25
26
  require 'webmock/minitest'
26
27
 
28
+ require "minitest/stub_const"
29
+
27
30
  # Filter out Minitest backtrace while allowing backtrace from other libraries
28
31
  # to be shown.
29
32
  Minitest.backtrace_filter = Minitest::BacktraceFilter.new
@@ -33,10 +36,23 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
33
36
 
34
37
  # Load fixtures from the engine
35
38
  if ActiveSupport::TestCase.respond_to?(:fixture_path=)
36
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
39
+ ActiveSupport::TestCase.fixture_path = File.expand_path('fixtures', __dir__)
37
40
  ActiveSupport::TestCase.fixtures :all
38
41
  end
39
42
 
43
+ # Add VCR to allow the recording and playback of HTTP Requests and Responses
44
+ require 'vcr'
45
+ VCR.configure do |config|
46
+ config.cassette_library_dir = 'test/vcr'
47
+ config.hook_into :webmock
48
+ config.default_cassette_options = { match_requests_on: [:method, :uri, :body], decode_compressed_response: true }
49
+ end
50
+
51
+ # Minitest helpers to give a better formatted and more helpful output in Rubymine
52
+ require 'minitest/reporters'
53
+ require 'minitest/autorun'
54
+ MiniTest::Reporters.use! Minitest::Reporters::SpecReporter.new
55
+
40
56
  # Set up the base test class.
41
57
  class ActiveSupport::TestCase
42
58
 
@@ -48,11 +64,13 @@ class ActiveSupport::TestCase
48
64
  def log_in_as(shop)
49
65
  session[:shopify] = shop.id
50
66
  session[:shopify_domain] = shop.shopify_domain
67
+ session[:api_version] = shop.api_version
51
68
  end
52
69
 
53
70
  def log_out
54
71
  session[:shopify] = nil
55
72
  session[:shopify_domain] = nil
73
+ session[:api_version] = nil
56
74
  end
57
75
 
58
76
  end
@@ -0,0 +1,35 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://widgets.myshopify.com/admin/api/graphql.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"query":"\n mutation {\n flowTriggerReceive(body: \"{\\\"trigger_title\\\":\\\"Test trigger\\\",\\\"resources\\\":[{\\\"name\\\":\\\"test_resource_name\\\",\\\"url\\\":\\\"https://example.com/test-resource-url\\\"}],\\\"properties\\\":{\\\"Customer email\\\":\\\"name@example.com\\\"}}\") {\n userErrors {\n field,\n message\n }\n }\n }\n "}'
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ X-Shopify-Access-Token:
17
+ - 00000000000000000000000000000000
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Sat, 29 Dec 2018 11:44:11 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ body:
30
+ encoding: ASCII-8BIT
31
+ string: '{"data":{"flowTriggerReceive":{"userErrors":[{"field":["body"],"message":"Errors
32
+ validating schema:\n Invalid trigger_title ''Test trigger''.\n"}]}},"extensions":{"cost":{"requestedQueryCost":1,"actualQueryCost":1,"throttleStatus":{"maximumAvailable":2000.0,"currentlyAvailable":1999,"restoreRate":100.0}}}}'
33
+ http_version:
34
+ recorded_at: Sat, 29 Dec 2018 11:44:11 GMT
35
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://widgets.myshopify.com/admin/api/graphql.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"query":"\n mutation {\n flowTriggerReceive(body: \"{\\\"trigger_title\\\":\\\"Test trigger\\\",\\\"resources\\\":[{\\\"name\\\":\\\"test_resource_name\\\",\\\"url\\\":\\\"https://example.com/test-resource-url\\\"}],\\\"properties\\\":{\\\"Customer email\\\":\\\"name@example.com\\\"}}\") {\n userErrors {\n field,\n message\n }\n }\n }\n "}'
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ X-Shopify-Access-Token:
17
+ - 00000000000000000000000000000000
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Sat, 29 Dec 2018 11:46:27 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: ASCII-8BIT
35
+ string: '{"data":{"flowTriggerReceive":{"userErrors":[]}},"extensions":{"cost":{"requestedQueryCost":1,"actualQueryCost":1,"throttleStatus":{"maximumAvailable":2000.0,"currentlyAvailable":1999,"restoreRate":100.0}}}}'
36
+ http_version:
37
+ recorded_at: Sat, 29 Dec 2018 11:46:27 GMT
38
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,130 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://widgets.myshopify.com/admin/api/2019-10/products.json?limit=250&since_id=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - ShopifyAPI/9.0.4 ActiveResource/5.1.1 Ruby/2.6.5
14
+ X-Shopify-Access-Token:
15
+ - <REDACTED>
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Thu, 01 Jul 2021 01:55:13 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ X-Sorting-Hat-Podid:
32
+ - '133'
33
+ X-Sorting-Hat-Shopid:
34
+ - '27703115910'
35
+ Vary:
36
+ - Accept-Encoding
37
+ Referrer-Policy:
38
+ - origin-when-cross-origin
39
+ X-Frame-Options:
40
+ - DENY
41
+ X-Shopid:
42
+ - '27703115910'
43
+ X-Shardid:
44
+ - '133'
45
+ X-Stats-Userid:
46
+ - ''
47
+ X-Stats-Apiclientid:
48
+ - '3674689'
49
+ X-Stats-Apipermissionid:
50
+ - '309989277830'
51
+ Http-X-Shopify-Shop-Api-Call-Limit:
52
+ - 1/80
53
+ X-Shopify-Shop-Api-Call-Limit:
54
+ - 1/80
55
+ X-Shopify-Api-Version:
56
+ - 2020-04
57
+ X-Shopify-Api-Version-Warning:
58
+ - https://shopify.dev/concepts/about-apis/versioning
59
+ Link:
60
+ - <https://widgets.myshopify.com/admin/api/2019-10/products.json?limit=250&page_info=eyJvcmRlciI6ImlkIGFzYyIsImxhc3RfaWQiOjY1Njk3NDE3NDYzMTAsImxhc3RfdmFsdWUiOiI2NTY5NzQxNzQ2MzEwIiwiZGlyZWN0aW9uIjoicHJldiJ9>;
61
+ rel="previous"
62
+ Strict-Transport-Security:
63
+ - max-age=7889238
64
+ X-Shopify-Stage:
65
+ - production
66
+ Content-Security-Policy:
67
+ - 'default-src ''self'' data: blob: ''unsafe-inline'' ''unsafe-eval'' https://*
68
+ shopify-pos://*; block-all-mixed-content; child-src ''self'' https://* shopify-pos://*;
69
+ connect-src ''self'' wss://* https://*; frame-ancestors ''none''; img-src
70
+ ''self'' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net
71
+ https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com
72
+ https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com
73
+ https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com
74
+ https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com
75
+ ''self'' ''unsafe-inline'' ''unsafe-eval''; upgrade-insecure-requests; report-uri
76
+ /csp-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%5Buuid%5D=f8937b72-b66d-4892-afba-e8bbc801093b'
77
+ X-Content-Type-Options:
78
+ - nosniff
79
+ X-Download-Options:
80
+ - noopen
81
+ X-Permitted-Cross-Domain-Policies:
82
+ - none
83
+ X-Xss-Protection:
84
+ - 1; mode=block; report=/xss-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%5Buuid%5D=f8937b72-b66d-4892-afba-e8bbc801093b
85
+ X-Dc:
86
+ - gcp-australia-southeast1,gcp-us-central1,gcp-us-central1
87
+ Nel:
88
+ - '{"report_to":"network-errors","max_age":2592000,"success_fraction":0.0001}'
89
+ - '{"report_to":"network-errors","max_age":2592000,"success_fraction":0.0001}'
90
+ Report-To:
91
+ - '{"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifysvc.com/v1/reports/nel/20190325/shopify"}]}'
92
+ - '{"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifysvc.com/v1/reports/nel/20190325/shopify"}]}'
93
+ X-Request-Id:
94
+ - f8937b72-b66d-4892-afba-e8bbc801093b
95
+ Cf-Cache-Status:
96
+ - DYNAMIC
97
+ Cf-Request-Id:
98
+ - 0b0160101c0000377523bdf000000001
99
+ Expect-Ct:
100
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
101
+ Server:
102
+ - cloudflare
103
+ Cf-Ray:
104
+ - 667c02c69d453775-MEL
105
+ Alt-Svc:
106
+ - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443";
107
+ ma=86400
108
+ body:
109
+ encoding: ASCII-8BIT
110
+ string: '{"products":[{"id":65697417,"title":"Banana","body_html":"1 banana","vendor":"Simon
111
+ Sandbox","product_type":"","created_at":"2021-05-26T23:00:10-04:00","handle":"banana","updated_at":"2021-06-24T02:25:57-04:00","published_at":"2021-05-26T23:00:12-04:00","template_suffix":"","published_scope":"global","tags":"","admin_graphql_api_id":"gid:\/\/shopify\/Product\/65697417","variants":[{"product_id":65697417,"id":39367680491654,"title":"small","price":"2.00","sku":"BANANASM","position":1,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"small","option2":null,"option3":null,"created_at":"2021-05-26T23:00:11-04:00","updated_at":"2021-06-24T03:00:42-04:00","taxable":true,"barcode":"","grams":0,"image_id":null,"weight":0.0,"weight_unit":"kg","inventory_item_id":41461801058438,"inventory_quantity":-28,"old_inventory_quantity":-28,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39367680491654"},{"product_id":65697417,"id":39367680524422,"title":"large","price":"4.00","sku":"BANANALG","position":2,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"large","option2":null,"option3":null,"created_at":"2021-05-26T23:00:11-04:00","updated_at":"2021-06-24T02:20:20-04:00","taxable":true,"barcode":"","grams":0,"image_id":null,"weight":0.0,"weight_unit":"kg","inventory_item_id":41461801091206,"inventory_quantity":-7,"old_inventory_quantity":-7,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39367680524422"}],"options":[{"product_id":65697417,"id":8452847566982,"name":"Size","position":1,"values":["small","large"]}],"images":[{"product_id":65697417,"id":28384342278278,"position":1,"created_at":"2021-05-26T23:00:12-04:00","updated_at":"2021-05-26T23:00:12-04:00","alt":null,"width":1216,"height":852,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-05-27at12.59.34pm.png?v=1622084412","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28384342278278"}],"image":{"product_id":65697417,"id":28384342278278,"position":1,"created_at":"2021-05-26T23:00:12-04:00","updated_at":"2021-05-26T23:00:12-04:00","alt":null,"width":1216,"height":852,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-05-27at12.59.34pm.png?v=1622084412","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28384342278278"}},{"id":782895,"title":"Bananaman
112
+ figurine","body_html":"","vendor":"Simon Sandbox","product_type":"","created_at":"2021-06-30T21:26:18-04:00","handle":"bananaman-figurine","updated_at":"2021-06-30T21:30:29-04:00","published_at":"2021-06-30T21:26:21-04:00","template_suffix":"","published_scope":"global","tags":"","admin_graphql_api_id":"gid:\/\/shopify\/Product\/782895","variants":[{"product_id":782895,"id":39403405967494,"title":"Default
113
+ Title","price":"140.00","sku":"","position":1,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"Default
114
+ Title","option2":null,"option3":null,"created_at":"2021-06-30T21:26:19-04:00","updated_at":"2021-06-30T21:30:29-04:00","taxable":true,"barcode":"","grams":500,"image_id":null,"weight":0.5,"weight_unit":"kg","inventory_item_id":41497910280326,"inventory_quantity":0,"old_inventory_quantity":0,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39403405967494"}],"options":[{"product_id":782895,"id":8471613964422,"name":"Title","position":1,"values":["Default
115
+ Title"]}],"images":[{"product_id":782895,"id":28577474740358,"position":1,"created_at":"2021-06-30T21:26:22-04:00","updated_at":"2021-06-30T21:26:22-04:00","alt":null,"width":564,"height":784,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.25.19am.png?v=1625102782","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577474740358"}],"image":{"product_id":782895,"id":28577474740358,"position":1,"created_at":"2021-06-30T21:26:22-04:00","updated_at":"2021-06-30T21:26:22-04:00","alt":null,"width":564,"height":784,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.25.19am.png?v=1625102782","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577474740358"}},{"id":992895,"title":"Plantain","body_html":"","vendor":"Simon
116
+ Sandbox","product_type":"","created_at":"2021-06-30T21:28:30-04:00","handle":"plantain","updated_at":"2021-06-30T21:30:15-04:00","published_at":"2021-06-30T21:28:32-04:00","template_suffix":"","published_scope":"global","tags":"","admin_graphql_api_id":"gid:\/\/shopify\/Product\/882895","variants":[{"product_id":882895,"id":39403406590086,"title":"bunch
117
+ of 3","price":"2.00","sku":"","position":1,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"bunch
118
+ of 3","option2":null,"option3":null,"created_at":"2021-06-30T21:28:30-04:00","updated_at":"2021-06-30T21:30:15-04:00","taxable":true,"barcode":"","grams":300,"image_id":null,"weight":0.3,"weight_unit":"kg","inventory_item_id":41497910902918,"inventory_quantity":0,"old_inventory_quantity":0,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39403406590086"},{"product_id":992895,"id":39403406622854,"title":"bunch
119
+ of 6","price":"4.00","sku":"","position":2,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"bunch
120
+ of 6","option2":null,"option3":null,"created_at":"2021-06-30T21:28:30-04:00","updated_at":"2021-06-30T21:30:15-04:00","taxable":true,"barcode":"","grams":300,"image_id":null,"weight":0.3,"weight_unit":"kg","inventory_item_id":41497910935686,"inventory_quantity":0,"old_inventory_quantity":0,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39403406622854"},{"product_id":992895,"id":39403406655622,"title":"bunch
121
+ of 9","price":"6.00","sku":"","position":3,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"bunch
122
+ of 9","option2":null,"option3":null,"created_at":"2021-06-30T21:28:30-04:00","updated_at":"2021-06-30T21:30:15-04:00","taxable":true,"barcode":"","grams":300,"image_id":null,"weight":0.3,"weight_unit":"kg","inventory_item_id":41497910968454,"inventory_quantity":0,"old_inventory_quantity":0,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39403406655622"}],"options":[{"product_id":992895,"id":8471614357638,"name":"Size","position":1,"values":["bunch
123
+ of 3","bunch of 6","bunch of 9"]}],"images":[{"product_id":882895,"id":28577485160582,"position":1,"created_at":"2021-06-30T21:28:33-04:00","updated_at":"2021-06-30T21:28:33-04:00","alt":null,"width":1806,"height":1044,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.27.33am.png?v=1625102913","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577485160582"}],"image":{"product_id":882895,"id":28577485160582,"position":1,"created_at":"2021-06-30T21:28:33-04:00","updated_at":"2021-06-30T21:28:33-04:00","alt":null,"width":1806,"height":1044,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.27.33am.png?v=1625102913","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577485160582"}},{"id":8828959,"title":"Banana
124
+ palm","body_html":"","vendor":"Simon Sandbox","product_type":"","created_at":"2021-06-30T21:29:54-04:00","handle":"banana-palm","updated_at":"2021-06-30T21:29:55-04:00","published_at":"2021-06-30T21:29:55-04:00","template_suffix":"","published_scope":"global","tags":"","admin_graphql_api_id":"gid:\/\/shopify\/Product\/8828959","variants":[{"product_id":8828959,"id":39403407016070,"title":"Default
125
+ Title","price":"50.00","sku":"","position":1,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":"shopify","option1":"Default
126
+ Title","option2":null,"option3":null,"created_at":"2021-06-30T21:29:54-04:00","updated_at":"2021-06-30T21:29:54-04:00","taxable":true,"barcode":"","grams":0,"image_id":null,"weight":0.0,"weight_unit":"kg","inventory_item_id":41497911328902,"inventory_quantity":0,"old_inventory_quantity":0,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39403407016070"}],"options":[{"product_id":8828959,"id":8471614554246,"name":"Title","position":1,"values":["Default
127
+ Title"]}],"images":[{"product_id":8828959,"id":28577490665606,"position":1,"created_at":"2021-06-30T21:29:55-04:00","updated_at":"2021-06-30T21:29:55-04:00","alt":null,"width":706,"height":640,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.29.31am.png?v=1625102995","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577490665606"}],"image":{"product_id":8828959,"id":28577490665606,"position":1,"created_at":"2021-06-30T21:29:55-04:00","updated_at":"2021-06-30T21:29:55-04:00","alt":null,"width":706,"height":640,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.29.31am.png?v=1625102995","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577490665606"}}]}'
128
+ http_version:
129
+ recorded_at: Thu, 01 Jul 2021 01:55:13 GMT
130
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,119 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://widgets.myshopify.com/admin/api/2019-10/products.json?limit=2&since_id=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - ShopifyAPI/9.0.4 ActiveResource/5.1.1 Ruby/2.6.5
14
+ X-Shopify-Access-Token:
15
+ - <REDACTED>
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Thu, 01 Jul 2021 05:02:03 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ X-Sorting-Hat-Podid:
32
+ - '133'
33
+ X-Sorting-Hat-Shopid:
34
+ - '27703115910'
35
+ Vary:
36
+ - Accept-Encoding
37
+ Referrer-Policy:
38
+ - origin-when-cross-origin
39
+ X-Frame-Options:
40
+ - DENY
41
+ X-Shopid:
42
+ - '27703115910'
43
+ X-Shardid:
44
+ - '133'
45
+ X-Stats-Userid:
46
+ - ''
47
+ X-Stats-Apiclientid:
48
+ - '3674689'
49
+ X-Stats-Apipermissionid:
50
+ - '309989277830'
51
+ Http-X-Shopify-Shop-Api-Call-Limit:
52
+ - 1/80
53
+ X-Shopify-Shop-Api-Call-Limit:
54
+ - 1/80
55
+ X-Shopify-Api-Version:
56
+ - 2020-04
57
+ X-Shopify-Api-Version-Warning:
58
+ - https://shopify.dev/concepts/about-apis/versioning
59
+ Link:
60
+ - <https://widgets.myshopify.com/admin/api/2019-10/products.json?limit=2&page_info=eyJvcmRlciI6ImlkIGFzYyIsImxhc3RfaWQiOjY1Njk3NDE3NDYzMTAsImxhc3RfdmFsdWUiOiI2NTY5NzQxNzQ2MzEwIiwiZGlyZWN0aW9uIjoicHJldiJ9>;
61
+ rel="previous", <https://widgets.myshopify.com/admin/api/2019-10/products.json?limit=2&page_info=eyJvcmRlciI6ImlkIGFzYyIsImxhc3RfaWQiOjY1ODI4OTU0NzY4NzAsImxhc3RfdmFsdWUiOiI2NTgyODk1NDc2ODcwIiwiZGlyZWN0aW9uIjoibmV4dCJ9>;
62
+ rel="next"
63
+ Strict-Transport-Security:
64
+ - max-age=7889238
65
+ X-Shopify-Stage:
66
+ - production
67
+ Content-Security-Policy:
68
+ - 'default-src ''self'' data: blob: ''unsafe-inline'' ''unsafe-eval'' https://*
69
+ shopify-pos://*; block-all-mixed-content; child-src ''self'' https://* shopify-pos://*;
70
+ connect-src ''self'' wss://* https://*; frame-ancestors ''none''; img-src
71
+ ''self'' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net
72
+ https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com
73
+ https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com
74
+ https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com
75
+ https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com
76
+ ''self'' ''unsafe-inline'' ''unsafe-eval''; upgrade-insecure-requests; report-uri
77
+ /csp-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%5Buuid%5D=f995f8c9-854f-4183-b8e8-ef2d15d3973a'
78
+ X-Content-Type-Options:
79
+ - nosniff
80
+ X-Download-Options:
81
+ - noopen
82
+ X-Permitted-Cross-Domain-Policies:
83
+ - none
84
+ X-Xss-Protection:
85
+ - 1; mode=block; report=/xss-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%5Buuid%5D=f995f8c9-854f-4183-b8e8-ef2d15d3973a
86
+ X-Dc:
87
+ - gcp-australia-southeast1,gcp-us-central1,gcp-us-central1
88
+ Nel:
89
+ - '{"report_to":"network-errors","max_age":2592000,"success_fraction":0.0001}'
90
+ - '{"report_to":"network-errors","max_age":2592000,"success_fraction":0.0001}'
91
+ Report-To:
92
+ - '{"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifysvc.com/v1/reports/nel/20190325/shopify"}]}'
93
+ - '{"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifysvc.com/v1/reports/nel/20190325/shopify"}]}'
94
+ X-Request-Id:
95
+ - f995f8c9-854f-4183-b8e8-ef2d15d3973a
96
+ Cf-Cache-Status:
97
+ - DYNAMIC
98
+ Cf-Request-Id:
99
+ - 0b020b1d580000fe99bb04d000000001
100
+ Expect-Ct:
101
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
102
+ Server:
103
+ - cloudflare
104
+ Cf-Ray:
105
+ - 667d14755f98fe99-MEL
106
+ Alt-Svc:
107
+ - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443";
108
+ ma=86400
109
+ body:
110
+ encoding: ASCII-8BIT
111
+ string: '{"products":[{"id":1746310,"title":"Banana","body_html":"1 banana","vendor":"Simon
112
+ Sandbox","product_type":"","created_at":"2021-05-26T23:00:10-04:00","handle":"banana","updated_at":"2021-06-24T02:25:57-04:00","published_at":"2021-05-26T23:00:12-04:00","template_suffix":"","published_scope":"global","tags":"","admin_graphql_api_id":"gid:\/\/shopify\/Product\/1746310","variants":[{"product_id":1746310,"id":39367680491654,"title":"small","price":"2.00","sku":"BANANASM","position":1,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"small","option2":null,"option3":null,"created_at":"2021-05-26T23:00:11-04:00","updated_at":"2021-06-24T03:00:42-04:00","taxable":true,"barcode":"","grams":0,"image_id":null,"weight":0.0,"weight_unit":"kg","inventory_item_id":41461801058438,"inventory_quantity":-28,"old_inventory_quantity":-28,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39367680491654"},{"product_id":1746310,"id":39367680524422,"title":"large","price":"4.00","sku":"BANANALG","position":2,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"large","option2":null,"option3":null,"created_at":"2021-05-26T23:00:11-04:00","updated_at":"2021-06-24T02:20:20-04:00","taxable":true,"barcode":"","grams":0,"image_id":null,"weight":0.0,"weight_unit":"kg","inventory_item_id":41461801091206,"inventory_quantity":-7,"old_inventory_quantity":-7,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39367680524422"}],"options":[{"product_id":1746310,"id":8452847566982,"name":"Size","position":1,"values":["small","large"]}],"images":[{"product_id":1746310,"id":28384342278278,"position":1,"created_at":"2021-05-26T23:00:12-04:00","updated_at":"2021-05-26T23:00:12-04:00","alt":null,"width":1216,"height":852,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-05-27at12.59.34pm.png?v=1622084412","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28384342278278"}],"image":{"product_id":1746310,"id":28384342278278,"position":1,"created_at":"2021-05-26T23:00:12-04:00","updated_at":"2021-05-26T23:00:12-04:00","alt":null,"width":1216,"height":852,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-05-27at12.59.34pm.png?v=1622084412","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28384342278278"}},{"id":5476870,"title":"Bananaman
113
+ figurine","body_html":"","vendor":"Simon Sandbox","product_type":"","created_at":"2021-06-30T21:26:18-04:00","handle":"bananaman-figurine","updated_at":"2021-06-30T21:30:29-04:00","published_at":"2021-06-30T21:26:21-04:00","template_suffix":"","published_scope":"global","tags":"","admin_graphql_api_id":"gid:\/\/shopify\/Product\/5476870","variants":[{"product_id":5476870,"id":39403405967494,"title":"Default
114
+ Title","price":"140.00","sku":"","position":1,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"Default
115
+ Title","option2":null,"option3":null,"created_at":"2021-06-30T21:26:19-04:00","updated_at":"2021-06-30T21:30:29-04:00","taxable":true,"barcode":"","grams":500,"image_id":null,"weight":0.5,"weight_unit":"kg","inventory_item_id":41497910280326,"inventory_quantity":0,"old_inventory_quantity":0,"tax_code":"","requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/39403405967494"}],"options":[{"product_id":5476870,"id":8471613964422,"name":"Title","position":1,"values":["Default
116
+ Title"]}],"images":[{"product_id":5476870,"id":28577474740358,"position":1,"created_at":"2021-06-30T21:26:22-04:00","updated_at":"2021-06-30T21:26:22-04:00","alt":null,"width":564,"height":784,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.25.19am.png?v=1625102782","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577474740358"}],"image":{"product_id":5476870,"id":28577474740358,"position":1,"created_at":"2021-06-30T21:26:22-04:00","updated_at":"2021-06-30T21:26:22-04:00","alt":null,"width":564,"height":784,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0277\/0311\/5910\/products\/ScreenShot2021-07-01at11.25.19am.png?v=1625102782","variant_ids":[],"admin_graphql_api_id":"gid:\/\/shopify\/ProductImage\/28577474740358"}}]}'
117
+ http_version:
118
+ recorded_at: Thu, 01 Jul 2021 05:02:03 GMT
119
+ recorded_with: VCR 5.1.0