disco_app 0.18.1 → 0.18.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/disco_app/charges_controller.rb +6 -1
  3. data/app/jobs/disco_app/concerns/synchronise_resources_job.rb +2 -6
  4. data/app/models/disco_app/concerns/has_metafields.rb +100 -43
  5. data/app/models/disco_app/concerns/synchronises.rb +1 -5
  6. data/app/models/disco_app/concerns/taggable.rb +1 -1
  7. data/app/services/disco_app/charges_service.rb +9 -11
  8. data/app/services/disco_app/synchronise_resources_service.rb +54 -0
  9. data/lib/disco_app/version.rb +1 -1
  10. data/lib/generators/disco_app/install/install_generator.rb +1 -1
  11. data/lib/generators/disco_app/install/templates/root/.gitignore +18 -2
  12. data/test/controllers/disco_app/charges_controller_test.rb +1 -2
  13. data/test/dummy/app/models/disco_app/shop.rb +3 -0
  14. data/test/dummy/package.json +4 -2
  15. data/test/dummy/yarn.lock +1989 -1955
  16. data/test/fixtures/api/widget_store/charges/{activate_application_charge_request.json → get_active_application_charge_response.json} +1 -1
  17. data/test/fixtures/api/widget_store/charges/{activate_recurring_application_charge_request.json → get_active_recurring_application_charge_response.json} +2 -2
  18. data/test/fixtures/api/widget_store/products/get_metafields_empty_response.json +3 -0
  19. data/test/fixtures/api/widget_store/products/get_metafields_with_existing_response.json +11 -0
  20. data/test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json +4 -0
  21. data/test/fixtures/api/widget_store/products/write_metafields_single_namespace_request.json +2 -0
  22. data/test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_request.json +21 -0
  23. data/test/fixtures/api/widget_store/{charges/activate_application_charge_response.json → products/write_metafields_with_existing_single_namespace_response.json} +0 -0
  24. data/test/fixtures/api/widget_store/shops/get_metafields_with_existing_response.json +11 -0
  25. data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_request.json +9 -0
  26. data/test/fixtures/api/widget_store/{charges/activate_recurring_application_charge_response.json → shops/write_metafields_with_existing_first_response.json} +0 -0
  27. data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_request.json +9 -0
  28. data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_response.json +1 -0
  29. data/test/models/disco_app/has_metafields_test.rb +72 -2
  30. data/test/services/disco_app/charges_service_test.rb +3 -6
  31. data/test/services/disco_app/synchronise_resources_service_test.rb +57 -0
  32. data/test/test_helper.rb +2 -0
  33. data/test/vcr/synchronise_products.yml +130 -0
  34. data/test/vcr/synchronise_products_paginated.yml +119 -0
  35. data/test/vcr/synchronise_products_since_id.yml +125 -0
  36. data/test/vcr/synchronise_products_with_params.yml +130 -0
  37. metadata +51 -16
  38. data/test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json +0 -16
  39. data/test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json +0 -20
