disco_app 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/disco_app/components/filterable_shop_list.js.jsx +65 -0
- data/app/assets/javascripts/disco_app/components/shop_filter_tab.js.jsx +34 -0
- data/app/assets/javascripts/disco_app/components/shop_filter_tabs.js.jsx +21 -0
- data/app/assets/javascripts/disco_app/components/shop_list.js.jsx +140 -0
- data/app/assets/javascripts/disco_app/components/shop_row.js.jsx +27 -0
- data/app/controllers/disco_app/admin/app_settings_controller.rb +3 -0
- data/app/controllers/disco_app/admin/application_controller.rb +3 -0
- data/app/controllers/disco_app/admin/concerns/app_settings_controller.rb +24 -0
- data/app/controllers/disco_app/admin/concerns/authenticated_controller.rb +20 -0
- data/app/controllers/disco_app/admin/concerns/shops_controller.rb +7 -0
- data/app/controllers/disco_app/admin/resources/shops_controller.rb +3 -0
- data/app/controllers/disco_app/admin/shops_controller.rb +3 -0
- data/app/controllers/disco_app/charges_controller.rb +1 -1
- data/app/controllers/disco_app/concerns/app_proxy_controller.rb +40 -0
- data/app/controllers/disco_app/concerns/authenticated_controller.rb +42 -0
- data/app/controllers/disco_app/concerns/carrier_request_controller.rb +21 -0
- data/app/controllers/disco_app/install_controller.rb +1 -1
- data/app/models/disco_app/app_settings.rb +3 -0
- data/app/models/disco_app/concerns/app_settings.rb +7 -0
- data/app/models/disco_app/concerns/shop.rb +5 -0
- data/app/models/disco_app/concerns/{synchronises_with_shopify.rb → synchronises.rb} +16 -3
- data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +46 -0
- data/app/resources/disco_app/admin/resources/shop_resource.rb +4 -0
- data/app/views/disco_app/admin/app_settings/edit.html.erb +5 -0
- data/app/views/disco_app/admin/shops/index.html.erb +12 -0
- data/app/views/layouts/admin/_navbar.html.erb +24 -0
- data/app/views/layouts/admin.html.erb +27 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20150525000000_create_shops_if_not_existent.rb +1 -1
- data/db/migrate/20160112233706_create_disco_app_sessions.rb +2 -2
- data/db/migrate/20160223111044_create_disco_app_settings.rb +8 -0
- data/lib/disco_app/engine.rb +1 -0
- data/lib/disco_app/version.rb +1 -1
- data/lib/generators/disco_app/adminify/adminify_generator.rb +35 -0
- data/lib/generators/disco_app/disco_app_generator.rb +1 -0
- data/lib/generators/disco_app/templates/controllers/home_controller.rb +2 -2
- data/test/controllers/disco_app/admin/shops_controller_test.rb +54 -0
- data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +8 -0
- data/test/dummy/app/controllers/home_controller.rb +2 -2
- data/test/dummy/app/controllers/proxy_controller.rb +1 -1
- data/test/dummy/app/jobs/products_create_job.rb +7 -0
- data/test/dummy/app/jobs/products_delete_job.rb +7 -0
- data/test/dummy/app/jobs/products_update_job.rb +7 -0
- data/test/dummy/app/models/product.rb +6 -0
- data/test/dummy/config/database.codeship.yml +23 -0
- data/test/dummy/config/database.yml +8 -13
- data/test/dummy/db/migrate/20160307182229_create_products.rb +11 -0
- data/test/dummy/db/schema.rb +27 -10
- data/test/fixtures/products.yml +4 -0
- data/test/fixtures/webhooks/product_created.json +167 -0
- data/test/fixtures/webhooks/product_deleted.json +3 -0
- data/test/fixtures/webhooks/product_updated.json +167 -0
- data/test/integration/synchronises_test.rb +55 -0
- metadata +69 -9
- data/app/controllers/disco_app/app_proxy_controller.rb +0 -42
- data/app/controllers/disco_app/authenticated_controller.rb +0 -44
- data/app/controllers/disco_app/carrier_request_controller.rb +0 -23
- data/test/integration/navigation_test.rb +0 -10
@@ -0,0 +1,167 @@
|
|
1
|
+
{
|
2
|
+
"id": 632910393,
|
3
|
+
"title": "IPod Nano - 8GB",
|
4
|
+
"body_html": "<p>It's the small iPod with one very big idea: Video. Now the world's most popular music player, available in 4GB and 8GB models, lets you enjoy TV shows, movies, video podcasts, and more. The larger, brighter display means amazing picture quality. In six eye-catching colors, iPod nano is stunning all around. And with models starting at just $149, little speaks volumes.<\/p>",
|
5
|
+
"vendor": "Apple",
|
6
|
+
"product_type": "Cult Products",
|
7
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
8
|
+
"handle": "ipod-nano",
|
9
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
10
|
+
"published_at": "2007-12-31T19:00:00-05:00",
|
11
|
+
"template_suffix": null,
|
12
|
+
"published_scope": "web",
|
13
|
+
"tags": "Emotive, Flash Memory, MP3, Music",
|
14
|
+
"variants": [
|
15
|
+
{
|
16
|
+
"id": 808950810,
|
17
|
+
"product_id": 632910392,
|
18
|
+
"title": "Pink",
|
19
|
+
"sku": "IPOD2008PINK",
|
20
|
+
"position": 1,
|
21
|
+
"grams": 200,
|
22
|
+
"inventory_policy": "continue",
|
23
|
+
"fulfillment_service": "manual",
|
24
|
+
"inventory_management": "shopify",
|
25
|
+
"price": "199.00",
|
26
|
+
"compare_at_price": null,
|
27
|
+
"option1": "Pink",
|
28
|
+
"option2": null,
|
29
|
+
"option3": null,
|
30
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
31
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
32
|
+
"taxable": true,
|
33
|
+
"requires_shipping": true,
|
34
|
+
"barcode": "1234_pink",
|
35
|
+
"inventory_quantity": 10,
|
36
|
+
"old_inventory_quantity": 10,
|
37
|
+
"image_id": 562641783,
|
38
|
+
"weight": 0.2,
|
39
|
+
"weight_unit": "kg"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": 49148385,
|
43
|
+
"product_id": 632910392,
|
44
|
+
"title": "Red",
|
45
|
+
"sku": "IPOD2008RED",
|
46
|
+
"position": 2,
|
47
|
+
"grams": 200,
|
48
|
+
"inventory_policy": "continue",
|
49
|
+
"fulfillment_service": "manual",
|
50
|
+
"inventory_management": "shopify",
|
51
|
+
"price": "199.00",
|
52
|
+
"compare_at_price": null,
|
53
|
+
"option1": "Red",
|
54
|
+
"option2": null,
|
55
|
+
"option3": null,
|
56
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
57
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
58
|
+
"taxable": true,
|
59
|
+
"requires_shipping": true,
|
60
|
+
"barcode": "1234_red",
|
61
|
+
"inventory_quantity": 20,
|
62
|
+
"old_inventory_quantity": 20,
|
63
|
+
"image_id": null,
|
64
|
+
"weight": 0.2,
|
65
|
+
"weight_unit": "kg"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"id": 39072856,
|
69
|
+
"product_id": 632910392,
|
70
|
+
"title": "Green",
|
71
|
+
"sku": "IPOD2008GREEN",
|
72
|
+
"position": 3,
|
73
|
+
"grams": 200,
|
74
|
+
"inventory_policy": "continue",
|
75
|
+
"fulfillment_service": "manual",
|
76
|
+
"inventory_management": "shopify",
|
77
|
+
"price": "199.00",
|
78
|
+
"compare_at_price": null,
|
79
|
+
"option1": "Green",
|
80
|
+
"option2": null,
|
81
|
+
"option3": null,
|
82
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
83
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
84
|
+
"taxable": true,
|
85
|
+
"requires_shipping": true,
|
86
|
+
"barcode": "1234_green",
|
87
|
+
"inventory_quantity": 30,
|
88
|
+
"old_inventory_quantity": 30,
|
89
|
+
"image_id": null,
|
90
|
+
"weight": 0.2,
|
91
|
+
"weight_unit": "kg"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"id": 457924702,
|
95
|
+
"product_id": 632910392,
|
96
|
+
"title": "Black",
|
97
|
+
"sku": "IPOD2008BLACK",
|
98
|
+
"position": 4,
|
99
|
+
"grams": 200,
|
100
|
+
"inventory_policy": "continue",
|
101
|
+
"fulfillment_service": "manual",
|
102
|
+
"inventory_management": "shopify",
|
103
|
+
"price": "199.00",
|
104
|
+
"compare_at_price": null,
|
105
|
+
"option1": "Black",
|
106
|
+
"option2": null,
|
107
|
+
"option3": null,
|
108
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
109
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
110
|
+
"taxable": true,
|
111
|
+
"requires_shipping": true,
|
112
|
+
"barcode": "1234_black",
|
113
|
+
"inventory_quantity": 40,
|
114
|
+
"old_inventory_quantity": 40,
|
115
|
+
"image_id": null,
|
116
|
+
"weight": 0.2,
|
117
|
+
"weight_unit": "kg"
|
118
|
+
}
|
119
|
+
],
|
120
|
+
"options": [
|
121
|
+
{
|
122
|
+
"id": 594680422,
|
123
|
+
"product_id": 632910392,
|
124
|
+
"name": "Color",
|
125
|
+
"position": 1,
|
126
|
+
"values": [
|
127
|
+
"Pink",
|
128
|
+
"Red",
|
129
|
+
"Green",
|
130
|
+
"Black"
|
131
|
+
]
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"images": [
|
135
|
+
{
|
136
|
+
"id": 850703190,
|
137
|
+
"product_id": 632910392,
|
138
|
+
"position": 1,
|
139
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
140
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
141
|
+
"src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1441219832",
|
142
|
+
"variant_ids": [
|
143
|
+
]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"id": 562641783,
|
147
|
+
"product_id": 632910392,
|
148
|
+
"position": 2,
|
149
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
150
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
151
|
+
"src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano-2.png?v=1441219832",
|
152
|
+
"variant_ids": [
|
153
|
+
808950810
|
154
|
+
]
|
155
|
+
}
|
156
|
+
],
|
157
|
+
"image": {
|
158
|
+
"id": 850703190,
|
159
|
+
"product_id": 632910392,
|
160
|
+
"position": 1,
|
161
|
+
"created_at": "2015-09-02T14:50:32-04:00",
|
162
|
+
"updated_at": "2015-09-02T14:50:32-04:00",
|
163
|
+
"src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1441219832",
|
164
|
+
"variant_ids": [
|
165
|
+
]
|
166
|
+
}
|
167
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SynchronisesTest < ActionDispatch::IntegrationTest
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@shop = disco_app_shops(:widget_store)
|
8
|
+
@product = products(:ipod)
|
9
|
+
@routes = DiscoApp::Engine.routes
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
@shop = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'new product is created when product created webhook is received' do
|
17
|
+
post_webhook('product_created', :'products/create')
|
18
|
+
|
19
|
+
# Assert the product was created locally, with the correct attributes.
|
20
|
+
product = Product.find(632910392)
|
21
|
+
assert_equal 'IPod Nano - 8GB', product.data['title']
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'existing product is updated when product updated webhook is received' do
|
25
|
+
assert_equal({}, @product.data)
|
26
|
+
|
27
|
+
post_webhook('product_updated', :'products/update')
|
28
|
+
|
29
|
+
# Assert the product was updated locally, with the correct attributes.
|
30
|
+
@product.reload
|
31
|
+
assert_equal 632910393, @product.id
|
32
|
+
assert_equal 'IPod Nano - 8GB', @product.data['title']
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'existing product is deleted when product deleted webhook is receieved' do
|
36
|
+
post_webhook('product_deleted', :'products/delete')
|
37
|
+
assert_equal 0, Product.count
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def webhooks_url
|
43
|
+
DiscoApp::Engine.routes.url_helpers.webhooks_url
|
44
|
+
end
|
45
|
+
|
46
|
+
def post_webhook(fixture_name, webhook_topic)
|
47
|
+
body = webhook_fixture(fixture_name)
|
48
|
+
post(webhooks_url, body, {
|
49
|
+
HTTP_X_SHOPIFY_TOPIC: webhook_topic,
|
50
|
+
HTTP_X_SHOPIFY_SHOP_DOMAIN: @shop.shopify_domain,
|
51
|
+
HTTP_X_SHOPIFY_HMAC_SHA256: DiscoApp::WebhookService.calculated_hmac(body, ShopifyApp.configuration.secret)
|
52
|
+
})
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disco_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Ballard
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.5.
|
19
|
+
version: 4.2.5.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.2.5.
|
26
|
+
version: 4.2.5.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: shopify_app
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: 1.1.11
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: jsonapi-resources
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.7.0
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.7.0
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: sqlite3
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -272,6 +286,11 @@ files:
|
|
272
286
|
- Rakefile
|
273
287
|
- app/assets/images/disco_app/icon.svg
|
274
288
|
- app/assets/javascripts/disco_app/components.js
|
289
|
+
- app/assets/javascripts/disco_app/components/filterable_shop_list.js.jsx
|
290
|
+
- app/assets/javascripts/disco_app/components/shop_filter_tab.js.jsx
|
291
|
+
- app/assets/javascripts/disco_app/components/shop_filter_tabs.js.jsx
|
292
|
+
- app/assets/javascripts/disco_app/components/shop_list.js.jsx
|
293
|
+
- app/assets/javascripts/disco_app/components/shop_row.js.jsx
|
275
294
|
- app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
|
276
295
|
- app/assets/javascripts/disco_app/disco_app.js
|
277
296
|
- app/assets/javascripts/disco_app/frame.js
|
@@ -293,10 +312,17 @@ files:
|
|
293
312
|
- app/assets/stylesheets/disco_app/frame/_forms.scss
|
294
313
|
- app/assets/stylesheets/disco_app/frame/_layout.scss
|
295
314
|
- app/assets/stylesheets/disco_app/frame/_type.scss
|
296
|
-
- app/controllers/disco_app/
|
297
|
-
- app/controllers/disco_app/
|
298
|
-
- app/controllers/disco_app/
|
315
|
+
- app/controllers/disco_app/admin/app_settings_controller.rb
|
316
|
+
- app/controllers/disco_app/admin/application_controller.rb
|
317
|
+
- app/controllers/disco_app/admin/concerns/app_settings_controller.rb
|
318
|
+
- app/controllers/disco_app/admin/concerns/authenticated_controller.rb
|
319
|
+
- app/controllers/disco_app/admin/concerns/shops_controller.rb
|
320
|
+
- app/controllers/disco_app/admin/resources/shops_controller.rb
|
321
|
+
- app/controllers/disco_app/admin/shops_controller.rb
|
299
322
|
- app/controllers/disco_app/charges_controller.rb
|
323
|
+
- app/controllers/disco_app/concerns/app_proxy_controller.rb
|
324
|
+
- app/controllers/disco_app/concerns/authenticated_controller.rb
|
325
|
+
- app/controllers/disco_app/concerns/carrier_request_controller.rb
|
300
326
|
- app/controllers/disco_app/frame_controller.rb
|
301
327
|
- app/controllers/disco_app/install_controller.rb
|
302
328
|
- app/controllers/disco_app/webhooks_controller.rb
|
@@ -312,19 +338,25 @@ files:
|
|
312
338
|
- app/jobs/disco_app/shop_update_job.rb
|
313
339
|
- app/jobs/disco_app/synchronise_carrier_service_job.rb
|
314
340
|
- app/jobs/disco_app/synchronise_webhooks_job.rb
|
341
|
+
- app/models/disco_app/app_settings.rb
|
342
|
+
- app/models/disco_app/concerns/app_settings.rb
|
315
343
|
- app/models/disco_app/concerns/plan.rb
|
316
344
|
- app/models/disco_app/concerns/shop.rb
|
317
345
|
- app/models/disco_app/concerns/subscription.rb
|
318
|
-
- app/models/disco_app/concerns/
|
346
|
+
- app/models/disco_app/concerns/synchronises.rb
|
319
347
|
- app/models/disco_app/plan.rb
|
320
348
|
- app/models/disco_app/session_storage.rb
|
321
349
|
- app/models/disco_app/shop.rb
|
322
350
|
- app/models/disco_app/subscription.rb
|
351
|
+
- app/resources/disco_app/admin/resources/concerns/shop_resource.rb
|
352
|
+
- app/resources/disco_app/admin/resources/shop_resource.rb
|
323
353
|
- app/services/disco_app/carrier_request_service.rb
|
324
354
|
- app/services/disco_app/charges_service.rb
|
325
355
|
- app/services/disco_app/proxy_service.rb
|
326
356
|
- app/services/disco_app/subscription_service.rb
|
327
357
|
- app/services/disco_app/webhook_service.rb
|
358
|
+
- app/views/disco_app/admin/app_settings/edit.html.erb
|
359
|
+
- app/views/disco_app/admin/shops/index.html.erb
|
328
360
|
- app/views/disco_app/charges/activate.html.erb
|
329
361
|
- app/views/disco_app/charges/create.html.erb
|
330
362
|
- app/views/disco_app/charges/new.html.erb
|
@@ -334,6 +366,8 @@ files:
|
|
334
366
|
- app/views/disco_app/proxy_errors/404.html.erb
|
335
367
|
- app/views/disco_app/shared/_card.html.erb
|
336
368
|
- app/views/disco_app/shared/_section.html.erb
|
369
|
+
- app/views/layouts/admin.html.erb
|
370
|
+
- app/views/layouts/admin/_navbar.html.erb
|
337
371
|
- app/views/layouts/application.html.erb
|
338
372
|
- app/views/layouts/embedded_app.html.erb
|
339
373
|
- app/views/layouts/embedded_app_modal.html.erb
|
@@ -349,6 +383,7 @@ files:
|
|
349
383
|
- db/migrate/20151017234409_move_shop_to_disco_app_engine.rb
|
350
384
|
- db/migrate/20160112233706_create_disco_app_sessions.rb
|
351
385
|
- db/migrate/20160113194418_add_shop_id_to_disco_app_sessions.rb
|
386
|
+
- db/migrate/20160223111044_create_disco_app_settings.rb
|
352
387
|
- lib/disco_app.rb
|
353
388
|
- lib/disco_app/configuration.rb
|
354
389
|
- lib/disco_app/engine.rb
|
@@ -357,6 +392,7 @@ files:
|
|
357
392
|
- lib/disco_app/test_help.rb
|
358
393
|
- lib/disco_app/version.rb
|
359
394
|
- lib/generators/disco_app/USAGE
|
395
|
+
- lib/generators/disco_app/adminify/adminify_generator.rb
|
360
396
|
- lib/generators/disco_app/disco_app_generator.rb
|
361
397
|
- lib/generators/disco_app/mailify/mailify_generator.rb
|
362
398
|
- lib/generators/disco_app/monitorify/monitorify_generator.rb
|
@@ -377,6 +413,7 @@ files:
|
|
377
413
|
- lib/tasks/sessions.rake
|
378
414
|
- lib/tasks/start.rake
|
379
415
|
- lib/tasks/webhooks.rake
|
416
|
+
- test/controllers/disco_app/admin/shops_controller_test.rb
|
380
417
|
- test/controllers/disco_app/install_controller_test.rb
|
381
418
|
- test/controllers/disco_app/webhooks_controller_test.rb
|
382
419
|
- test/controllers/home_controller_test.rb
|
@@ -386,11 +423,16 @@ files:
|
|
386
423
|
- test/dummy/app/assets/javascripts/application.js
|
387
424
|
- test/dummy/app/assets/stylesheets/application.scss
|
388
425
|
- test/dummy/app/controllers/application_controller.rb
|
426
|
+
- test/dummy/app/controllers/disco_app/admin/shops_controller.rb
|
389
427
|
- test/dummy/app/controllers/home_controller.rb
|
390
428
|
- test/dummy/app/controllers/proxy_controller.rb
|
391
429
|
- test/dummy/app/helpers/application_helper.rb
|
392
430
|
- test/dummy/app/jobs/disco_app/app_uninstalled_job.rb
|
431
|
+
- test/dummy/app/jobs/products_create_job.rb
|
432
|
+
- test/dummy/app/jobs/products_delete_job.rb
|
433
|
+
- test/dummy/app/jobs/products_update_job.rb
|
393
434
|
- test/dummy/app/models/disco_app/shop.rb
|
435
|
+
- test/dummy/app/models/product.rb
|
394
436
|
- test/dummy/app/views/home/index.html.erb
|
395
437
|
- test/dummy/bin/bundle
|
396
438
|
- test/dummy/bin/rails
|
@@ -399,6 +441,7 @@ files:
|
|
399
441
|
- test/dummy/config.ru
|
400
442
|
- test/dummy/config/application.rb
|
401
443
|
- test/dummy/config/boot.rb
|
444
|
+
- test/dummy/config/database.codeship.yml
|
402
445
|
- test/dummy/config/database.yml
|
403
446
|
- test/dummy/config/environment.rb
|
404
447
|
- test/dummy/config/environments/development.rb
|
@@ -419,6 +462,7 @@ files:
|
|
419
462
|
- test/dummy/config/locales/en.yml
|
420
463
|
- test/dummy/config/routes.rb
|
421
464
|
- test/dummy/config/secrets.yml
|
465
|
+
- test/dummy/db/migrate/20160307182229_create_products.rb
|
422
466
|
- test/dummy/db/schema.rb
|
423
467
|
- test/dummy/public/404.html
|
424
468
|
- test/dummy/public/422.html
|
@@ -429,8 +473,12 @@ files:
|
|
429
473
|
- test/fixtures/disco_app/plans.yml
|
430
474
|
- test/fixtures/disco_app/shops.yml
|
431
475
|
- test/fixtures/disco_app/subscriptions.yml
|
476
|
+
- test/fixtures/products.yml
|
432
477
|
- test/fixtures/webhooks/app_uninstalled.json
|
433
|
-
- test/
|
478
|
+
- test/fixtures/webhooks/product_created.json
|
479
|
+
- test/fixtures/webhooks/product_deleted.json
|
480
|
+
- test/fixtures/webhooks/product_updated.json
|
481
|
+
- test/integration/synchronises_test.rb
|
434
482
|
- test/jobs/disco_app/app_installed_job_test.rb
|
435
483
|
- test/jobs/disco_app/app_uninstalled_job_test.rb
|
436
484
|
- test/models/disco_app/plan_test.rb
|
@@ -477,13 +525,19 @@ test_files:
|
|
477
525
|
- test/dummy/config.ru
|
478
526
|
- test/dummy/app/assets/stylesheets/application.scss
|
479
527
|
- test/dummy/app/assets/javascripts/application.js
|
528
|
+
- test/dummy/app/jobs/products_create_job.rb
|
529
|
+
- test/dummy/app/jobs/products_update_job.rb
|
480
530
|
- test/dummy/app/jobs/disco_app/app_uninstalled_job.rb
|
531
|
+
- test/dummy/app/jobs/products_delete_job.rb
|
481
532
|
- test/dummy/app/controllers/home_controller.rb
|
533
|
+
- test/dummy/app/controllers/disco_app/admin/shops_controller.rb
|
482
534
|
- test/dummy/app/controllers/proxy_controller.rb
|
483
535
|
- test/dummy/app/controllers/application_controller.rb
|
484
536
|
- test/dummy/app/helpers/application_helper.rb
|
485
537
|
- test/dummy/app/models/disco_app/shop.rb
|
538
|
+
- test/dummy/app/models/product.rb
|
486
539
|
- test/dummy/app/views/home/index.html.erb
|
540
|
+
- test/dummy/db/migrate/20160307182229_create_products.rb
|
487
541
|
- test/dummy/db/schema.rb
|
488
542
|
- test/dummy/config/locales/en.yml
|
489
543
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
@@ -500,6 +554,7 @@ test_files:
|
|
500
554
|
- test/dummy/config/initializers/cookies_serializer.rb
|
501
555
|
- test/dummy/config/secrets.yml
|
502
556
|
- test/dummy/config/routes.rb
|
557
|
+
- test/dummy/config/database.codeship.yml
|
503
558
|
- test/dummy/config/environments/production.rb
|
504
559
|
- test/dummy/config/environments/test.rb
|
505
560
|
- test/dummy/config/environments/development.rb
|
@@ -513,6 +568,10 @@ test_files:
|
|
513
568
|
- test/fixtures/disco_app/subscriptions.yml
|
514
569
|
- test/fixtures/disco_app/plans.yml
|
515
570
|
- test/fixtures/webhooks/app_uninstalled.json
|
571
|
+
- test/fixtures/webhooks/product_updated.json
|
572
|
+
- test/fixtures/webhooks/product_created.json
|
573
|
+
- test/fixtures/webhooks/product_deleted.json
|
574
|
+
- test/fixtures/products.yml
|
516
575
|
- test/support/test_file_fixtures.rb
|
517
576
|
- test/test_helper.rb
|
518
577
|
- test/disco_app_test.rb
|
@@ -520,9 +579,10 @@ test_files:
|
|
520
579
|
- test/jobs/disco_app/app_installed_job_test.rb
|
521
580
|
- test/controllers/disco_app/install_controller_test.rb
|
522
581
|
- test/controllers/disco_app/webhooks_controller_test.rb
|
582
|
+
- test/controllers/disco_app/admin/shops_controller_test.rb
|
523
583
|
- test/controllers/proxy_controller_test.rb
|
524
584
|
- test/controllers/home_controller_test.rb
|
525
|
-
- test/integration/
|
585
|
+
- test/integration/synchronises_test.rb
|
526
586
|
- test/models/disco_app/plan_test.rb
|
527
587
|
- test/models/disco_app/shop_test.rb
|
528
588
|
- test/models/disco_app/session_test.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module DiscoApp
|
2
|
-
module AppProxyController
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
before_action :verify_proxy_signature
|
7
|
-
before_action :shopify_shop
|
8
|
-
after_action :add_liquid_header
|
9
|
-
|
10
|
-
rescue_from ActiveRecord::RecordNotFound do |exception|
|
11
|
-
render_error 404
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def verify_proxy_signature
|
18
|
-
unless proxy_signature_is_valid?
|
19
|
-
head :unauthorized
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def proxy_signature_is_valid?
|
24
|
-
return true if DiscoApp.configuration.skip_proxy_verification?
|
25
|
-
DiscoApp::ProxyService.proxy_signature_is_valid?(request.query_string, ShopifyApp.configuration.secret)
|
26
|
-
end
|
27
|
-
|
28
|
-
def shopify_shop
|
29
|
-
@shop = Shop.find_by_shopify_domain!(params[:shop])
|
30
|
-
end
|
31
|
-
|
32
|
-
def add_liquid_header
|
33
|
-
response.headers['Content-Type'] = 'application/liquid'
|
34
|
-
end
|
35
|
-
|
36
|
-
def render_error(status)
|
37
|
-
add_liquid_header
|
38
|
-
render "disco_app/proxy_errors/#{status}", status: status
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module DiscoApp
|
2
|
-
module AuthenticatedController
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
before_action :login_again_if_different_shop
|
7
|
-
before_action :shopify_shop
|
8
|
-
before_action :verify_status
|
9
|
-
around_filter :shopify_session
|
10
|
-
layout 'embedded_app'
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def shopify_shop
|
16
|
-
if shop_session
|
17
|
-
@shop = Shop.find_by!(shopify_domain: @shop_session.url)
|
18
|
-
else
|
19
|
-
redirect_to_login
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def verify_status
|
24
|
-
if not (@shop.charge_active? or @shop.charge_waived?)
|
25
|
-
redirect_if_not_current_path(disco_app.new_charge_path)
|
26
|
-
elsif @shop.charge_accepted?
|
27
|
-
redirect_if_not_current_path(disco_app.activate_charge_path)
|
28
|
-
elsif @shop.never_installed? or @shop.uninstalled?
|
29
|
-
redirect_if_not_current_path(disco_app.install_path)
|
30
|
-
elsif @shop.awaiting_install? or @shop.installing?
|
31
|
-
redirect_if_not_current_path(disco_app.installing_path)
|
32
|
-
elsif @shop.awaiting_uninstall? or @shop.uninstalling?
|
33
|
-
redirect_if_not_current_path(disco_app.uninstalling_path)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def redirect_if_not_current_path(target)
|
38
|
-
if request.path != target
|
39
|
-
redirect_to target
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module DiscoApp
|
2
|
-
module CarrierRequestController
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
before_action :verify_carrier_request
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def verify_carrier_request
|
12
|
-
unless carrier_request_signature_is_valid?
|
13
|
-
head :unauthorized
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def carrier_request_signature_is_valid?
|
18
|
-
return true if DiscoApp.configuration.skip_carrier_request_verification?
|
19
|
-
DiscoApp::CarrierRequestService.is_valid_hmac?(request.body.read.to_s, ShopifyApp.configuration.secret, request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'])
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|