app_manager 1.3.2 → 1.3.5

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: 4d929322090bfd34a68ef7e9049e2d7f5833a7f140da6ea524df5649de2d888d
4
- data.tar.gz: 21a5fb7b13c4bdfd067e2504759be2f9cd8c2a39531afd21ebe279179c0fa516
3
+ metadata.gz: 19143ee5bb30c0d6f1dce901a195eb9fe021ee4755dd752e45ee364f6146687d
4
+ data.tar.gz: 99eecbe9df8a0263077579c308c8b1838c6bbbceec699ea7289dd806d0ce469d
5
5
  SHA512:
6
- metadata.gz: d3d52ceb7551a5ace2076f10414b1624d43b69be4024f67eef5a79e043a307ee39e62d78399220ec084f641174f496359f7c6d99c031aed5f1b489251c4422c3
7
- data.tar.gz: 5d3f77fc3febddf0effe43ada6ae02dbc07f9cc7f3073540e1004e49a9d4593fb5c8c00439cf6ffa20ef26f82af8050c886bb3523797b25430a82f2491c92a96
6
+ metadata.gz: 8c264bf7f5b5d4d1f207a1d79dfcf398a624d077f2a4543cdbfacb7e06b39f26420c92aa8d654392a39a7db22c144b1810000533390531840b43150b526de3eb
7
+ data.tar.gz: 044cf45961370e69beb87a761e74d7bb1a25e4674931195c2d0e49d786bfcb16aee1878a9e25e76bb0af1e3ece9034a24c7728ceabde5a991364560162d8c996
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.3.2)
4
+ app_manager (1.3.5)
5
5
  httparty
6
6
  kaminari (>= 0.16.3)
7
7
  rails (>= 5.2.0)
@@ -9,67 +9,67 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (7.0.3)
13
- actionpack (= 7.0.3)
14
- activesupport (= 7.0.3)
12
+ actioncable (7.0.3.1)
13
+ actionpack (= 7.0.3.1)
14
+ activesupport (= 7.0.3.1)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (7.0.3)
18
- actionpack (= 7.0.3)
19
- activejob (= 7.0.3)
20
- activerecord (= 7.0.3)
21
- activestorage (= 7.0.3)
22
- activesupport (= 7.0.3)
17
+ actionmailbox (7.0.3.1)
18
+ actionpack (= 7.0.3.1)
19
+ activejob (= 7.0.3.1)
20
+ activerecord (= 7.0.3.1)
21
+ activestorage (= 7.0.3.1)
22
+ activesupport (= 7.0.3.1)
23
23
  mail (>= 2.7.1)
24
24
  net-imap
25
25
  net-pop
26
26
  net-smtp
27
- actionmailer (7.0.3)
28
- actionpack (= 7.0.3)
29
- actionview (= 7.0.3)
30
- activejob (= 7.0.3)
31
- activesupport (= 7.0.3)
27
+ actionmailer (7.0.3.1)
28
+ actionpack (= 7.0.3.1)
29
+ actionview (= 7.0.3.1)
30
+ activejob (= 7.0.3.1)
31
+ activesupport (= 7.0.3.1)
32
32
  mail (~> 2.5, >= 2.5.4)
33
33
  net-imap
34
34
  net-pop
35
35
  net-smtp
36
36
  rails-dom-testing (~> 2.0)
37
- actionpack (7.0.3)
38
- actionview (= 7.0.3)
39
- activesupport (= 7.0.3)
37
+ actionpack (7.0.3.1)
38
+ actionview (= 7.0.3.1)
39
+ activesupport (= 7.0.3.1)
40
40
  rack (~> 2.0, >= 2.2.0)
41
41
  rack-test (>= 0.6.3)
42
42
  rails-dom-testing (~> 2.0)
43
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
44
- actiontext (7.0.3)
45
- actionpack (= 7.0.3)
46
- activerecord (= 7.0.3)
47
- activestorage (= 7.0.3)
48
- activesupport (= 7.0.3)
44
+ actiontext (7.0.3.1)
45
+ actionpack (= 7.0.3.1)
46
+ activerecord (= 7.0.3.1)
47
+ activestorage (= 7.0.3.1)
48
+ activesupport (= 7.0.3.1)
49
49
  globalid (>= 0.6.0)
50
50
  nokogiri (>= 1.8.5)
51
- actionview (7.0.3)
52
- activesupport (= 7.0.3)
51
+ actionview (7.0.3.1)
52
+ activesupport (= 7.0.3.1)
53
53
  builder (~> 3.1)
54
54
  erubi (~> 1.4)
55
55
  rails-dom-testing (~> 2.0)
56
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
- activejob (7.0.3)
58
- activesupport (= 7.0.3)
57
+ activejob (7.0.3.1)
58
+ activesupport (= 7.0.3.1)
59
59
  globalid (>= 0.3.6)