@@ -0,0 +1,125 @@
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=95476870
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 02:47:40 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=eyJvcmRlciI6ImlkIGFzYyIsImxhc3RfaWQiOjY1ODI4OTU3MzkwMTQsImxhc3RfdmFsdWUiOiI2NTgyODk1NzM5MDE0IiwiZGlyZWN0aW9uIjoicHJldiJ9>;
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=d2f21833-83e7-41ef-93b7-772bf65dd20b'
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=d2f21833-83e7-41ef-93b7-772bf65dd20b
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
+ - d2f21833-83e7-41ef-93b7-772bf65dd20b
95
+ Cf-Cache-Status:
96
+ - DYNAMIC
97
+ Cf-Request-Id:
98
+ - 0b0190164d00003779a6104000000001
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
+ - 667c4f9d4e1e3779-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":5739014,"title":"Plantain","body_html":"","vendor":"Simon
111
+ 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\/5739014","variants":[{"product_id":5739014,"id":39403406590086,"title":"bunch
112
+ of 3","price":"2.00","sku":"","position":1,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"bunch
113
+ 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":5739014,"id":39403406622854,"title":"bunch
114
+ of 6","price":"4.00","sku":"","position":2,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"bunch
115
+ 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":5739014,"id":39403406655622,"title":"bunch
116
+ of 9","price":"6.00","sku":"","position":3,"inventory_policy":"continue","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"bunch
117
+ 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":5739014,"id":8471614357638,"name":"Size","position":1,"values":["bunch
118
+ of 3","bunch of 6","bunch of 9"]}],"images":[{"product_id":5739014,"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":5739014,"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":935622,"title":"Banana
119
+ 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\/935622","variants":[{"product_id":935622,"id":39403407016070,"title":"Default
120
+ Title","price":"50.00","sku":"","position":1,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":"shopify","option1":"Default
121
+ 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":935622,"id":8471614554246,"name":"Title","position":1,"values":["Default
122
+ Title"]}],"images":[{"product_id":935622,"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":935622,"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"}}]}'
123
+ http_version:
124
+ recorded_at: Thu, 01 Jul 2021 02:47:40 GMT
125
+ recorded_with: VCR 5.1.0
@@ -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&product_type=fruit&since_id=0&status=any
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":"fruit","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":"fruit","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":"fruit","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":"fruit","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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_link_to
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 0.21.0
201
+ version: '1.1'
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 0.21.0
208
+ version: '1.1'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: premailer-rails
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -416,6 +416,20 @@ dependencies:
416
416
  - - '='
417
417
  - !ruby/object:Gem::Version
418
418
  version: '1.3'
419
+ - !ruby/object:Gem::Dependency
420
+ name: minitest-stub-const
421
+ requirement: !ruby/object:Gem::Requirement
422
+ requirements:
423
+ - - ">="
424
+ - !ruby/object:Gem::Version
425
+ version: '0'
426
+ type: :development
427
+ prerelease: false
428
+ version_requirements: !ruby/object:Gem::Requirement
429
+ requirements:
430
+ - - ">="
431
+ - !ruby/object:Gem::Version
432
+ version: '0'
419
433
  - !ruby/object:Gem::Dependency
420
434
  name: rubocop
421
435
  requirement: !ruby/object:Gem::Requirement
@@ -674,6 +688,7 @@ files:
674
688
  - app/services/disco_app/proxy_service.rb
675
689
  - app/services/disco_app/request_validation_service.rb
676
690
  - app/services/disco_app/subscription_service.rb
691
+ - app/services/disco_app/synchronise_resources_service.rb
677
692
  - app/services/disco_app/webhook_service.rb
678
693
  - app/views/disco_app/admin/app_settings/edit.html.erb
679
694
  - app/views/disco_app/admin/plans/_form.html.erb
@@ -18798,29 +18813,34 @@ files:
18798
18813
  - test/fixtures/api/widget_store/assets/update_script_tag_response.json
18799
18814
  - test/fixtures/api/widget_store/carrier_services.json
18800
18815
  - test/fixtures/api/widget_store/carrier_services_create.json
18801
- - test/fixtures/api/widget_store/charges/activate_application_charge_request.json
18802
- - test/fixtures/api/widget_store/charges/activate_application_charge_response.json
18803
- - test/fixtures/api/widget_store/charges/activate_recurring_application_charge_request.json
18804
- - test/fixtures/api/widget_store/charges/activate_recurring_application_charge_response.json
18805
18816
  - test/fixtures/api/widget_store/charges/create_application_charge_request.json
18806
18817
  - test/fixtures/api/widget_store/charges/create_application_charge_response.json
18807
18818
  - test/fixtures/api/widget_store/charges/create_recurring_application_charge_request.json
18808
18819
  - test/fixtures/api/widget_store/charges/create_recurring_application_charge_response.json
18809
18820
  - test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_request.json
18810
18821
  - test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_response.json
18811
- - test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json
18812
- - test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json
18822
+ - test/fixtures/api/widget_store/charges/get_active_application_charge_response.json
18823
+ - test/fixtures/api/widget_store/charges/get_active_recurring_application_charge_response.json
18813
18824
  - test/fixtures/api/widget_store/charges/get_declined_application_charge_response.json
18814
18825
  - test/fixtures/api/widget_store/charges/get_declined_recurring_application_charge_response.json
