app_manager 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/app_manager/client/connection.rb +20 -0
- data/lib/app_manager/model.rb +1 -1
- data/lib/app_manager/version.rb +1 -1
- data/lib/app_manager.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b130ade59cce66eefb10134bca05802a6f7911e59123a1f8885789547a6c5f
|
4
|
+
data.tar.gz: d3fb70f8010e1d70dc1042c28322d5eeb7696cdecef9bd29fdd09e80a9a02e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fbef0b8ce7194394d942bbf2fd93d1aa52c7b9035be8a98a09ab080c33d047c8e8fe213f66d5cc1396aa326f7d4881d0db47077ffae42a01b1558f8a8c3febc
|
7
|
+
data.tar.gz: e2138c8801189e683ae7db8703dbe2703eedfdedca2a87c0a6f00528bb49bcd28436e457aeb77dca3113993599459b25632e190ee85e95521332d43fe018a4a1
|
data/Gemfile.lock
CHANGED
@@ -24,7 +24,11 @@ module AppManager
|
|
24
24
|
|
25
25
|
def request(http_method, path, options)
|
26
26
|
begin
|
27
|
+
if http_method.to_s == 'get'
|
28
|
+
response = response_from_cache_for_api(http_method, path, options)
|
29
|
+
else
|
27
30
|
response = self.class.send(http_method, path, { body: options, timeout: 10 })
|
31
|
+
end
|
28
32
|
if path.include? "/get-status"
|
29
33
|
data = response
|
30
34
|
elsif path.include? "/sync-charge"
|
@@ -44,6 +48,22 @@ module AppManager
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
51
|
+
def response_from_cache_for_api(http_method, path, options)
|
52
|
+
cache_key = "app-manager-cache/#{path}"
|
53
|
+
if fetch_static_cached_response(cache_key).present?
|
54
|
+
return fetch_static_cached_response(cache_key)
|
55
|
+
end
|
56
|
+
response = self.class.send(http_method, path, { body: options, timeout: 10 })
|
57
|
+
Rails.cache.write(cache_key, response, expires_in: AppManager.configuration.expires_in)
|
58
|
+
return response
|
59
|
+
end
|
60
|
+
|
61
|
+
def fetch_static_cached_response(cache_key)
|
62
|
+
if Rails.cache.read(cache_key).present?
|
63
|
+
return Rails.cache.read(cache_key)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
47
67
|
def parse_data(original_data)
|
48
68
|
return unless original_data
|
49
69
|
if (original_data.class == Hash) && original_data.key?("headers") && original_data.key?("footers") && original_data.key?("modal")
|
data/lib/app_manager/model.rb
CHANGED
@@ -74,7 +74,7 @@ module AppManager
|
|
74
74
|
plan_field = AppManager.configuration.field_names['plan_id']
|
75
75
|
plan_id = self[plan_field]
|
76
76
|
plan_obj = AppManager::Client.new
|
77
|
-
shop_domain ? plan_obj.get_remaining_days(shop_domain,trial_activated_at_val,plan_id) : 0
|
77
|
+
return shop_domain ? plan_obj.get_remaining_days(shop_domain,trial_activated_at_val,plan_id) : 0
|
78
78
|
rescue Exception => e
|
79
79
|
return "#{e.inspect}"
|
80
80
|
end
|
data/lib/app_manager/version.rb
CHANGED
data/lib/app_manager.rb
CHANGED
@@ -27,7 +27,11 @@ module AppManager
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.clear_cache
|
30
|
-
|
30
|
+
begin
|
31
|
+
Rails.cache.delete_matched('app-manager-cache/*')
|
32
|
+
rescue Exception => e
|
33
|
+
Rails.logger.info "APP MANAGER >>>> #{e.inspect}"
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
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.2.
|
4
|
+
version: 1.2.5
|
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-
|
11
|
+
date: 2022-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|