duodealer_app 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -6
  3. data/app/assets/javascripts/duodealer_app/storage_access.js +1 -1
  4. data/app/controllers/concerns/duodealer_app/authenticated.rb +1 -1
  5. data/app/views/duodealer_app/sessions/enable_cookies.html.erb +1 -1
  6. data/app/views/duodealer_app/sessions/new.html.erb +2 -2
  7. data/app/views/duodealer_app/sessions/top_level_interaction.html.erb +1 -1
  8. data/config/locales/cs.yml +1 -1
  9. data/config/locales/da.yml +1 -1
  10. data/config/locales/de.yml +1 -1
  11. data/config/locales/en.yml +1 -1
  12. data/config/locales/es.yml +1 -1
  13. data/config/locales/fi.yml +1 -1
  14. data/config/locales/fr.yml +1 -1
  15. data/config/locales/hi.yml +1 -1
  16. data/config/locales/it.yml +1 -1
  17. data/config/locales/ja.yml +1 -1
  18. data/config/locales/ko.yml +1 -1
  19. data/config/locales/ms.yml +1 -1
  20. data/config/locales/nb.yml +1 -1
  21. data/config/locales/nl.yml +1 -1
  22. data/config/locales/pl.yml +1 -1
  23. data/config/locales/pt-BR.yml +1 -1
  24. data/config/locales/pt-PT.yml +1 -1
  25. data/config/locales/sv.yml +1 -1
  26. data/config/locales/th.yml +1 -1
  27. data/config/locales/tr.yml +1 -1
  28. data/config/locales/zh-CN.yml +1 -1
  29. data/config/locales/zh-TW.yml +1 -1
  30. data/lib/duodealer_app/managers/scripttags_manager.rb +8 -8
  31. data/lib/duodealer_app/managers/webhooks_manager.rb +3 -3
  32. data/lib/duodealer_app/session/session_storage.rb +1 -1
  33. data/lib/duodealer_app/session/storage_strategies/account_storage_strategy.rb +25 -0
  34. data/lib/duodealer_app/utils.rb +2 -2
  35. data/lib/duodealer_app/version.rb +1 -1
  36. data/lib/duodealer_app.rb +1 -1
  37. data/lib/generators/duodealer_app/{shop_model/shop_model_generator.rb → account_model/account_model_generator.rb} +8 -10
  38. data/lib/generators/duodealer_app/{shop_model/templates/shop.rb → account_model/templates/account.rb} +0 -0
  39. data/lib/generators/duodealer_app/{shop_model/templates/shops.yml → account_model/templates/account.yml} +0 -0
  40. data/lib/generators/duodealer_app/account_model/templates/db/migrate/create_accounts.erb +11 -0
  41. data/lib/generators/duodealer_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +0 -2
  42. data/lib/generators/duodealer_app/add_after_authenticate_job/templates/after_authenticate_job.rb +2 -2
  43. data/lib/generators/duodealer_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +0 -2
  44. data/lib/generators/duodealer_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +0 -2
  45. data/lib/generators/duodealer_app/add_webhook/add_webhook_generator.rb +0 -2
  46. data/lib/generators/duodealer_app/add_webhook/templates/webhook_job.rb +2 -2
  47. data/lib/generators/duodealer_app/app_proxy_controller/app_proxy_controller_generator.rb +0 -2
  48. data/lib/generators/duodealer_app/app_proxy_controller/templates/app_proxy_controller.rb +0 -2
  49. data/lib/generators/duodealer_app/authenticated_controller/authenticated_controller_generator.rb +0 -2
  50. data/lib/generators/duodealer_app/authenticated_controller/templates/authenticated_controller.rb +0 -2
  51. data/lib/generators/duodealer_app/controllers/controllers_generator.rb +0 -2
  52. data/lib/generators/duodealer_app/duodealer_app_generator.rb +1 -3
  53. data/lib/generators/duodealer_app/home_controller/home_controller_generator.rb +0 -2
  54. data/lib/generators/duodealer_app/home_controller/templates/home_controller.rb +0 -2
  55. data/lib/generators/duodealer_app/home_controller/templates/index.html.erb +1 -1
  56. data/lib/generators/duodealer_app/install/install_generator.rb +0 -2
  57. data/lib/generators/duodealer_app/install/templates/embedded_app.html.erb +1 -1
  58. data/lib/generators/duodealer_app/install/templates/session_store.rb +0 -1
  59. data/lib/generators/duodealer_app/rotate_duodealer_token_job/rotate_duodealer_token_job_generator.rb +0 -2
  60. data/lib/generators/duodealer_app/rotate_duodealer_token_job/templates/rotate_duodealer_token.rake +5 -6
  61. data/lib/generators/duodealer_app/rotate_duodealer_token_job/templates/rotate_duodealer_token_job.rb +0 -2
  62. data/lib/generators/duodealer_app/routes/routes_generator.rb +0 -2
  63. data/lib/generators/duodealer_app/user_model/user_model_generator.rb +0 -2
  64. data/lib/generators/duodealer_app/views/views_generator.rb +0 -2
  65. metadata +7 -65
  66. data/.!66854!duodealer_app.gemspec +0 -0
  67. data/docs/.!20385!test-your-app.png +0 -0
  68. data/docs/.!20388!install-on-dev-shop.png +0 -0
  69. data/docs/.!62511!test-your-app.png +0 -0
  70. data/docs/.!62512!install-on-dev-shop.png +0 -0
  71. data/docs/.!62763!test-your-app.png +0 -0
  72. data/docs/.!62765!install-on-dev-shop.png +0 -0
  73. data/docs/.!63018!test-your-app.png +0 -0
  74. data/docs/.!63020!install-on-dev-shop.png +0 -0
  75. data/docs/.!63289!test-your-app.png +0 -0
  76. data/docs/.!63291!install-on-dev-shop.png +0 -0
  77. data/docs/.!63562!test-your-app.png +0 -0
  78. data/docs/.!63564!install-on-dev-shop.png +0 -0
  79. data/docs/.!63872!test-your-app.png +0 -0
  80. data/docs/.!63874!install-on-dev-shop.png +0 -0
  81. data/docs/.!64151!test-your-app.png +0 -0
  82. data/docs/.!64153!install-on-dev-shop.png +0 -0
  83. data/docs/.!64428!test-your-app.png +0 -0
  84. data/docs/.!64431!install-on-dev-shop.png +0 -0
  85. data/docs/.!64737!test-your-app.png +0 -0
  86. data/docs/.!64740!install-on-dev-shop.png +0 -0
  87. data/docs/.!65025!test-your-app.png +0 -0
  88. data/docs/.!65028!install-on-dev-shop.png +0 -0
  89. data/docs/.!65324!test-your-app.png +0 -0
  90. data/docs/.!65327!install-on-dev-shop.png +0 -0
  91. data/docs/.!65626!test-your-app.png +0 -0
  92. data/docs/.!65629!install-on-dev-shop.png +0 -0
  93. data/docs/.!65942!test-your-app.png +0 -0
  94. data/docs/.!65945!install-on-dev-shop.png +0 -0
  95. data/docs/.!66760!test-your-app.png +0 -0
  96. data/docs/.!66763!install-on-dev-shop.png +0 -0
  97. data/docs/.!67028!test-your-app.png +0 -0
  98. data/docs/.!67031!install-on-dev-shop.png +0 -0
  99. data/docs/.!67657!test-your-app.png +0 -0
  100. data/docs/.!67660!install-on-dev-shop.png +0 -0
  101. data/docs/.!68031!test-your-app.png +0 -0
  102. data/docs/.!68034!install-on-dev-shop.png +0 -0
  103. data/docs/.!68363!test-your-app.png +0 -0
  104. data/docs/.!68366!install-on-dev-shop.png +0 -0
  105. data/images/.!20334!app-proxy-screenshot.png +0 -0
  106. data/images/.!62504!app-proxy-screenshot.png +0 -0
  107. data/images/.!62754!app-proxy-screenshot.png +0 -0
  108. data/images/.!63008!app-proxy-screenshot.png +0 -0
  109. data/images/.!63277!app-proxy-screenshot.png +0 -0
  110. data/images/.!63548!app-proxy-screenshot.png +0 -0
  111. data/images/.!63855!app-proxy-screenshot.png +0 -0
  112. data/images/.!64132!app-proxy-screenshot.png +0 -0
  113. data/images/.!64407!app-proxy-screenshot.png +0 -0
  114. data/images/.!64714!app-proxy-screenshot.png +0 -0
  115. data/images/.!65000!app-proxy-screenshot.png +0 -0
  116. data/images/.!65296!app-proxy-screenshot.png +0 -0
  117. data/images/.!65594!app-proxy-screenshot.png +0 -0
  118. data/images/.!65908!app-proxy-screenshot.png +0 -0
  119. data/images/.!66724!app-proxy-screenshot.png +0 -0
  120. data/images/.!66989!app-proxy-screenshot.png +0 -0
  121. data/images/.!67614!app-proxy-screenshot.png +0 -0
  122. data/images/.!67986!app-proxy-screenshot.png +0 -0
  123. data/images/.!68314!app-proxy-screenshot.png +0 -0
  124. data/lib/duodealer_app/session/storage_strategies/shop_storage_strategy.rb +0 -25
  125. data/lib/generators/duodealer_app/shop_model/templates/db/migrate/create_shops.erb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2269bcddcbaf2ec4b28af339d18939f72c087eeb238612d5ffafd30c1911f7f
4
- data.tar.gz: 9837fe7b93b11dda135fab7e9913cebe4388ccd23f48c4182309a3e9839f17cc
3
+ metadata.gz: 9bd076d150bbda67fd85120ca53340145100c291f3735f9d6b2310bf83e88f21
4
+ data.tar.gz: 377d76ef4c8a3d774609eb1aea989fe17696ced667ead3c92b564e60b0fb9308
5
5
  SHA512:
6
- metadata.gz: 390073fdc0a5321ec2f11c5535237e23299f3718bb9f38d786370a46367e73ae292154721cfcebbf23bec93e72b360b249427f9c988f5f9e16468a8b5444a3d9
7
- data.tar.gz: 8c230c87bbcc2e07d9c95c980c6444f604a5eca30172359776fc49870d75230c52641baf40578c670f4495da9323924463f7bb46b844ae85b26536dfceb9d521
6
+ metadata.gz: 5f87a9d0829b3a04a7490079748b9865e301af819118cdcf7f29fdb24582d7976587e08694c8b39f15336b6200bb9d6a732ce3fa4d2973149f2cd29c6a2b1ff5
7
+ data.tar.gz: 290bd181c140f6f4275d21b70cabd4c37cf2c9e94e1def7362d779852776d63e6f366338ee95c934e41616424c71781311eabdb68d6e3cae17c8a76c54c0376f
data/README.md CHANGED
@@ -220,7 +220,7 @@ If you only run the install generator then by default you will have an in memory
220
220
  #### Shop-based token storage
221
221
  Storing tokens on the store model means that any user login associated to the store will have equal access levels to whatever the original user granted the app.
222
222
  ```sh
223
- $ rails generate duodealer_app:shop_model
223
+ $ rails generate duodealer_app:account_model
224
224
  ```
225
225
  This will generate a shop model which will be the storage for the tokens necessary for authentication.
226
226
 
@@ -311,7 +311,7 @@ end
311
311
 
312
312
  When the oauth callback is completed successfully DuodealerApp will queue a background job which will ensure all the specified webhooks exist for that shop. Because this runs on every oauth callback it means your app will always have the webhooks it needs even if the user uninstalls and re-installs the app.
313
313
 
314
- DuodealerApp also provides a WebhooksController that receives webhooks and queues a job based on the received topic. For example if you register the webhook from above then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params: `shop_domain` and `webhook` (which is the webhook body).
314
+ DuodealerApp also provides a WebhooksController that receives webhooks and queues a job based on the received topic. For example if you register the webhook from above then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params: `account_domain` and `webhook` (which is the webhook body).
315
315
 
316
316
  If you would like to namespace your jobs you may set `webhook_jobs_namespace` in the config. For example if your app handles webhooks from other ecommerce applications as well, and you want Duo Dealer cart update webhooks to be processed by a job living in `jobs/duodealer/webhooks/carts_update_job.rb` rather than `jobs/carts_update_job.rb`):
317
317
 
@@ -339,7 +339,7 @@ class CustomWebhooksController < ApplicationController
339
339
 
340
340
  def carts_update
341
341
  params.permit!
342
- SomeJob.perform_later(shop_domain: shop_domain, webhook: webhook_params.to_h)
342
+ SomeJob.perform_later(account_domain: account_domain, webhook: webhook_params.to_h)
343
343
  head :no_content
344
344
  end
345
345
 
@@ -518,13 +518,13 @@ end
518
518
 
519
519
  ### Generated file change
520
520
 
521
- `embedded_app.html.erb` the usage of `shop_session.url` needs to be changed to `shop_session.domain`
521
+ `embedded_app.html.erb` the usage of `account_session.url` needs to be changed to `account_session.domain`
522
522
  ```erb
523
523
  <script type="text/javascript">
524
524
  DuodealerApp.init({
525
525
  apiKey: "<%= DuodealerApp.configuration.api_key %>",
526
526
 
527
- shopOrigin: "<%= "https://#{ @shop_session.url }" if @shop_session %>",
527
+ shopOrigin: "<%= "https://#{ @account_session.url }" if @account_session %>",
528
528
 
529
529
  debug: false,
530
530
  forceRedirect: true
@@ -537,7 +537,7 @@ is changed to
537
537
  DuodealerApp.init({
538
538
  apiKey: "<%= DuodealerApp.configuration.api_key %>",
539
539
 
540
- shopOrigin: "<%= "https://#{ @shop_session.domain }" if @shop_session %>",
540
+ shopOrigin: "<%= "https://#{ @account_session.domain }" if @account_session %>",
541
541
 
542
542
  debug: false,
543
543
  forceRedirect: true
@@ -132,7 +132,7 @@
132
132
 
133
133
  /* ITP 2.0 solution: handles cookie partitioning */
134
134
  StorageAccessHelper.prototype.setUpHelper = function() {
135
- return new ITPHelper({redirectUrl: window.shopOrigin + "/admin/apps/" + window.apiKey + window.returnTo});
135
+ return new ITPHelper({redirectUrl: window.accountOrigin + "/admin/apps/" + window.apiKey + window.returnTo});
136
136
  }
137
137
 
138
138
  StorageAccessHelper.prototype.setCookieAndRedirect = function() {
@@ -8,7 +8,7 @@ module DuodealerApp
8
8
  include DuodealerApp::Localization
9
9
  include DuodealerApp::LoginProtection
10
10
  include DuodealerApp::EmbeddedApp
11
- before_action :login_again_if_different_user_or_shop
11
+ before_action :login_again_if_different_user_or_account
12
12
  around_action :duodealer_session
13
13
  end
14
14
  end
@@ -16,7 +16,7 @@
16
16
  </style>
17
17
  <script>
18
18
  window.apiKey = "<%= DuodealerApp.configuration.api_key %>";
19
- window.shopOrigin = "https://<%= @shop %>";
19
+ window.accountOrigin = "https://<%= @account %>";
20
20
  window.returnTo = "<%= params[:return_to] %>"
21
21
  </script>
22
22
 
@@ -107,14 +107,14 @@
107
107
  <%= application_name.presence || 'Duo Dealer App – Installation' %>
108
108
  </h3>
109
109
  <p class="subtitle">
110
- <label for="shop">Enter your shop domain to log in or install this app.</label>
110
+ <label for="account">Enter your account domain to log in or install this app.</label>
111
111
  </p>
112
112
 
113
113
  <%= form_tag login_path do %>
114
114
  <% if flash[:error] %>
115
115
  <div class="error"><%= flash[:error] %></div>
116
116
  <% end %>
117
- <input id="shop" name="shop" type="text" autofocus="autofocus" placeholder="example.duodealer.com" class="marketing-input">
117
+ <input id="account" name="account" type="text" autofocus="autofocus" placeholder="example.duodealer.com" class="marketing-input">
118
118
  <button type="submit" class="marketing-button">Install</button>
119
119
  <% end %>
120
120
  </main>
@@ -17,7 +17,7 @@
17
17
 
18
18
  <script>
19
19
  window.apiKey = "<%= DuodealerApp.configuration.api_key %>";
20
- window.shopOrigin = "https://<%= @shop %>";
20
+ window.accountOrigin = "https://<%= @account %>";
21
21
  window.redirectUrl = "<%= @url %>";
22
22
  </script>
23
23
 
@@ -2,7 +2,7 @@
2
2
  cs:
3
3
  logged_out: Odhlášení proběhlo úspěšně
4
4
  could_not_log_in: Nelze se přihlásit do obchodu Duo Dealer
5
- invalid_shop_url: Neplatná doména obchodu
5
+ invalid_account_url: Neplatná doména obchodu
6
6
  enable_cookies_heading: Zapnout soubory cookie z aplikace %{app}
7
7
  enable_cookies_body: Pokud chcete v Duo Dealer používat aplikaci %{app}, musíte soubory
8
8
  cookie v tomto prohlížeči povolit ručně.
@@ -2,7 +2,7 @@
2
2
  da:
3
3
  logged_out: Logget ud
4
4
  could_not_log_in: Kunne ikke logge ind på Duo Dealer-butik
5
- invalid_shop_url: Ugyldig butiksdomæne
5
+ invalid_account_url: Ugyldig butiksdomæne
6
6
  enable_cookies_heading: Aktivér cookies fra %{app}
7
7
  enable_cookies_body: Du skal manuelt aktivere cookies i denne browser for at kunne
8
8
  bruge %{app} i Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  de:
3
3
  logged_out: Erfolgreich ausgelogt
4
4
  could_not_log_in: Duo Dealer Store Login fehlgeschlagen
5
- invalid_shop_url: Ungültige Shop-Domain
5
+ invalid_account_url: Ungültige Shop-Domain
6
6
  enable_cookies_heading: Cookies von %{app} aktivieren
7
7
  enable_cookies_body: Sie müssen Cookies in diesem Browser manuell aktivieren, um
8
8
  %{app} in Duo Dealer verwenden zu können.
@@ -1,7 +1,7 @@
1
1
  en:
2
2
  logged_out: 'Successfully logged out'
3
3
  could_not_log_in: 'Could not log in to Duo Dealer store'
4
- invalid_shop_url: 'Invalid shop domain'
4
+ invalid_account_url: 'Invalid shop domain'
5
5
  enable_cookies_heading: "Enable cookies from %{app}"
6
6
  enable_cookies_body: "You must manually enable cookies in this browser in order to use %{app} within Duo Dealer."
7
7
  enable_cookies_footer: 'Cookies let the app authenticate you by temporarily storing your preferences and personal information. They expire after 30 days.'
@@ -2,7 +2,7 @@
2
2
  es:
3
3
  logged_out: Cerrar sesión
4
4
  could_not_log_in: No se pudo iniciar sesión en tu tienda Duo Dealer
5
- invalid_shop_url: Dominio de tienda inválido
5
+ invalid_account_url: Dominio de tienda inválido
6
6
  enable_cookies_heading: Habilitar cookies de %{app}
7
7
  enable_cookies_body: Debes habilitar manualmente las cookies en este navegador para
8
8
  usar %{app} en Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  fi:
3
3
  logged_out: Olet kirjautunut ulos
4
4
  could_not_log_in: Kirjautuminen Duo Dealer-kauppaan ei onnistunut
5
- invalid_shop_url: Virheellinen kaupan verkkotunnus
5
+ invalid_account_url: Virheellinen kaupan verkkotunnus
6
6
  enable_cookies_heading: Ota käyttöön sovelluksen %{app} evästeet
7
7
  enable_cookies_body: Sinun on otettava evästeet käyttöön manuaalisesti tässä selaimessa,
8
8
  jotta voit käyttää sovellusta %{app} Duo Dealerssa.
@@ -2,7 +2,7 @@
2
2
  fr:
3
3
  logged_out: Vous êtes déconnecté(e)
4
4
  could_not_log_in: Impossible de se connecter à la boutique Duo Dealer
5
- invalid_shop_url: Url invalide
5
+ invalid_account_url: Url invalide
6
6
  enable_cookies_heading: Activer les cookies de %{app}
7
7
  enable_cookies_body: Vous devez manuellement activer les cookies dans ce navigateur
8
8
  pour utiliser %{app} dans Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  hi:
3
3
  logged_out: सफलतापूर्वक लॉग आउट कर दिया
4
4
  could_not_log_in: Duo Dealer स्टोर में लॉग इन नहीं किया जा सका
5
- invalid_shop_url: अमान्य शॉप डोमेन
5
+ invalid_account_url: अमान्य शॉप डोमेन
6
6
  enable_cookies_heading: "%{app} के कुकीज़ सक्षम करें"
7
7
  enable_cookies_body: आपको %{app} का उपयोग Duo Dealer में करने के लिए इस ब्राउज़र में
8
8
  कुकीज़ मैन्युअल रूप से सक्षम करने चाहिए.
@@ -2,7 +2,7 @@
2
2
  it:
3
3
  logged_out: Disconnessione effettuata correttamente
4
4
  could_not_log_in: Impossibile accedere al negozio Duo Dealer
5
- invalid_shop_url: Dominio negozio non valido
5
+ invalid_account_url: Dominio negozio non valido
6
6
  enable_cookies_heading: Abilita i cookie di %{app}
7
7
  enable_cookies_body: Devi abilitare manualmente i cookie in questo browser per poter
8
8
  utilizzare %{app} da Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  ja:
3
3
  logged_out: ログインに成功しました
4
4
  could_not_log_in: Duo Dealerストアにログインできませんでした
5
- invalid_shop_url: ショップのドメインが無効です
5
+ invalid_account_url: ショップのドメインが無効です
6
6
  enable_cookies_heading: "%{app}からのCookieを有効にする"
7
7
  enable_cookies_body: Duo Dealerで%{app}を使用できるようにするためには、このブラウザのCookieを手動で有効にする必要があります。
8
8
  enable_cookies_footer: Cookieを使用すると、各種設定や個人情報を一時的に保存することで、アプリ認証を受けることができます。30日後に有効期限が切れます。
@@ -2,7 +2,7 @@
2
2
  ko:
3
3
  logged_out: 성공적으로 로그아웃 되었습니다.
4
4
  could_not_log_in: Duo Dealer 스토어에 로그인할 수 없습니다.
5
- invalid_shop_url: 유효하지 않은 상점 도메인
5
+ invalid_account_url: 유효하지 않은 상점 도메인
6
6
  enable_cookies_heading: "%{app}에서 쿠키를 사용 가능"
7
7
  enable_cookies_body: Duo Dealer 내에서 %{app} 을 사용하기 위해 이 브라우저에서 쿠키를 수동으로 사용할 수 있습니다.
8
8
  enable_cookies_footer: 쿠키를 사용하면 개인의 선호나 정보를 임시로 저장하여 앱에서 사용자를 인증할 수 있습니다. 쿠키는 30일
@@ -2,7 +2,7 @@
2
2
  ms:
3
3
  logged_out: Berjaya log keluar
4
4
  could_not_log_in: Tidak dapat log masuk ke kedai Duo Dealer
5
- invalid_shop_url: Domain kedai tidak sah
5
+ invalid_account_url: Domain kedai tidak sah
6
6
  enable_cookies_heading: Dayakan kuki dari %{app}
7
7
  enable_cookies_body: Anda mesti mengaktifkan kuki secara manual dalam pelayar ini
8
8
  untuk %{app} digunakan dalam Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  nb:
3
3
  logged_out: Logget ut
4
4
  could_not_log_in: Kunne ikke logge på Duo Dealer-butikken
5
- invalid_shop_url: Ugyldig butikkdomene
5
+ invalid_account_url: Ugyldig butikkdomene
6
6
  enable_cookies_heading: Aktiver informasjonskapsler fra %{app}
7
7
  enable_cookies_body: Du kan manuelt aktivere informasjonskapsler i denne nettleseren
8
8
  for å kunne bruke %{app} i Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  nl:
3
3
  logged_out: u bent afgemeld
4
4
  could_not_log_in: Kon niet aanmelden bij Duo Dealer-winkel
5
- invalid_shop_url: Ongeldig winkeldomein
5
+ invalid_account_url: Ongeldig winkeldomein
6
6
  enable_cookies_heading: Schakel cookies in van %{app}
7
7
  enable_cookies_body: U moet cookies in deze browser handmatig inschakelen om %{app}
8
8
  binnen Duo Dealer te gebruiken.
@@ -2,7 +2,7 @@
2
2
  pl:
3
3
  logged_out: Pomyślne wylogowanie
4
4
  could_not_log_in: Nie można zalogować się do sklepu Duo Dealer
5
- invalid_shop_url: Nieprawidłowa domena sklepu
5
+ invalid_account_url: Nieprawidłowa domena sklepu
6
6
  enable_cookies_heading: Włącz korzystanie z plików cookie z %{app}
7
7
  enable_cookies_body: Aby móc korzystać z %{app} w Duo Dealer, musisz ręcznie włączyć
8
8
  korzystanie z plików cookie w tej przeglądarce.
@@ -2,7 +2,7 @@
2
2
  pt-BR:
3
3
  logged_out: Você saiu.
4
4
  could_not_log_in: Não foi possível fazer login na Duo Dealer store
5
- invalid_shop_url: Domínio de loja inválido
5
+ invalid_account_url: Domínio de loja inválido
6
6
  enable_cookies_heading: Habilitar cookies de %{app}
7
7
  enable_cookies_body: Você precisa habilitar manualmente os cookies neste navegador
8
8
  para usar %{app} dentro da Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  pt-PT:
3
3
  logged_out: Terminou a sessão com sucesso
4
4
  could_not_log_in: Não foi possível iniciar sessão na loja da Duo Dealer
5
- invalid_shop_url: Domínio de loja inválido
5
+ invalid_account_url: Domínio de loja inválido
6
6
  enable_cookies_heading: Ativar cookies de %{app}
7
7
  enable_cookies_body: Tem de ativar manualmente os cookies neste navegador para utilizar
8
8
  %{app} dentro da Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  sv:
3
3
  logged_out: Har loggats ut
4
4
  could_not_log_in: Det gick inte att logga in i Duo Dealer-butiken
5
- invalid_shop_url: Ogiltig butiksdomän
5
+ invalid_account_url: Ogiltig butiksdomän
6
6
  enable_cookies_heading: Aktivera cookies från %{app}
7
7
  enable_cookies_body: Du måste aktivera cookies manuellt i den här webbläsaren för
8
8
  att kunna använda %{app} inom Duo Dealer.
@@ -2,7 +2,7 @@
2
2
  th:
3
3
  logged_out: ออกจากระบบสำเร็จ
4
4
  could_not_log_in: ไม่สามารถเข้าสู่ระบบร้านค้า Duo Dealer ได้
5
- invalid_shop_url: โดเมนร้านค้าไม่ถูกต้อง
5
+ invalid_account_url: โดเมนร้านค้าไม่ถูกต้อง
6
6
  enable_cookies_heading: เปิดใช้งานคุกกี้จาก %{app}
7
7
  enable_cookies_body: คุณต้องเปิดใช้งานคุกกี้ด้วยตนเองในเบราว์เซอร์นี้เพื่อใช้งาน
8
8
  %{app} ภายใน Duo Dealer
@@ -2,7 +2,7 @@
2
2
  tr:
3
3
  logged_out: Oturum başarıyla kapatıldı
4
4
  could_not_log_in: Duo Dealer mağazasında oturum açılamadı
5
- invalid_shop_url: Geçersiz mağaza alan adı
5
+ invalid_account_url: Geçersiz mağaza alan adı
6
6
  enable_cookies_heading: "%{app} uygulamasından çerezleri etkinleştir"
7
7
  enable_cookies_body: "%{app} uygulamasını Duo Dealer içinde kullanabilmek için bu tarayıcıda
8
8
  çerezleri manuel olarak etkinleştirmelisiniz."
@@ -2,7 +2,7 @@
2
2
  zh-CN:
3
3
  logged_out: 已成功退出
4
4
  could_not_log_in: 无法登录到 Duo Dealer 商店
5
- invalid_shop_url: 商店域名无效
5
+ invalid_account_url: 商店域名无效
6
6
  enable_cookies_heading: 从 %{app} 启用 Cookie
7
7
  enable_cookies_body: 您必须在此浏览器中手动启用 Cookie 才能在 Duo Dealer 中使用 %{app}。
8
8
  enable_cookies_footer: Cookie 使此应用能够通过暂时存储您的偏好设置和个人信息来验证您的身份。这些信息将在 30 天后过期。
@@ -2,7 +2,7 @@
2
2
  zh-TW:
3
3
  logged_out: 登出成功
4
4
  could_not_log_in: 無法登入 Duo Dealer 商店
5
- invalid_shop_url: 商店網域無效
5
+ invalid_account_url: 商店網域無效
6
6
  enable_cookies_heading: 啟用 %{app} 的 Cookie
7
7
  enable_cookies_body: 您必須在此瀏覽器中手動啟用 Cookie,才能夠在 Duo Dealer 使用 %{app}。
8
8
  enable_cookies_footer: Cookie 可讓應用程式暫時儲存您的偏好設定和個人資訊,藉此驗證您的身分,這些資料會在 30 天後失效。
@@ -4,12 +4,12 @@ module DuodealerApp
4
4
  class ScripttagsManager
5
5
  class CreationFailed < StandardError; end
6
6
 
7
- def self.queue(shop_domain, shop_token, scripttags)
7
+ def self.queue(account_domain, account_token, scripttags)
8
8
  DuodealerApp::ScripttagsManagerJob.perform_later(
9
- shop_domain: shop_domain,
10
- shop_token: shop_token,
9
+ account_domain: account_domain,
10
+ account_token: account_token,
11
11
  # Procs cannot be serialized so we interpolate now, if necessary
12
- scripttags: build_src(scripttags, shop_domain)
12
+ scripttags: build_src(scripttags, account_domain)
13
13
  )
14
14
  end
15
15
 
@@ -22,11 +22,11 @@ module DuodealerApp
22
22
  end
23
23
  end
24
24
 
25
- attr_reader :required_scripttags, :shop_domain
25
+ attr_reader :required_scripttags, :account_domain
26
26
 
27
- def initialize(scripttags, shop_domain)
27
+ def initialize(scripttags, account_domain)
28
28
  @required_scripttags = scripttags
29
- @shop_domain = shop_domain
29
+ @account_domain = account_domain
30
30
  end
31
31
 
32
32
  def recreate_scripttags!
@@ -53,7 +53,7 @@ module DuodealerApp
53
53
 
54
54
  private
55
55
  def expanded_scripttags
56
- self.class.build_src(required_scripttags, shop_domain)
56
+ self.class.build_src(required_scripttags, account_domain)
57
57
  end
58
58
 
59
59
  def is_required_scripttag?(scripttags, tag)
@@ -4,10 +4,10 @@ module DuodealerApp
4
4
  class WebhooksManager
5
5
  class CreationFailed < StandardError; end
6
6
 
7
- def self.queue(shop_domain, shop_token, webhooks)
7
+ def self.queue(account_domain, account_token, webhooks)
8
8
  DuodealerApp::WebhooksManagerJob.perform_later(
9
- shop_domain: shop_domain,
10
- shop_token: shop_token,
9
+ account_domain: account_domain,
10
+ account_token: account_token,
11
11
  webhooks: webhooks
12
12
  )
13
13
  end
@@ -8,7 +8,7 @@ module DuodealerApp
8
8
  if DuodealerApp.configuration.per_user_tokens?
9
9
  extend DuodealerApp::SessionStorage::UserStorageStrategy
10
10
  else
11
- extend DuodealerApp::SessionStorage::ShopStorageStrategy
11
+ extend DuodealerApp::SessionStorage::AccountStorageStrategy
12
12
  end
13
13
 
14
14
  validates :duodealer_token, presence: true
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DuodealerApp
4
+ module SessionStorage
5
+ module AccountStorageStrategy
6
+ def store(auth_session, *args)
7
+ account = find_or_initialize_by(duodealer_domain: auth_session.domain)
8
+ account.duodealer_token = auth_session.token
9
+ account.save!
10
+ account.id
11
+ end
12
+
13
+ def retrieve(id)
14
+ return unless id
15
+ if account = self.find_by(id: id)
16
+ DuodealerAPI::Session.new(
17
+ domain: account.duodealer_domain,
18
+ token: account.duodealer_token,
19
+ api_version: account.api_version
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module DuodealerApp
4
4
  module Utils
5
- def self.sanitize_shop_domain(shop_domain)
6
- name = shop_domain.to_s.downcase.strip
5
+ def self.sanitize_account_domain(account_domain)
6
+ name = account_domain.to_s.downcase.strip
7
7
  name += ".#{DuodealerApp.configuration.duodealer_domain}" if !name.include?("#{DuodealerApp.configuration.duodealer_domain}") && !name.include?(".")
8
8
  name.sub!(%r|https?://|, "")
9
9
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DuodealerApp
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
data/lib/duodealer_app.rb CHANGED
@@ -46,7 +46,7 @@ module DuodealerApp
46
46
  require "duodealer_app/middleware/same_site_cookie_middleware"
47
47
 
48
48
  # session
49
- require "duodealer_app/session/storage_strategies/shop_storage_strategy"
49
+ require "duodealer_app/session/storage_strategies/account_storage_strategy"
50
50
  require "duodealer_app/session/storage_strategies/user_storage_strategy"
51
51
  require "duodealer_app/session/session_storage"
52
52
  require "duodealer_app/session/session_repository"
@@ -1,28 +1,26 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
  require "rails/generators/active_record"
5
3
 
6
4
  module DuodealerApp
7
5
  module Generators
8
- class ShopModelGenerator < Rails::Generators::Base
6
+ class AccountModelGenerator < Rails::Generators::Base
9
7
  include Rails::Generators::Migration
10
8
  source_root File.expand_path("../templates", __FILE__)
11
9
 
12
- def create_shop_model
13
- copy_file "shop.rb", "app/models/shop.rb"
10
+ def create_account_model
11
+ copy_file "account.rb", "app/models/account.rb"
14
12
  end
15
13
 
16
- def create_shop_migration
17
- migration_template "db/migrate/create_shops.erb", "db/migrate/create_shops.rb"
14
+ def create_account_migration
15
+ migration_template "db/migrate/create_accounts.erb", "db/migrate/create_accounts.rb"
18
16
  end
19
17
 
20
18
  def update_duodealer_app_initializer
21
- gsub_file "config/initializers/duodealer_app.rb", "DuodealerApp::InMemorySessionStore", "Shop"
19
+ gsub_file "config/initializers/duodealer_app.rb", "DuodealerApp::InMemorySessionStore", "account"
22
20
  end
23
21
 
24
- def create_shop_fixtures
25
- copy_file "shops.yml", "test/fixtures/shops.yml"
22
+ def create_account_fixtures
23
+ copy_file "accounts.yml", "test/fixtures/accounts.yml"
26
24
  end
27
25
 
28
26
  private
@@ -0,0 +1,11 @@
1
+ class CreateAccounts < ActiveRecord::Migration[<%= rails_migration_version %>]
2
+ def change
3
+ create_table :accounts do |t|
4
+ t.string :duodealer_domain, null: false
5
+ t.string :duodealer_token, null: false
6
+ t.timestamps
7
+ end
8
+
9
+ add_index :accounts, :duodealer_domain, unique: true
10
+ end
11
+ end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,7 +1,7 @@
1
1
  module Duodealer
2
2
  class AfterAuthenticateJob < ActiveJob::Base
3
- def perform(shop_domain:)
4
- shop = Shop.find_by(duodealer_domain: shop_domain)
3
+ def perform(account_domain:)
4
+ shop = Shop.find_by(duodealer_domain: account_domain)
5
5
 
6
6
  shop.with_duodealer_session do
7
7
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  class MarketingActivitiesController < DuodealerApp::ExtensionVerificationController
4
2
  def preload_form_data
5
3
  preload_data = {
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,6 +1,6 @@
1
1
  class <%= @job_class_name %> < ActiveJob::Base
2
- def perform(shop_domain:, webhook:)
3
- shop = Shop.find_by(duodealer_domain: shop_domain)
2
+ def perform(account_domain:, webhook:)
3
+ shop = Shop.find_by(duodealer_domain: account_domain)
4
4
 
5
5
  shop.with_duodealer_session do
6
6
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  class AppProxyController < ApplicationController
4
2
  include DuodealerApp::AppProxyVerification
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  class AuthenticatedController < ApplicationController
4
2
  include DuodealerApp::Authenticated
5
3
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module DuodealerApp
4
2
  module Generators
5
3
  class DuodealerAppGenerator < Rails::Generators::Base
@@ -10,7 +8,7 @@ module DuodealerApp
10
8
 
11
9
  def run_all_generators
12
10
  generate "duodealer_app:install #{@opts.join(' ')}"
13
- generate "duodealer_app:shop_model"
11
+ generate "duodealer_app:account_model"
14
12
  generate("duodealer_app:authenticated_controller")
15
13
  generate "duodealer_app:home_controller"
16
14
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  class HomeController < AuthenticatedController
4
2
  def index
5
3
  @products = DuodealerAPI::Product.find(:all, params: { limit: 10 })
@@ -2,7 +2,7 @@
2
2
 
3
3
  <ul>
4
4
  <% @products.each do |product| %>
5
- <li><%= link_to product.title, "https://#{@shop_session.domain}/admin/products/#{product.id}", target: "_top" %></li>
5
+ <li><%= link_to product.title, "https://#{@account_session.domain}/admin/products/#{product.id}", target: "_top" %></li>
6
6
  <% end %>
7
7
  </ul>
8
8
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -28,7 +28,7 @@
28
28
 
29
29
  <%= content_tag(:div, nil, id: 'duodealer-app-init', data: {
30
30
  api_key: DuodealerApp.configuration.api_key,
31
- shop_origin: (@shop_session.domain if @shop_session),
31
+ account_origin: (@account_session.domain if @account_session),
32
32
  debug: Rails.env.development?
33
33
  } ) %>
34
34
 
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
  # Be sure to restart your server when you modify this file.
3
2
 
4
3
  Rails.application.config.session_store(:cookie_store, key: '_example_session', expire_after: 14.days)
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,17 +1,16 @@
1
- # frozen_string_literal: true
2
1
  namespace :duodealer do
3
- desc "Rotate duodealer tokens for all active shops"
2
+ desc "Rotate duodealer tokens for all active accounts"
4
3
  task :rotate_duodealer_tokens, [:refresh_token] => :environment do |_t, args|
5
- all_active_shops.find_each do |shop|
4
+ all_active_accounts.find_each do |account|
6
5
  Duodealer::RotateDuodealerTokenJob.perform_later(
7
- shop_domain: shop.duodealer_domain,
6
+ account_domain: account.duodealer_domain,
8
7
  refresh_token: args[:refresh_token]
9
8
  )
10
9
  end
11
10
  end
12
11
 
13
12
  # Its implementation will depend on the app configuration. Change accordingly.
14
- def all_active_shops
15
- Shop.all
13
+ def all_active_accounts
14
+ Account.all
16
15
  end
17
16
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Duodealer
4
2
  class RotateDuodealerTokenJob < ActiveJob::Base
5
3
  def perform(params)
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
  require "rails/generators/active_record"
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators/base"
4
2
 
5
3
  module DuodealerApp
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duodealer_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Raio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-24 00:00:00.000000000 Z
11
+ date: 2020-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer
@@ -212,7 +212,6 @@ executables: []
212
212
  extensions: []
213
213
  extra_rdoc_files: []
214
214
  files:
215
- - ".!66854!duodealer_app.gemspec"
216
215
  - ".babelrc"
217
216
  - ".gitignore"
218
217
  - ".nvmrc"
@@ -272,69 +271,12 @@ files:
272
271
  - config/locales/zh-CN.yml
273
272
  - config/locales/zh-TW.yml
274
273
  - config/routes.rb
275
- - docs/.!20385!test-your-app.png
276
- - docs/.!20388!install-on-dev-shop.png
277
- - docs/.!62511!test-your-app.png
278
- - docs/.!62512!install-on-dev-shop.png
279
- - docs/.!62763!test-your-app.png
280
- - docs/.!62765!install-on-dev-shop.png
281
- - docs/.!63018!test-your-app.png
282
- - docs/.!63020!install-on-dev-shop.png
283
- - docs/.!63289!test-your-app.png
284
- - docs/.!63291!install-on-dev-shop.png
285
- - docs/.!63562!test-your-app.png
286
- - docs/.!63564!install-on-dev-shop.png
287
- - docs/.!63872!test-your-app.png
288
- - docs/.!63874!install-on-dev-shop.png
289
- - docs/.!64151!test-your-app.png
290
- - docs/.!64153!install-on-dev-shop.png
291
- - docs/.!64428!test-your-app.png
292
- - docs/.!64431!install-on-dev-shop.png
293
- - docs/.!64737!test-your-app.png
294
- - docs/.!64740!install-on-dev-shop.png
295
- - docs/.!65025!test-your-app.png
296
- - docs/.!65028!install-on-dev-shop.png
297
- - docs/.!65324!test-your-app.png
298
- - docs/.!65327!install-on-dev-shop.png
299
- - docs/.!65626!test-your-app.png
300
- - docs/.!65629!install-on-dev-shop.png
301
- - docs/.!65942!test-your-app.png
302
- - docs/.!65945!install-on-dev-shop.png
303
- - docs/.!66760!test-your-app.png
304
- - docs/.!66763!install-on-dev-shop.png
305
- - docs/.!67028!test-your-app.png
306
- - docs/.!67031!install-on-dev-shop.png
307
- - docs/.!67657!test-your-app.png
308
- - docs/.!67660!install-on-dev-shop.png
309
- - docs/.!68031!test-your-app.png
310
- - docs/.!68034!install-on-dev-shop.png
311
- - docs/.!68363!test-your-app.png
312
- - docs/.!68366!install-on-dev-shop.png
313
274
  - docs/Quickstart.md
314
275
  - docs/Releasing.md
315
276
  - docs/Troubleshooting.md
316
277
  - docs/install-on-dev-shop.png
317
278
  - docs/test-your-app.png
318
279
  - duodealer_app.gemspec
319
- - images/.!20334!app-proxy-screenshot.png
320
- - images/.!62504!app-proxy-screenshot.png
321
- - images/.!62754!app-proxy-screenshot.png
322
- - images/.!63008!app-proxy-screenshot.png
323
- - images/.!63277!app-proxy-screenshot.png
324
- - images/.!63548!app-proxy-screenshot.png
325
- - images/.!63855!app-proxy-screenshot.png
326
- - images/.!64132!app-proxy-screenshot.png
327
- - images/.!64407!app-proxy-screenshot.png
328
- - images/.!64714!app-proxy-screenshot.png
329
- - images/.!65000!app-proxy-screenshot.png
330
- - images/.!65296!app-proxy-screenshot.png
331
- - images/.!65594!app-proxy-screenshot.png
332
- - images/.!65908!app-proxy-screenshot.png
333
- - images/.!66724!app-proxy-screenshot.png
334
- - images/.!66989!app-proxy-screenshot.png
335
- - images/.!67614!app-proxy-screenshot.png
336
- - images/.!67986!app-proxy-screenshot.png
337
- - images/.!68314!app-proxy-screenshot.png
338
280
  - images/app-proxy-screenshot.png
339
281
  - karma.conf.js
340
282
  - lib/duodealer_app.rb
@@ -354,10 +296,14 @@ files:
354
296
  - lib/duodealer_app/session/in_memory_session_store.rb
355
297
  - lib/duodealer_app/session/session_repository.rb
356
298
  - lib/duodealer_app/session/session_storage.rb
357
- - lib/duodealer_app/session/storage_strategies/shop_storage_strategy.rb
299
+ - lib/duodealer_app/session/storage_strategies/account_storage_strategy.rb
358
300
  - lib/duodealer_app/session/storage_strategies/user_storage_strategy.rb
359
301
  - lib/duodealer_app/utils.rb
360
302
  - lib/duodealer_app/version.rb
303
+ - lib/generators/duodealer_app/account_model/account_model_generator.rb
304
+ - lib/generators/duodealer_app/account_model/templates/account.rb
305
+ - lib/generators/duodealer_app/account_model/templates/account.yml
306
+ - lib/generators/duodealer_app/account_model/templates/db/migrate/create_accounts.erb
361
307
  - lib/generators/duodealer_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb
362
308
  - lib/generators/duodealer_app/add_after_authenticate_job/templates/after_authenticate_job.rb
363
309
  - lib/generators/duodealer_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
@@ -391,10 +337,6 @@ files:
391
337
  - lib/generators/duodealer_app/rotate_duodealer_token_job/templates/rotate_duodealer_token_job.rb
392
338
  - lib/generators/duodealer_app/routes/routes_generator.rb
393
339
  - lib/generators/duodealer_app/routes/templates/routes.rb
394
- - lib/generators/duodealer_app/shop_model/shop_model_generator.rb
395
- - lib/generators/duodealer_app/shop_model/templates/db/migrate/create_shops.erb
396
- - lib/generators/duodealer_app/shop_model/templates/shop.rb
397
- - lib/generators/duodealer_app/shop_model/templates/shops.yml
398
340
  - lib/generators/duodealer_app/user_model/templates/db/migrate/create_users.erb
399
341
  - lib/generators/duodealer_app/user_model/templates/user.rb
400
342
  - lib/generators/duodealer_app/user_model/templates/users.yml
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DuodealerApp
4
- module SessionStorage
5
- module ShopStorageStrategy
6
- def store(auth_session, *args)
7
- shop = find_or_initialize_by(duodealer_domain: auth_session.domain)
8
- shop.duodealer_token = auth_session.token
9
- shop.save!
10
- shop.id
11
- end
12
-
13
- def retrieve(id)
14
- return unless id
15
- if shop = self.find_by(id: id)
16
- DuodealerAPI::Session.new(
17
- domain: shop.duodealer_domain,
18
- token: shop.duodealer_token,
19
- api_version: shop.api_version
20
- )
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,15 +0,0 @@
1
- class CreateShops < ActiveRecord::Migration[<%= rails_migration_version %>]
2
- def self.up
3
- create_table :shops do |t|
4
- t.string :duodealer_domain, null: false
5
- t.string :duodealer_token, null: false
6
- t.timestamps
7
- end
8
-
9
- add_index :shops, :duodealer_domain, unique: true
10
- end
11
-
12
- def self.down
13
- drop_table :shops
14
- end
15
- end