app_manager 1.3.1 → 1.3.4

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: 6727df8a0c9cc4df0425d8b62c206f3b9076bedb62d5ede29266ba9d43ef5df9
4
- data.tar.gz: ace50d6916ff9f6c14c0ab9388fb194bada931f19b613ad664a68c1d20f06089
3
+ metadata.gz: 73c07b966d8cbce529a652bd4765b5f4107280a9438868e4b5d898631d8d8c38
4
+ data.tar.gz: a7fe2691818b06e7f43feb481046f3c6ff4bd3e4c744b737f2c6ca81abf80a56
5
5
  SHA512:
6
- metadata.gz: fd7e2afad41cedc53566ef723d5451a4435a0b15d2cb6726252819021fce43e869c50fcd27349df0987f395aa59b24e37a72335dd02f188ad3d13f5e439e8d70
7
- data.tar.gz: 926eb7293fd9e2c0bdbc2b61737cb9cd74a4e17291aed9dac2f0fd537f518b91be5ebd5b36162f71d212a5953eed1546b3f039713abda16a1c6d4387c3a4f6ae
6
+ metadata.gz: 335f46ddc9d884bd9edf6b3361d8e4c2c0fda5f4ed8ece90a18eec729b00bdc5fed894700dee1a423678a259af025ff9013fb21fc7e016d8f0a07e1f34c84a0c
7
+ data.tar.gz: 4624f11210812f05fb6f421b8ceb624a31b64aabde7a757bafceca97cd21705f17eb3b2851d49139526940f37f999abeed5497cab88b705de47e2a936d130229
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.3.1)
4
+ app_manager (1.3.4)
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)
@@ -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.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,8 +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
- Rails.cache.write(cache_key, response, expires_in: AppManager.configuration.expires_in)
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')
64
+ Rails.cache.write(cache_key, response, expires_in: AppManager.configuration.expires_in)
65
+ else
66
+ response = response_from_failsafe(path,options)
67
+ end
68
+ rescue Net::ReadTimeout => error
69
+ response = response_from_failsafe(path,options)
70
+ end
54
71
  return response
55
72
  end
56
73
 
@@ -399,23 +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
- puts @remaining_days.inspect
410
409
  if (@remaining_days && @remaining_days > 0)
411
- return {:has_plan => true}
410
+ return {"has_plan" => true}
412
411
  end
413
412
  active_charge = AppManager::Charge.where(status: 'active', shop_domain: params["shop_domain"])
414
413
  if active_charge.any?
415
- return {:has_plan => true}
414
+ return {"has_plan" => true}
416
415
  end
417
416
 
418
- return {:has_plan => false}
417
+ return {"has_plan" => false}
419
418
 
420
419
  end
421
420
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.3.1"
4
+ VERSION = "1.3.4"
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.1
4
+ version: 1.3.4
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