18815
18826
  - test/fixtures/api/widget_store/charges/get_pending_application_charge_response.json
18816
18827
  - test/fixtures/api/widget_store/charges/get_pending_recurring_application_charge_response.json
18817
18828
  - test/fixtures/api/widget_store/empty_webhooks.json
18818
18829
  - test/fixtures/api/widget_store/existing_webhooks.json
18830
+ - test/fixtures/api/widget_store/products/get_metafields_empty_response.json
18831
+ - test/fixtures/api/widget_store/products/get_metafields_with_existing_response.json
18819
18832
  - test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json
18820
18833
  - test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_response.json
18821
18834
  - test/fixtures/api/widget_store/products/write_metafields_single_namespace_request.json
18822
18835
  - test/fixtures/api/widget_store/products/write_metafields_single_namespace_response.json
18836
+ - test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_request.json
18837
+ - test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_response.json
18823
18838
  - test/fixtures/api/widget_store/shop.json
18839
+ - test/fixtures/api/widget_store/shops/get_metafields_with_existing_response.json
18840
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_request.json
18841
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_response.json
18842
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_request.json
18843
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_response.json
18824
18844
  - test/fixtures/api/widget_store/users.json
18825
18845
  - test/fixtures/assets/test.js
18826
18846
  - test/fixtures/assets/test.min.js
@@ -18863,11 +18883,16 @@ files:
18863
18883
  - test/services/disco_app/flow/process_trigger_test.rb
18864
18884
  - test/services/disco_app/flow/update_trigger_usage_test.rb
18865
18885
  - test/services/disco_app/subscription_service_test.rb
18886
+ - test/services/disco_app/synchronise_resources_service_test.rb
18866
18887
  - test/support/test_file_fixtures.rb
18867
18888
  - test/support/test_shopify_api.rb
18868
18889
  - test/test_helper.rb
18869
18890
  - test/vcr/flow_trigger_invalid_title.yml
18870
18891
  - test/vcr/flow_trigger_valid.yml
18892
+ - test/vcr/synchronise_products.yml
18893
+ - test/vcr/synchronise_products_paginated.yml
18894
+ - test/vcr/synchronise_products_since_id.yml
18895
+ - test/vcr/synchronise_products_with_params.yml
18871
18896
  - test/vcr/webhook_failure.yml
18872
18897
  homepage: https://github.com/discolabs/disco_app/
18873
18898
  licenses:
@@ -36861,6 +36886,10 @@ test_files:
36861
36886
  - test/vcr/flow_trigger_valid.yml
36862
36887
  - test/vcr/webhook_failure.yml
36863
36888
  - test/vcr/flow_trigger_invalid_title.yml
36889
+ - test/vcr/synchronise_products_paginated.yml
36890
+ - test/vcr/synchronise_products_since_id.yml
36891
+ - test/vcr/synchronise_products.yml
36892
+ - test/vcr/synchronise_products_with_params.yml
36864
36893
  - test/support/test_shopify_api.rb
36865
36894
  - test/support/test_file_fixtures.rb
36866
36895
  - test/fixtures/products.yml
@@ -36874,27 +36903,32 @@ test_files:
36874
36903
  - test/fixtures/widget_configurations.yml
36875
36904
  - test/fixtures/liquid/model.liquid
36876
36905
  - test/fixtures/api/widget_store/carrier_services.json
36906
+ - test/fixtures/api/widget_store/products/get_metafields_with_existing_response.json
36877
36907
  - test/fixtures/api/widget_store/products/write_metafields_single_namespace_response.json
36878
36908
  - test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_response.json
36879
36909
  - test/fixtures/api/widget_store/products/write_metafields_single_namespace_request.json
36910
+ - test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_response.json
36911
+ - test/fixtures/api/widget_store/products/get_metafields_empty_response.json
36880
36912
  - test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json
36881
- - test/fixtures/api/widget_store/charges/activate_recurring_application_charge_request.json
36882
- - test/fixtures/api/widget_store/charges/activate_application_charge_request.json
36913
+ - test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_request.json
36883
36914
  - test/fixtures/api/widget_store/charges/get_pending_application_charge_response.json
