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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d929322090bfd34a68ef7e9049e2d7f5833a7f140da6ea524df5649de2d888d
4
- data.tar.gz: 21a5fb7b13c4bdfd067e2504759be2f9cd8c2a39531afd21ebe279179c0fa516
3
+ metadata.gz: 9b43df1c21cb67c078b9a24c4152573750ffcaf7e13e9748380c642ebe62a7f1
4
+ data.tar.gz: 1d0e8f8dff11ff42024d85999189384408b663b6d196798d415ba6eed1ff606f
5
5
  SHA512:
6
- metadata.gz: d3d52ceb7551a5ace2076f10414b1624d43b69be4024f67eef5a79e043a307ee39e62d78399220ec084f641174f496359f7c6d99c031aed5f1b489251c4422c3
7
- data.tar.gz: 5d3f77fc3febddf0effe43ada6ae02dbc07f9cc7f3073540e1004e49a9d4593fb5c8c00439cf6ffa20ef26f82af8050c886bb3523797b25430a82f2491c92a96
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.2)
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
- 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
@@ -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 {: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
 
@@ -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.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hulkapps