app_manager 1.3.2 → 1.3.3
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 +4 -4
- data/Gemfile.lock +2 -4
- data/lib/app_manager/client/connection.rb +14 -5
- data/lib/app_manager/fail_safe.rb +5 -5
- data/lib/app_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b43df1c21cb67c078b9a24c4152573750ffcaf7e13e9748380c642ebe62a7f1
|
4
|
+
data.tar.gz: 1d0e8f8dff11ff42024d85999189384408b663b6d196798d415ba6eed1ff606f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15cb229b021268ad6a36ac708cdb50a5305db6e654ec34317b0685c91cbde3515789ab84d57f13118313b7355be7d1084c43b2ae60dbc84098d5e72f04d47ae3
|
7
|
+
data.tar.gz: 126d03e0ce67248128236fde8cbd4c98d246f012358965b5b8fd000df7bb396e5e75125b42e3d0552b7cd8177e49ffdd0cd73d931af769a6606400953b657afc
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
app_manager (1.3.
|
4
|
+
app_manager (1.3.3)
|
5
5
|
httparty
|
6
6
|
kaminari (>= 0.16.3)
|
7
7
|
rails (>= 5.2.0)
|
@@ -117,7 +117,6 @@ GEM
|
|
117
117
|
mime-types-data (~> 3.2015)
|
118
118
|
mime-types-data (3.2022.0105)
|
119
119
|
mini_mime (1.1.2)
|
120
|
-
mini_portile2 (2.8.0)
|
121
120
|
minitest (5.16.2)
|
122
121
|
multi_xml (0.6.0)
|
123
122
|
net-imap (0.2.3)
|
@@ -135,8 +134,7 @@ GEM
|
|
135
134
|
net-protocol
|
136
135
|
timeout
|
137
136
|
nio4r (2.5.8)
|
138
|
-
nokogiri (1.13.6)
|
139
|
-
mini_portile2 (~> 2.8.0)
|
137
|
+
nokogiri (1.13.6-x86_64-linux)
|
140
138
|
racc (~> 1.4)
|
141
139
|
pry (0.14.1)
|
142
140
|
coderay (~> 1.1)
|
@@ -23,8 +23,10 @@ module AppManager
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def request(http_method, path, options)
|
26
|
-
|
26
|
+
failsafe_or_caching_done = false
|
27
|
+
if http_method.to_s == 'get' && !path.include?("/get-status") && !path.include?("/sync-charge")
|
27
28
|
response = response_from_cache_for_api(http_method, path, options)
|
29
|
+
failsafe_or_caching_done = true
|
28
30
|
else
|
29
31
|
response = self.class.send(http_method, path, { body: options, timeout: 10 })
|
30
32
|
end
|
@@ -34,12 +36,19 @@ module AppManager
|
|
34
36
|
data = response.parsed_response
|
35
37
|
data = parse_data(response.parsed_response)
|
36
38
|
else
|
37
|
-
if response.class.to_s == "HTTParty::Response" && (response.code.to_s.start_with?('2') or response.code.to_s.start_with?('4'))
|
39
|
+
if response.class.to_s == "HTTParty::Response" && (response.code.to_s.start_with?('2') or response.code.to_s.start_with?('4')) && (response.code.to_s != '429')
|
38
40
|
data = response.parsed_response
|
39
41
|
data = parse_data(response.parsed_response)
|
40
|
-
# data = response_from_failsafe(path,options)
|
42
|
+
# data = response_from_failsafe(path,options) #uncomment to test failsafe
|
43
|
+
return data
|
41
44
|
else
|
42
|
-
|
45
|
+
if failsafe_or_caching_done == true
|
46
|
+
data = response
|
47
|
+
return data
|
48
|
+
else
|
49
|
+
data = response_from_failsafe(path,options)
|
50
|
+
return data
|
51
|
+
end
|
43
52
|
end
|
44
53
|
end
|
45
54
|
end
|
@@ -50,7 +59,7 @@ module AppManager
|
|
50
59
|
return fetch_static_cached_response(cache_key)
|
51
60
|
end
|
52
61
|
response = self.class.send(http_method, path, { body: options, timeout: 10 })
|
53
|
-
if response.code.to_s.start_with?('2') or response.code.to_s.start_with?('4')
|
62
|
+
if response.class.to_s == "HTTParty::Response" && (response.code.to_s.start_with?('2') or response.code.to_s.start_with?('4')) && (response.code.to_s != '429')
|
54
63
|
Rails.cache.write(cache_key, response, expires_in: AppManager.configuration.expires_in)
|
55
64
|
else
|
56
65
|
response = response_from_failsafe(path,options)
|
@@ -399,22 +399,22 @@ module AppManager
|
|
399
399
|
|
400
400
|
def get_local_has_plan(params, options)
|
401
401
|
if params["grandfathered"].present? && params["grandfathered"] == 1
|
402
|
-
return {
|
402
|
+
return {"has_plan" => true}
|
403
403
|
end
|
404
404
|
plans = AppManager::Plan.where(id: params["plan_id"])
|
405
405
|
if plans.any? && plans.first.price == 0
|
406
|
-
return {
|
406
|
+
return {"has_plan" => true}
|
407
407
|
end
|
408
408
|
@remaining_days = get_local_remaining_days(params, options)
|
409
409
|
if (@remaining_days && @remaining_days > 0)
|
410
|
-
return {
|
410
|
+
return {"has_plan" => true}
|
411
411
|
end
|
412
412
|
active_charge = AppManager::Charge.where(status: 'active', shop_domain: params["shop_domain"])
|
413
413
|
if active_charge.any?
|
414
|
-
return {
|
414
|
+
return {"has_plan" => true}
|
415
415
|
end
|
416
416
|
|
417
|
-
return {
|
417
|
+
return {"has_plan" => false}
|
418
418
|
|
419
419
|
end
|
420
420
|
|
data/lib/app_manager/version.rb
CHANGED