36884
- - test/fixtures/api/widget_store/charges/activate_recurring_application_charge_response.json
36885
36915
  - test/fixtures/api/widget_store/charges/create_application_charge_request.json
36886
36916
  - test/fixtures/api/widget_store/charges/create_application_charge_response.json
36887
- - test/fixtures/api/widget_store/charges/activate_application_charge_response.json
36888
36917
  - test/fixtures/api/widget_store/charges/create_recurring_application_charge_request.json
36889
36918
  - test/fixtures/api/widget_store/charges/get_declined_application_charge_response.json
36919
+ - test/fixtures/api/widget_store/charges/get_active_application_charge_response.json
36890
36920
  - test/fixtures/api/widget_store/charges/get_declined_recurring_application_charge_response.json
36921
+ - test/fixtures/api/widget_store/charges/get_active_recurring_application_charge_response.json
36891
36922
  - test/fixtures/api/widget_store/charges/get_pending_recurring_application_charge_response.json
36892
- - test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json
36893
36923
  - test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_request.json
36894
36924
  - test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_response.json
36895
- - test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json
36896
36925
  - test/fixtures/api/widget_store/charges/create_recurring_application_charge_response.json
36897
36926
  - test/fixtures/api/widget_store/users.json
36927
+ - test/fixtures/api/widget_store/shops/get_metafields_with_existing_response.json
36928
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_response.json
36929
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_response.json
36930
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_request.json
36931
+ - test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_request.json
36898
36932
  - test/fixtures/api/widget_store/shop.json
36899
36933
  - test/fixtures/api/widget_store/carrier_services_create.json
36900
36934
  - test/fixtures/api/widget_store/existing_webhooks.json
@@ -36945,6 +36979,7 @@ test_files:
36945
36979
  - test/controllers/home_controller_test.rb
36946
36980
  - test/services/disco_app/subscription_service_test.rb
36947
36981
  - test/services/disco_app/charges_service_test.rb
36982
+ - test/services/disco_app/synchronise_resources_service_test.rb
36948
36983
  - test/services/disco_app/flow/update_trigger_usage_test.rb
36949
36984
  - test/services/disco_app/flow/process_trigger_test.rb
36950
36985
  - test/services/disco_app/flow/process_action_test.rb
@@ -1,16 +0,0 @@
1
- {
2
- "application_charge": {
3
- "id": 1012637323,
4
- "name": "Lifetime",
5
- "api_client_id": 755357713,
6
- "price": "49.00",
7
- "status": "accepted",
8
- "return_url": "https://test.example.com/subscriptions/304261385/charges/629961174/activate",
9
- "created_at": "2015-09-02T14:52:56-04:00",
10
- "updated_at": "2015-09-02T14:52:56-04:00",
11
- "test": true,
12
- "charge_type": null,
13
- "decorated_return_url": "https://test.example.com/subscriptions/304261385/charges/1/activate?charge_id=1012637323",
14
- "confirmation_url": "https://apple.myshopify.com/admin/charges/1012637323/confirm_recurring_application_charge?signature=BAhpBHsQASc%3D--b2e90c6e4e94fbae15a464c566a31a1c23e6bffa"
15
- }
16
- }
@@ -1,20 +0,0 @@
1
- {
2
- "recurring_application_charge": {
3
- "id": 654381179,
4
- "name": "Basic",
5
- "api_client_id": 755357713,
6
- "price": "9.99",
7
- "status": "accepted",
8
- "return_url": "https://test.example.com/subscriptions/304261385/charges/629961174/activate",
9
- "billing_on": null,
10
- "created_at": "2015-09-02T14:50:32-04:00",
11
- "updated_at": "2015-09-02T14:50:32-04:00",
12
- "test": true,
13
- "activated_on": null,
14
- "trial_ends_on": null,
15
- "cancelled_on": null,
16
- "trial_days": 14,
17
- "decorated_return_url": "https://test.example.com/subscriptions/304261385/charges/629961174/activate?charge_id=654381179",
18
- "confirmation_url": "https://apple.myshopify.com/admin/charges/654381179/confirm_recurring_application_charge?signature=BAhpBHsQASc%3D--b2e90c6e4e94fbae15a464c566a31a1c23e6bffa"
19
- }
20
- }