app_manager 1.1.5 → 1.1.8

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: 49314ece09cae0fc0ff0215616397c7d3a46fd9ff962b7b2c67c2a4894170ab9
4
- data.tar.gz: eab49d56c31b7b21a8c545b2179d2f1dc1369ca90dbb422b36f911073740d233
3
+ metadata.gz: 49b23403c65f2eb57f2d3a3a54d1c966e3810773aea9822c8625f3026fec93b9
4
+ data.tar.gz: 3625d02deadd46fbc14f27227cc49d0ffb774fa285d971df90a4d91dcef06255
5
5
  SHA512:
6
- metadata.gz: b3984d372c6fb85033b6a2945718424866ac36e92fa5c7de542b703bf4e5bcadc969b1a456e4f68f17cde123c310f18de57e512a8817f568a7f6e30f44efc522
7
- data.tar.gz: 4b8210b8595f1efc87bb78910556a78f43f065c35019fc07c330b52c7e2dedd63ba901812bd758156191078d8b5be7e76a83fe07fecfcbe5eb82d789a16e22bc
6
+ metadata.gz: 2e755621b1a8dea6d0f24a8135bd562cad9451ca1917a5c011be9e30654529f3dd55f8b9dc60908d7460b2ab8f6ca90823ec779726b277f1e35e45eec711621c
7
+ data.tar.gz: 45f80655e7125a4b00740be0b286867edc755101bdb2d3c6fe5a52ed70ae7f798f56a87b371783be6b3b4cda678917165cf49ffe16fe2aa0ed6cc437b22ff7fb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.1.5)
4
+ app_manager (1.1.8)
5
5
  httparty
6
6
  kaminari (>= 0.16.3)
7
7
  rails (>= 5.2.0)
data/README.md CHANGED
@@ -109,8 +109,9 @@ AppManager.configure do |config|
109
109
  "description" => "Feature Description",
110
110
  "value_type" => "array",
111
111
  "values" => [
112
- "val 1",
113
- "val 2"
112
+ "val-1" => "val 1",
113
+ "val-2" => "val 2",
114
+ "val-3" => "val 3",
114
115
  ],
115
116
  "format" => "string",
116
117
  "display_order" => 4,
@@ -118,7 +119,7 @@ AppManager.configure do |config|
118
119
  "group_order" => "1",
119
120
  "group" => "Group Name",
120
121
  }
121
- ]
122
+ ]
122
123
  end
123
124
  #Required, Values type : integer, boolean, string, array #
124
125
  #Format: percentage, count, string
@@ -18,19 +18,19 @@ module AppManager
18
18
  plan_obj = AppManager::Client.new
19
19
  plans = []
20
20
  if params[:shop_domain].present? && !AppManager.configuration.plan_features.nil?
21
- plans = plan_obj.get_plans(params[:shop_domain])
22
21
  @shop = shop_data
23
22
  if !@shop.nil?
24
- active_plan_id_or_name = @shop[@plan_field]
23
+ active_plan_id_or_name = @shop[@plan_field] rescue nil
24
+ plans = plan_obj.get_plans(params[:shop_domain],active_plan_id_or_name)
25
25
  if !@field_names.nil? && @field_names.has_key?('shopify_plan') && !@field_names.nil?
26
26
  shopify_plan_field = AppManager.configuration.field_names['shopify_plan']
27
27
  shopify_plan = @shop[shopify_plan_field] rescue nil
28
- plan = plans.any? && !active_plan_id_or_name.nil? ? (plans.find{|x| x["id"] == active_plan_id_or_name}.present? ? plans.find{|x| x["id"] == active_plan_id_or_name} : nil ) : nil
28
+ plan = plans && plans.any? && !active_plan_id_or_name.nil? ? (plans.find{|x| x["id"] == active_plan_id_or_name}.present? ? plans.find{|x| x["id"] == active_plan_id_or_name} : nil ) : nil
29
29
 
30
30
  @trial_activated_field = AppManager.configuration.field_names['trial_activated_at']
31
31
  trial_activated_at = @shop[@trial_activated_field] rescue nil
32
32
  active_charge = plan_obj.get_charge(params[:shop_domain])
33
- if active_charge.any? && active_charge['active_charge'].nil? && active_charge['cancelled_charge'].nil? && trial_activated_at
33
+ if active_charge && active_charge.any? && active_charge['active_charge'].nil? && active_charge['cancelled_charge'].nil? && trial_activated_at
34
34
  choose_later = true
35
35
  end
36
36
 
@@ -43,6 +43,7 @@ module AppManager
43
43
  end
44
44
 
45
45
 
46
+ plans = plan_obj.get_plans(params[:shop_domain]) if plans && plans.blank?
46
47
  default_plan_data = plans.select{|x| x['choose_later_plan'] == true }
47
48
  if default_plan_data.any?
48
49
  if default_plan_data.select{|x| x['store_base_plan'] == true }.size > 0
@@ -2,8 +2,8 @@ module AppManager
2
2
  class Client
3
3
  module Plans
4
4
 
5
- def get_plans(shop_domain)
6
- get("/plans?shop_domain=#{shop_domain}")
5
+ def get_plans(shop_domain,active_plan_id=nil)
6
+ get("/plans?shop_domain=#{shop_domain}&active_plan_id=#{active_plan_id}")
7
7
  end
8
8
 
9
9
  def get_plan(plan_id,shop_domain=nil)
@@ -1,12 +1,19 @@
1
1
  require 'json'
2
2
  require 'date'
3
3
  require 'time'
4
+ require "fileutils"
5
+
4
6
  module AppManager
5
7
 
6
8
  class FailSafe
7
9
 
8
10
  def initialize(db_name='app_manager_local')
9
11
  @apm_db = SQLite3::Database.open "db/#{db_name}.db"
12
+ begin
13
+ FileUtils.chmod 0777, "db/#{db_name}.db"
14
+ rescue Exception => e
15
+ puts ">>>>>> #{e.inspect}"
16
+ end
10
17
  @apm_db.results_as_hash = true
11
18
  create_plan_table
12
19
  create_charges_table
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.1.5"
4
+ VERSION = "1.1.8"
5
5
  end
@@ -61,8 +61,9 @@ AppManager.configure do |config|
61
61
  "description" => "Feature Description",
62
62
  "value_type" => "array",
63
63
  "values" => [
64
- "val 1",
65
- "val 2"
64
+ "val-1" => "val 1",
65
+ "val-2" => "val 2",
66
+ "val-3" => "val 3",
66
67
  ],
67
68
  "format" => "string",
68
69
  "display_order" => 4,
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.1.5
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hulkapps
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-29 00:00:00.000000000 Z
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty