app_manager 1.3.7 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac3a1d17d520c154419fd5917813fda210900f58d12686723bacf05d99ecbd14
4
- data.tar.gz: 0f62d38f1160f30e07eb96007f845395ce397f70d82043f76f71aaf8c564e0e0
3
+ metadata.gz: 323da6aca37d494397aea55d292e70a76b0a7280116fbda06eef42a23359147b
4
+ data.tar.gz: 9e73448ce7fd0d997780dde01638c8d9c342a9408faf58e28fe231d65b577a7b
5
5
  SHA512:
6
- metadata.gz: c6136666c06d579b448ab775a4e9cc6c72f314f0ffc39baccece2d9fe3951a56c1853848d6e83bdfb847037680d2b1e978a4e04b0d440fbc783169a6ecac3e06
7
- data.tar.gz: 730a1f415a8d7a679ade4bb74b60b84ddc109ecfa661dc950c666c8fa8bdef44dd3faf6d14d0979052ae73c58350ff53225e0fe51f96f4f463a19f7c50314e95
6
+ metadata.gz: 12b8049dcef01005dce9b9debba9a0eb1d9921e73d4af6d629fb68fbb028711a26d9942031ed654bb93da656a2674e35d891f6bc6acf5b335db646e2a8698978
7
+ data.tar.gz: 62f134c579d43e5187bc0a8cb3c6dd172e36f8b040f2e2421657b7072ac4c7f0ccff910c333f79097380149db8dc4c15c98bcd309e947e347059314f92905a4b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.3.7)
4
+ app_manager (1.4.0)
5
5
  activerecord-import (~> 1.4)
6
6
  httparty
7
7
  kaminari (>= 0.16.3)
@@ -88,7 +88,7 @@ GEM
88
88
  diff-lcs (1.5.0)
89
89
  digest (3.1.0)
90
90
  dotenv (2.1.2)
91
- erubi (1.10.0)
91
+ erubi (1.11.0)
92
92
  globalid (1.0.0)
93
93
  activesupport (>= 5.0)
94
94
  hashdiff (1.0.1)
@@ -121,7 +121,7 @@ GEM
121
121
  mime-types-data (3.2022.0105)
122
122
  mini_mime (1.1.2)
123
123
  mini_portile2 (2.8.0)
124
- minitest (5.16.2)
124
+ minitest (5.16.3)
125
125
  multi_xml (0.6.0)
126
126
  net-imap (0.2.3)
127
127
  digest
@@ -138,7 +138,7 @@ GEM
138
138
  net-protocol
139
139
  timeout
140
140
  nio4r (2.5.8)
141
- nokogiri (1.13.7)
141
+ nokogiri (1.13.8)
142
142
  mini_portile2 (~> 2.8.0)
143
143
  racc (~> 1.4)
144
144
  pry (0.14.1)
@@ -192,10 +192,10 @@ GEM
192
192
  diff-lcs (>= 1.2.0, < 2.0)
193
193
  rspec-support (~> 3.11.0)
194
194
  rspec-support (3.11.0)
195
- strscan (3.0.3)
195
+ strscan (3.0.4)
196
196
  thor (1.2.1)
197
197
  timeout (0.3.0)
198
- tzinfo (2.0.4)
198
+ tzinfo (2.0.5)
199
199
  concurrent-ruby (~> 1.0)
200
200
  webmock (3.14.0)
201
201
  addressable (>= 2.8.0)
@@ -134,7 +134,13 @@ module AppManager
134
134
  end
135
135
  end
136
136
  end
137
- redirect_to "#{app_url}?shop=#{params[:shop]}", :status => 301 and return
137
+ embed_host = Base64.encode64(params[:shop] + "/admin")
138
+ # redirect_to "/login?host=#{embed_host}&shop=#{shop}" and return
139
+ if app_slug.present?
140
+ redirect_to "https://#{params[:shop]}/admin/apps/#{app_slug}"
141
+ else
142
+ redirect_to "#{app_url}?host=#{embed_host}&shop=#{params[:shop]}", :status => 301 and return
143
+ end
138
144
  else
139
145
  raise Error, "Invalid shopify charge #{charges.insect}"
140
146
  end
@@ -143,7 +149,12 @@ module AppManager
143
149
  end
144
150
  else
145
151
  if params[:shop].present?
146
- redirect_to "#{app_url}?shop=#{params[:shop]}", :status => 301 and return
152
+ embed_host = Base64.encode64(params[:shop] + "/admin")
153
+ if app_slug.present?
154
+ redirect_to "https://#{params[:shop]}/admin/apps/#{app_slug}"
155
+ else
156
+ redirect_to "#{app_url}?host=#{embed_host}&shop=#{params[:shop]}", :status => 301 and return
157
+ end
147
158
  else
148
159
  raise Error, "Invalid params, must have charge_id,shop && plan in charge controller"
149
160
  end
@@ -182,6 +193,10 @@ module AppManager
182
193
  AppManager.configuration.app_url
183
194
  end
184
195
 
196
+ def app_slug
197
+ AppManager.configuration.shopify_app_slug
198
+ end
199
+
185
200
  def config_trial_days
186
201
  @field_names = AppManager.configuration.field_names
187
202
  if !@field_names.nil? && @field_names.has_key?('total_trial_days') && !@field_names['total_trial_days'].nil? && !@field_names['total_trial_days'].blank?
@@ -1,5 +1,5 @@
1
1
  require_dependency "app_manager/application_controller"
2
-
2
+ require 'kaminari'
3
3
  module AppManager
4
4
  class PlansController < ApplicationController
5
5
  cache_response_for :plans
@@ -13,6 +13,7 @@ module AppManager
13
13
  attr_accessor :plan_id_or_name_field
14
14
  attr_accessor :field_names
15
15
  attr_accessor :refresh_by_request_params
16
+ attr_accessor :shopify_app_slug
16
17
 
17
18
  def initialize
18
19
  @refresh_by_request_params = true
@@ -24,6 +25,7 @@ module AppManager
24
25
  @shopify_table_name = 'shops'
25
26
  @shopify_domain_field = 'shopify_domain'
26
27
  @plan_id_or_name_field = nil
28
+ @shopify_app_slug = nil
27
29
  @field_names = {
28
30
  'name' => 'shopify_domain', # sample example: demo-chirag-parmar.myshopify.com
29
31
  'shopify_email' => 'email', # chirag.p@hulkapps.com
@@ -82,5 +84,9 @@ module AppManager
82
84
  @refresh_by_request_params
83
85
  end
84
86
 
87
+ def shopify_app_slug
88
+ @shopify_app_slug
89
+ end
90
+
85
91
  end
86
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.3.7"
4
+ VERSION = "1.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hulkapps
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty