shopify_app 12.0.5 → 13.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -6
- data/.travis.yml +4 -3
- data/CHANGELOG.md +33 -1
- data/Gemfile +3 -0
- data/README.md +109 -41
- data/Rakefile +1 -0
- data/app/controllers/concerns/shopify_app/authenticated.rb +1 -1
- data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
- data/app/controllers/shopify_app/callback_controller.rb +15 -11
- data/app/controllers/shopify_app/sessions_controller.rb +35 -9
- data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
- data/config/locales/fi.yml +1 -1
- data/config/locales/nl.yml +7 -7
- data/config/routes.rb +1 -0
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
- data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
- data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
- data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
- data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
- data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
- data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
- data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
- data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -0
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +4 -3
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +1 -1
- data/lib/generators/shopify_app/install/install_generator.rb +10 -9
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
- data/lib/generators/shopify_app/install/templates/omniauth.rb +2 -1
- data/lib/generators/shopify_app/install/templates/{shopify_app.rb → shopify_app.rb.tt} +1 -1
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +1 -1
- data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
- data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
- data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +12 -7
- data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
- data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
- data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +12 -7
- data/lib/generators/shopify_app/views/views_generator.rb +1 -0
- data/lib/shopify_app.rb +9 -4
- data/lib/shopify_app/configuration.rb +21 -17
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -2
- data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
- data/lib/shopify_app/controller_concerns/localization.rb +1 -0
- data/lib/shopify_app/controller_concerns/login_protection.rb +72 -27
- data/lib/shopify_app/controller_concerns/webhook_verification.rb +2 -1
- data/lib/shopify_app/engine.rb +1 -0
- data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
- data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
- data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
- data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
- data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +2 -1
- data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
- data/lib/shopify_app/session/in_memory_shop_session_store.rb +14 -0
- data/lib/shopify_app/session/in_memory_user_session_store.rb +14 -0
- data/lib/shopify_app/session/jwt.rb +61 -0
- data/lib/shopify_app/session/null_user_session_store.rb +22 -0
- data/lib/shopify_app/session/session_repository.rb +36 -14
- data/lib/shopify_app/session/session_storage.rb +1 -10
- data/lib/shopify_app/session/shop_session_storage.rb +42 -0
- data/lib/shopify_app/session/user_session_storage.rb +42 -0
- data/lib/shopify_app/test_helpers/all.rb +2 -0
- data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
- data/lib/shopify_app/utils.rb +6 -5
- data/lib/shopify_app/version.rb +2 -1
- data/package-lock.json +1231 -1210
- data/package.json +1 -1
- data/shopify_app.gemspec +11 -7
- data/yarn.lock +3 -3
- metadata +33 -12
- data/lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb +0 -23
- data/lib/shopify_app/session/storage_strategies/user_storage_strategy.rb +0 -24
data/package.json
CHANGED
data/shopify_app.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
$LOAD_PATH.push(File.expand_path('../lib', __FILE__))
|
2
3
|
require "shopify_app/version"
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
@@ -6,14 +7,17 @@ Gem::Specification.new do |s|
|
|
6
7
|
s.version = ShopifyApp::VERSION
|
7
8
|
s.platform = Gem::Platform::RUBY
|
8
9
|
s.author = "Shopify"
|
9
|
-
s.summary =
|
10
|
+
s.summary = 'This gem is used to get quickly started with the Shopify API'
|
10
11
|
|
11
|
-
s.required_ruby_version = ">= 2.
|
12
|
+
s.required_ruby_version = ">= 2.4"
|
13
|
+
|
14
|
+
s.metadata['allowed_push_host'] = 'https://rubygems.org'
|
12
15
|
|
13
16
|
s.add_runtime_dependency('browser_sniffer', '~> 1.2.0')
|
14
17
|
s.add_runtime_dependency('rails', '> 5.2.1')
|
15
|
-
s.add_runtime_dependency('shopify_api', '~> 9.0.
|
16
|
-
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.
|
18
|
+
s.add_runtime_dependency('shopify_api', '~> 9.0.2')
|
19
|
+
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.2')
|
20
|
+
s.add_runtime_dependency('jwt', '~> 2.2.1')
|
17
21
|
|
18
22
|
s.add_development_dependency('rake')
|
19
23
|
s.add_development_dependency('byebug')
|
@@ -26,7 +30,7 @@ Gem::Specification.new do |s|
|
|
26
30
|
s.add_development_dependency('mocha')
|
27
31
|
s.add_development_dependency('webmock')
|
28
32
|
|
29
|
-
s.files =
|
30
|
-
s.test_files =
|
33
|
+
s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
|
34
|
+
s.test_files = %x(git ls-files -- {test}/*).split("\n")
|
31
35
|
s.require_paths = ["lib"]
|
32
36
|
end
|
data/yarn.lock
CHANGED
@@ -994,9 +994,9 @@ accepts@~1.3.4:
|
|
994
994
|
negotiator "0.6.2"
|
995
995
|
|
996
996
|
acorn@^6.2.1:
|
997
|
-
version "6.
|
998
|
-
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.
|
999
|
-
integrity sha512
|
997
|
+
version "6.4.1"
|
998
|
+
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474"
|
999
|
+
integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==
|
1000
1000
|
|
1001
1001
|
after@0.8.2:
|
1002
1002
|
version "0.8.2"
|
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:
|
4
|
+
version: 13.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_sniffer
|
@@ -44,28 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 9.0.
|
47
|
+
version: 9.0.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 9.0.
|
54
|
+
version: 9.0.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: omniauth-shopify-oauth2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.2.
|
61
|
+
version: 2.2.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.2.
|
68
|
+
version: 2.2.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jwt
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.2.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.2.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -287,7 +301,7 @@ files:
|
|
287
301
|
- lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
|
288
302
|
- lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb
|
289
303
|
- lib/generators/shopify_app/add_webhook/add_webhook_generator.rb
|
290
|
-
- lib/generators/shopify_app/add_webhook/templates/webhook_job.rb
|
304
|
+
- lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
|
291
305
|
- lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb
|
292
306
|
- lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb
|
293
307
|
- lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb
|
@@ -305,7 +319,7 @@ files:
|
|
305
319
|
- lib/generators/shopify_app/install/templates/omniauth.rb
|
306
320
|
- lib/generators/shopify_app/install/templates/session_store.rb
|
307
321
|
- lib/generators/shopify_app/install/templates/shopify_app.js
|
308
|
-
- lib/generators/shopify_app/install/templates/shopify_app.rb
|
322
|
+
- lib/generators/shopify_app/install/templates/shopify_app.rb.tt
|
309
323
|
- lib/generators/shopify_app/install/templates/shopify_app_index.js
|
310
324
|
- lib/generators/shopify_app/install/templates/shopify_provider.rb
|
311
325
|
- lib/generators/shopify_app/install/templates/user_agent.rb
|
@@ -339,10 +353,16 @@ files:
|
|
339
353
|
- lib/shopify_app/managers/webhooks_manager.rb
|
340
354
|
- lib/shopify_app/middleware/same_site_cookie_middleware.rb
|
341
355
|
- lib/shopify_app/session/in_memory_session_store.rb
|
356
|
+
- lib/shopify_app/session/in_memory_shop_session_store.rb
|
357
|
+
- lib/shopify_app/session/in_memory_user_session_store.rb
|
358
|
+
- lib/shopify_app/session/jwt.rb
|
359
|
+
- lib/shopify_app/session/null_user_session_store.rb
|
342
360
|
- lib/shopify_app/session/session_repository.rb
|
343
361
|
- lib/shopify_app/session/session_storage.rb
|
344
|
-
- lib/shopify_app/session/
|
345
|
-
- lib/shopify_app/session/
|
362
|
+
- lib/shopify_app/session/shop_session_storage.rb
|
363
|
+
- lib/shopify_app/session/user_session_storage.rb
|
364
|
+
- lib/shopify_app/test_helpers/all.rb
|
365
|
+
- lib/shopify_app/test_helpers/webhook_verification_helper.rb
|
346
366
|
- lib/shopify_app/utils.rb
|
347
367
|
- lib/shopify_app/version.rb
|
348
368
|
- package-lock.json
|
@@ -355,7 +375,8 @@ files:
|
|
355
375
|
- yarn.lock
|
356
376
|
homepage:
|
357
377
|
licenses: []
|
358
|
-
metadata:
|
378
|
+
metadata:
|
379
|
+
allowed_push_host: https://rubygems.org
|
359
380
|
post_install_message:
|
360
381
|
rdoc_options: []
|
361
382
|
require_paths:
|
@@ -364,7 +385,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
364
385
|
requirements:
|
365
386
|
- - ">="
|
366
387
|
- !ruby/object:Gem::Version
|
367
|
-
version: 2.
|
388
|
+
version: '2.4'
|
368
389
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
369
390
|
requirements:
|
370
391
|
- - ">="
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module ShopifyApp
|
2
|
-
module SessionStorage
|
3
|
-
module ShopStorageStrategy
|
4
|
-
def store(auth_session, *args)
|
5
|
-
shop = find_or_initialize_by(shopify_domain: auth_session.domain)
|
6
|
-
shop.shopify_token = auth_session.token
|
7
|
-
shop.save!
|
8
|
-
shop.id
|
9
|
-
end
|
10
|
-
|
11
|
-
def retrieve(id)
|
12
|
-
return unless id
|
13
|
-
if shop = self.find_by(id: id)
|
14
|
-
ShopifyAPI::Session.new(
|
15
|
-
domain: shop.shopify_domain,
|
16
|
-
token: shop.shopify_token,
|
17
|
-
api_version: shop.api_version
|
18
|
-
)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module ShopifyApp
|
2
|
-
module SessionStorage
|
3
|
-
module UserStorageStrategy
|
4
|
-
def store(auth_session, user)
|
5
|
-
user = find_or_initialize_by(shopify_user_id: user[:id])
|
6
|
-
user.shopify_token = auth_session.token
|
7
|
-
user.shopify_domain = auth_session.domain
|
8
|
-
user.save!
|
9
|
-
user.id
|
10
|
-
end
|
11
|
-
|
12
|
-
def retrieve(id)
|
13
|
-
return unless id
|
14
|
-
if user = self.find_by(shopify_user_id: id)
|
15
|
-
ShopifyAPI::Session.new(
|
16
|
-
domain: user.shopify_domain,
|
17
|
-
token: user.shopify_token,
|
18
|
-
api_version: user.api_version
|
19
|
-
)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|