60
- activemodel (7.0.3)
61
- activesupport (= 7.0.3)
62
- activerecord (7.0.3)
63
- activemodel (= 7.0.3)
64
- activesupport (= 7.0.3)
65
- activestorage (7.0.3)
66
- actionpack (= 7.0.3)
67
- activejob (= 7.0.3)
68
- activerecord (= 7.0.3)
69
- activesupport (= 7.0.3)
60
+ activemodel (7.0.3.1)
61
+ activesupport (= 7.0.3.1)
62
+ activerecord (7.0.3.1)
63
+ activemodel (= 7.0.3.1)
64
+ activesupport (= 7.0.3.1)
65
+ activestorage (7.0.3.1)
66
+ actionpack (= 7.0.3.1)
67
+ activejob (= 7.0.3.1)
68
+ activerecord (= 7.0.3.1)
69
+ activesupport (= 7.0.3.1)
70
70
  marcel (~> 1.0)
71
71
  mini_mime (>= 1.1.0)
72
- activesupport (7.0.3)
72
+ activesupport (7.0.3.1)
73
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
74
74
  i18n (>= 1.6, < 2)
75
75
  minitest (>= 5.1)
@@ -135,7 +135,7 @@ GEM
135
135
  net-protocol
136
136
  timeout
137
137
  nio4r (2.5.8)
138
- nokogiri (1.13.6)
138
+ nokogiri (1.13.7)
139
139
  mini_portile2 (~> 2.8.0)
140
140
  racc (~> 1.4)
141
141
  pry (0.14.1)
@@ -146,28 +146,28 @@ GEM
146
146
  rack (2.2.4)
147
147
  rack-test (2.0.2)
148
148
  rack (>= 1.3)
149
- rails (7.0.3)
150
- actioncable (= 7.0.3)
151
- actionmailbox (= 7.0.3)
152
- actionmailer (= 7.0.3)
153
- actionpack (= 7.0.3)
154
- actiontext (= 7.0.3)
155
- actionview (= 7.0.3)
156
- activejob (= 7.0.3)
157
- activemodel (= 7.0.3)
158
- activerecord (= 7.0.3)
159
- activestorage (= 7.0.3)
160
- activesupport (= 7.0.3)
149
+ rails (7.0.3.1)
150
+ actioncable (= 7.0.3.1)
151
+ actionmailbox (= 7.0.3.1)
152
+ actionmailer (= 7.0.3.1)
153
+ actionpack (= 7.0.3.1)
154
+ actiontext (= 7.0.3.1)
155
+ actionview (= 7.0.3.1)
156
+ activejob (= 7.0.3.1)
157
+ activemodel (= 7.0.3.1)
158
+ activerecord (= 7.0.3.1)
159
+ activestorage (= 7.0.3.1)
160
+ activesupport (= 7.0.3.1)
161
161
  bundler (>= 1.15.0)
162
- railties (= 7.0.3)
162
+ railties (= 7.0.3.1)
163
163
  rails-dom-testing (2.0.3)
164
164
  activesupport (>= 4.2.0)
165
165
  nokogiri (>= 1.6)
166
166
  rails-html-sanitizer (1.4.3)
167
167
  loofah (~> 2.3)
168
- railties (7.0.3)
169
- actionpack (= 7.0.3)
170
- activesupport (= 7.0.3)
168
+ railties (7.0.3.1)
169
+ actionpack (= 7.0.3.1)
170
+ activesupport (= 7.0.3.1)
171
171
  method_source
172
172
  rake (>= 12.2)
173
173
  thor (~> 1.0)
@@ -161,7 +161,7 @@ module AppManager
161
161
  Thread.new do
162
162
  @fs = AppManager::FailSafe.new
163
163
  begin
164
- @fs.sync_app_manager
164
+ @fs.sync_app_manager
165
165
  rescue Exception => e
166
166
  Rails.logger.info "APP MANAGER >>>> LOCAL DB couldn't sync with POTAL DB #{e.inspect}"
167
167
  end
@@ -23,8 +23,10 @@ module AppManager
23
23
  private
24
24
 
25
25
  def request(http_method, path, options)
26
- if http_method.to_s == 'get'
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
- data = response_from_failsafe(path,options)
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
@@ -49,12 +58,16 @@ module AppManager
49
58
  if fetch_static_cached_response(cache_key).present?
50
59
  return fetch_static_cached_response(cache_key)
51
60
  end
61
+ begin
52
62
  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')
63
+ 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
64
  Rails.cache.write(cache_key, response, expires_in: AppManager.configuration.expires_in)
55
65
  else
56
66
  response = response_from_failsafe(path,options)
57
67
  end
68
+ rescue Net::ReadTimeout => error
69
+ response = response_from_failsafe(path,options)
70
+ end
58
71
  return response
59
72
  end
60
73
 
@@ -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 {:has_plan => true}
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 {:has_plan => true}
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 {:has_plan => true}
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 {:has_plan => true}
414
+ return {"has_plan" => true}
415
415
  end
416
416
 
417
- return {:has_plan => false}
417
+ return {"has_plan" => false}
418
418
 
419
419
  end
420
420
 
@@ -98,7 +98,6 @@ module AppManager
98
98
  if shop_plan_id && !shop_plan_id.nil?
99
99
  req_plan_id = shop_plan_id
100
100
  else
101
- Rollbar.error("Invalid params, must have charge_id,shop && plan")
102
101
  return {}
103
102
  end
104
103
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.3.2"
4
+ VERSION = "1.3.5"
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.2
4
+ version: 1.3.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-12 00:00:00.000000000 Z
11
+ date: 2022-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty