shopify_app 12.0.6 → 13.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -6
  3. data/.travis.yml +4 -3
  4. data/CHANGELOG.md +31 -0
  5. data/Gemfile +3 -0
  6. data/README.md +98 -42
  7. data/Rakefile +1 -0
  8. data/app/controllers/concerns/shopify_app/authenticated.rb +1 -1
  9. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  10. data/app/controllers/shopify_app/callback_controller.rb +15 -11
  11. data/app/controllers/shopify_app/sessions_controller.rb +35 -9
  12. data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
  13. data/config/locales/fi.yml +1 -1
  14. data/config/locales/nl.yml +7 -7
  15. data/config/routes.rb +1 -0
  16. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
  17. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  18. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
  19. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
  20. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
  21. data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
  22. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
  23. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
  24. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
  25. data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -0
  26. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +4 -3
  27. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +1 -1
  28. data/lib/generators/shopify_app/install/install_generator.rb +10 -9
  29. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  30. data/lib/generators/shopify_app/install/templates/omniauth.rb +2 -1
  31. data/lib/generators/shopify_app/install/templates/{shopify_app.rb → shopify_app.rb.tt} +1 -1
  32. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +1 -1
  33. data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
  34. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
  35. data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
  36. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +12 -7
  37. data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
  38. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  39. data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
  40. data/lib/generators/shopify_app/user_model/user_model_generator.rb +12 -7
  41. data/lib/generators/shopify_app/views/views_generator.rb +1 -0
  42. data/lib/shopify_app.rb +9 -4
  43. data/lib/shopify_app/configuration.rb +21 -17
  44. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -2
  45. data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
  46. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  47. data/lib/shopify_app/controller_concerns/login_protection.rb +72 -27
  48. data/lib/shopify_app/controller_concerns/webhook_verification.rb +2 -1
  49. data/lib/shopify_app/engine.rb +1 -0
  50. data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
  51. data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
  52. data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
  53. data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
  54. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +2 -1
  55. data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
  56. data/lib/shopify_app/session/in_memory_shop_session_store.rb +14 -0
  57. data/lib/shopify_app/session/in_memory_user_session_store.rb +14 -0
  58. data/lib/shopify_app/session/jwt.rb +61 -0
  59. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  60. data/lib/shopify_app/session/session_repository.rb +36 -14
  61. data/lib/shopify_app/session/session_storage.rb +1 -10
  62. data/lib/shopify_app/session/shop_session_storage.rb +42 -0
  63. data/lib/shopify_app/session/user_session_storage.rb +42 -0
  64. data/lib/shopify_app/test_helpers/all.rb +2 -0
  65. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
  66. data/lib/shopify_app/utils.rb +6 -5
  67. data/lib/shopify_app/version.rb +2 -1
  68. data/package-lock.json +1231 -1210
  69. data/package.json +1 -1
  70. data/shopify_app.gemspec +12 -8
  71. data/yarn.lock +3 -3
  72. metadata +35 -14
  73. data/lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb +0 -23
  74. data/lib/shopify_app/session/storage_strategies/user_storage_strategy.rb +0 -24
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "12.0.5",
3
+ "version": "13.1.1",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
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 = %q{This gem is used to get quickly started with the Shopify API}
10
+ s.summary = 'This gem is used to get quickly started with the Shopify API'
10
11
 
11
- s.required_ruby_version = ">= 2.3.1"
12
+ s.required_ruby_version = ">= 2.4"
12
13
 
13
- s.add_runtime_dependency('browser_sniffer', '~> 1.2.0')
14
+ s.metadata['allowed_push_host'] = 'https://rubygems.org'
15
+
16
+ s.add_runtime_dependency('browser_sniffer', '~> 1.2.2')
14
17
  s.add_runtime_dependency('rails', '> 5.2.1')
15
- s.add_runtime_dependency('shopify_api', '~> 9.0.1')
16
- s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.0')
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 = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|example)/}) }
30
- s.test_files = `git ls-files -- {test}/*`.split("\n")
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.3.0"
998
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e"
999
- integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==
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: 12.0.6
4
+ version: 13.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-03 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.2.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: 1.2.0
26
+ version: 1.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 9.0.1
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.1
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.0
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.0
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/storage_strategies/shop_storage_strategy.rb
345
- - lib/shopify_app/session/storage_strategies/user_storage_strategy.rb
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.3.1
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