shopify_app 7.3.0 → 7.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md} +0 -0
- data/CHANGELOG.md +4 -0
- data/README.md +38 -4
- data/{QUICKSTART.md → docs/Quickstart.md} +0 -0
- data/{RELEASING → docs/Releasing.md} +0 -0
- data/{TROUBLESHOOTING.md → docs/Troubleshooting.md} +0 -0
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +43 -0
- data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +10 -0
- data/lib/generators/shopify_app/install/templates/shopify_app.rb +1 -0
- data/lib/shopify_app/configuration.rb +1 -0
- data/lib/shopify_app/sessions_concern.rb +12 -0
- data/lib/shopify_app/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b534fe893fb126d699a8e2a0908cc06aab2ea3e9
|
4
|
+
data.tar.gz: 7da8663a89439030d2198be0f4d09e947d68ae63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189dfc0d53bd7eae968b3270151b00a363a9ecd964b38cbabd378824156fa2eaf5aecb93c9932b1fa3fde2323bd35c9a8fcddec3f8b62b2c02cd6bd2001c8e1f
|
7
|
+
data.tar.gz: 9e11244536e4039e59b1170ab3fcf9717f9f0e53036dbd791cf30e72279d95737cb640cee2a19736e9e74da380c1209a49446aeb32cb2223baf36fe28e8eabcd
|
File without changes
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,7 @@ Table of Contents
|
|
27
27
|
* [**Managing Api Keys**](#managing-api-keys)
|
28
28
|
* [**WebhooksManager**](#webhooksmanager)
|
29
29
|
* [**ScripttagsManager**](#scripttagsmanager)
|
30
|
+
* [**AfterAuthenticate Job**](#afterauthenticate-job)
|
30
31
|
* [**ShopifyApp::SessionRepository**](#shopifyappsessionrepository)
|
31
32
|
* [**AuthenticatedController**](#authenticatedcontroller)
|
32
33
|
* [**AppProxyVerification**](#appproxyverification)
|
@@ -54,7 +55,7 @@ Check out this screencast on how to create and deploy a new Shopify App to Herok
|
|
54
55
|
|
55
56
|
[https://vimeo.com/130247240](https://vimeo.com/130247240)
|
56
57
|
|
57
|
-
Or if you prefer text instructions the steps in the video are written out [here](https://github.com/Shopify/shopify_app/blob/master/
|
58
|
+
Or if you prefer text instructions the steps in the video are written out [here](https://github.com/Shopify/shopify_app/blob/master/docs/Quickstart.md)
|
58
59
|
|
59
60
|
Becoming a Shopify App Developer
|
60
61
|
--------------------------------
|
@@ -185,10 +186,18 @@ Mounting the Engine will provide the basic routes to authenticating a shop with
|
|
185
186
|
The default routes of the Shopify rails engine, which is mounted to the root, can be altered to mount on a different route. The `config/routes.rb` can be modified to put these under a nested route (say `/app-name`) as:
|
186
187
|
|
187
188
|
```ruby
|
188
|
-
mount ShopifyApp::Engine, at: '/
|
189
|
+
mount ShopifyApp::Engine, at: '/nested'
|
189
190
|
```
|
190
191
|
|
191
|
-
This will create the Shopify engine routes under the specified
|
192
|
+
This will create the Shopify engine routes under the specified subpath, as a result it will redirect new consumers to `/nested/login`. If you mount the engine at a subpath you'll also need to update the omniauth initializer to include a custom `callback_path` e.g:
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
provider :shopify,
|
196
|
+
ShopifyApp.configuration.api_key,
|
197
|
+
ShopifyApp.configuration.secret,
|
198
|
+
scope: ShopifyApp.configuration.scope,
|
199
|
+
callback_path: '/nested/auth/shopify/callback'
|
200
|
+
```
|
192
201
|
|
193
202
|
To use named routes with the engine so that it can route between the application and the engine's routes it should be prefixed with `main_app` or `shopify_app`.
|
194
203
|
|
@@ -290,6 +299,31 @@ Scripttags are created in the same way as the Webhooks, with a background job wh
|
|
290
299
|
|
291
300
|
If `src` responds to `call` its return value will be used as the scripttag's source. It will be called on scripttag creation and deletion.
|
292
301
|
|
302
|
+
AfterAuthenticate Job
|
303
|
+
---------------------
|
304
|
+
|
305
|
+
If your app needs to perform specific actions after it is installed ShopifyApp can queue or run a job of your choosing (note that we already provide support for automatically creating Webhooks and Scripttags). To configure the after authenticate job update your initializer as follows:
|
306
|
+
|
307
|
+
```ruby
|
308
|
+
ShopifyApp.configure do |config|
|
309
|
+
config.add_after_authenticate_job = { job: Shopify::AfterAuthenticateJob }
|
310
|
+
end
|
311
|
+
```
|
312
|
+
|
313
|
+
If you need the job to run synchronously add the `inline` flag:
|
314
|
+
|
315
|
+
```ruby
|
316
|
+
ShopifyApp.configure do |config|
|
317
|
+
config.add_after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: true }
|
318
|
+
end
|
319
|
+
```
|
320
|
+
|
321
|
+
We've also provided a generator which creates a skeleton job and updates the initializer for you:
|
322
|
+
|
323
|
+
```
|
324
|
+
bin/rails g shopify_app:add_after_authenticate_job
|
325
|
+
```
|
326
|
+
|
293
327
|
ShopifyApp::SessionRepository
|
294
328
|
-----------------------------
|
295
329
|
|
@@ -326,7 +360,7 @@ Create your app proxy url in the [Shopify Partners' Dashboard](https://app.shopi
|
|
326
360
|
Troubleshooting
|
327
361
|
---------------
|
328
362
|
|
329
|
-
see [TROUBLESHOOTING.md](
|
363
|
+
see [TROUBLESHOOTING.md](https://github.com/Shopify/shopify_app/blob/master/docs/Troubleshooting.md)
|
330
364
|
|
331
365
|
Testing an embedded app outside the Shopify admin
|
332
366
|
-------------------------------------------------
|
File without changes
|
File without changes
|
File without changes
|
data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module ShopifyApp
|
4
|
+
module Generators
|
5
|
+
class AddAfterAuthenticateJobGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
hook_for :test_framework, as: :job, in: :rails do |instance, generator|
|
9
|
+
instance.invoke generator, [ instance.send(:job_file_name) ]
|
10
|
+
end
|
11
|
+
|
12
|
+
def init_after_authenticate_config
|
13
|
+
initializer = load_initializer
|
14
|
+
|
15
|
+
after_authenticate_job_config = " config.after_authenticate_job = { job: Shopify::AfterAuthenticateJob, inline: false }\n"
|
16
|
+
|
17
|
+
inject_into_file(
|
18
|
+
'config/initializers/shopify_app.rb',
|
19
|
+
after_authenticate_job_config,
|
20
|
+
before: 'end'
|
21
|
+
)
|
22
|
+
|
23
|
+
unless initializer.include?(after_authenticate_job_config)
|
24
|
+
shell.say "Error adding after_authneticate_job to config. Add this line manually: #{after_authenticate_job_config}", :red
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_after_authenticate_job
|
29
|
+
template 'after_authenticate_job.rb', "app/jobs/#{job_file_name}_job.rb"
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def load_initializer
|
35
|
+
File.read(File.join(destination_root, 'config/initializers/shopify_app.rb'))
|
36
|
+
end
|
37
|
+
|
38
|
+
def job_file_name
|
39
|
+
'shopify/after_authenticate'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -20,6 +20,7 @@ module ShopifyApp
|
|
20
20
|
login_shop
|
21
21
|
install_webhooks
|
22
22
|
install_scripttags
|
23
|
+
perform_after_authenticate_job
|
23
24
|
|
24
25
|
redirect_to return_address
|
25
26
|
else
|
@@ -87,5 +88,16 @@ module ShopifyApp
|
|
87
88
|
session.delete(:return_to) || main_app.root_url
|
88
89
|
end
|
89
90
|
|
91
|
+
def perform_after_authenticate_job
|
92
|
+
config = ShopifyApp.configuration.after_authenticate_job
|
93
|
+
|
94
|
+
return unless config && config[:job].present?
|
95
|
+
|
96
|
+
if config[:inline] == true
|
97
|
+
config[:job].perform_now(shop_domain: session[:shopify_domain])
|
98
|
+
else
|
99
|
+
config[:job].perform_later(shop_domain: session[:shopify_domain])
|
100
|
+
end
|
101
|
+
end
|
90
102
|
end
|
91
103
|
end
|
data/lib/shopify_app/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -128,17 +128,14 @@ executables: []
|
|
128
128
|
extensions: []
|
129
129
|
extra_rdoc_files: []
|
130
130
|
files:
|
131
|
+
- ".github/ISSUE_TEMPLATE.md"
|
131
132
|
- ".gitignore"
|
132
133
|
- ".travis.yml"
|
133
134
|
- CHANGELOG.md
|
134
135
|
- Gemfile
|
135
|
-
- ISSUE_TEMPLATE.md
|
136
136
|
- LICENSE
|
137
|
-
- QUICKSTART.md
|
138
137
|
- README.md
|
139
|
-
- RELEASING
|
140
138
|
- Rakefile
|
141
|
-
- TROUBLESHOOTING.md
|
142
139
|
- app/controllers/shopify_app/authenticated_controller.rb
|
143
140
|
- app/controllers/shopify_app/sessions_controller.rb
|
144
141
|
- app/controllers/shopify_app/webhooks_controller.rb
|
@@ -149,7 +146,12 @@ files:
|
|
149
146
|
- config/locales/fr.yml
|
150
147
|
- config/locales/ja.yml
|
151
148
|
- config/routes.rb
|
149
|
+
- docs/Quickstart.md
|
150
|
+
- docs/Releasing.md
|
151
|
+
- docs/Troubleshooting.md
|
152
152
|
- images/app-proxy-screenshot.png
|
153
|
+
- lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb
|
154
|
+
- lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb
|
153
155
|
- lib/generators/shopify_app/add_webhook/add_webhook_generator.rb
|
154
156
|
- lib/generators/shopify_app/add_webhook/templates/webhook_job.rb
|
155
157
|
- lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb
|