zuora_connect 2.0.57i → 2.0.57j

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: 26183625c5cf9400d02272bc113e94110febd7598539087c3aff5bb562126db5
4
- data.tar.gz: f583a9edecc57531b94c62d863102404a39451a8534f28cc3a83c7dd628603f3
3
+ metadata.gz: 20a3be40ccdd0ae006685145eb4d5500389fc6cf220402bfb93072cffb911a41
4
+ data.tar.gz: 9821553b9795ea6ac6d73cebabb38d881c72dc6f845af86aa5e704def9e36b55
5
5
  SHA512:
6
- metadata.gz: e587ff354e885635146086c916359515dfa614448761afc07dd0a3a51114e18a55c660860f06c1bf9d07a82041d11ad72536831c83ab474194acd99a0f575066
7
- data.tar.gz: fb57d8e05cc977a11f0c877ae887d764ef8ea9572c23841ccc782da228aab9aefde7b3a895d8334b63505edd3f5bc426a2b202908567583ba855d188396b175f
6
+ metadata.gz: 65c1c86d4dc83c3de5c9791dd2f1b688015c300111b2521f0c3f7bc4f52b4115c3bf13c9a5ff477c90734171f204df6b24966524d78d0a11aa8a21036ecf253a
7
+ data.tar.gz: a9675847a52ef1b26027a57f87a680a87755175ecf48ce929ae9cc7a4e740f7d090ff88dd07364f69e9ea8173a3cb0db58c1188b79cefbce6a41833711c9853c
@@ -20,7 +20,7 @@ module ZuoraConnect
20
20
  BLANK_OBJECT_ID_LOOKUP = 'BlankValueSupplied'
21
21
  HOLDING_PATTERN_SLEEP = 5.seconds
22
22
  CONNECT_APPLICATION_ID = 0
23
- CONNECT_COMMUNICATION_SLEEP= 5.seconds
23
+ CONNECT_COMMUNICATION_SLEEP = Rails.env.test? ? 0.seconds : 5.seconds
24
24
  IGNORED_LOCALS = ['fr', 'ja', 'es', 'zh', 'de']
25
25
  INTERNAL_HOSTS = []
26
26
  LOGIN_TENANT_DESTINATION = 'target_login'
@@ -225,7 +225,7 @@ module ZuoraConnect
225
225
  raise
226
226
  rescue => ex
227
227
  if recoverable_session
228
- ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache", ex)
228
+ ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache", ex, self.default_ougai_items)
229
229
  self.build_task(task_data: session["#{self.id}::task_data"], session: session)
230
230
  return self
231
231
  else
@@ -277,11 +277,8 @@ module ZuoraConnect
277
277
  #Check how app was deployed
278
278
  if self.id < 25000000 && !skip_connect
279
279
  self.check_oauth_state
280
- start = Time.now
281
280
  response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
282
- response_time = Time.now - start
283
281
 
284
- ZuoraConnect.logger.debug("REFRESH TASK - Connect Task Info Request Time #{response_time.round(2).to_s}")
285
282
  if response.code == 200
286
283
  begin
287
284
  parsed_json = JSON.parse(response.body)
@@ -313,7 +310,7 @@ module ZuoraConnect
313
310
  refresh_count += 1
314
311
  if refresh_count < 3
315
312
  sleep(10)
316
- ZuoraConnect.logger.debug("REFRESH TASK - Connection Failure Retrying(#{refresh_count})", ex)
313
+ ZuoraConnect.logger.debug("REFRESH TASK - Connection Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
317
314
  retry
318
315
  else
319
316
  ZuoraConnect.logger.fatal("REFRESH TASK - Connection Failed", ex)
@@ -322,17 +319,17 @@ module ZuoraConnect
322
319
  rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
323
320
  refresh_count += 1
324
321
  if refresh_count < 3
325
- ZuoraConnect.logger.debug("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", ex)
322
+ ZuoraConnect.logger.debug("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
326
323
  self.refresh_oauth if ex.code == 401
327
324
  retry
328
325
  else
329
- ZuoraConnect.logger.fatal("REFRESH TASK - Communication Failed #{ex.code}", ex)
326
+ ZuoraConnect.logger.fatal("REFRESH TASK - Communication Failed #{ex.code}", ex, self.default_ougai_items)
330
327
  raise
331
328
  end
332
329
  end
333
330
  rescue => ex
334
331
  if self['zuora_logins'].present?
335
- ZuoraConnect.logger.warn("REFRESH TASK - Fallback to local encrypted store", ex)
332
+ ZuoraConnect.logger.warn("REFRESH TASK - Fallback to local encrypted store", ex, self.default_ougai_items)
336
333
  skip_connect = true
337
334
  retry
338
335
  end
@@ -654,16 +651,12 @@ module ZuoraConnect
654
651
  end
655
652
 
656
653
  def refresh_oauth
657
- refresh_oauth_count ||= 0
658
- start = Time.now
659
- params = {
660
- :grant_type => "refresh_token",
661
- :redirect_uri => ZuoraConnect.configuration.oauth_client_redirect_uri,
662
- :refresh_token => self.refresh_token
663
- }
664
- response = HTTParty.post("#{ZuoraConnect.configuration.url}/oauth/token",:body => params)
665
- response_time = Time.now - start
666
- ZuoraConnect.logger.debug("REFRESH OAUTH - In #{response_time.round(2).to_s}")
654
+ refresh_oauth_count ||= 0
655
+ response = HTTParty.post("#{ZuoraConnect.configuration.url}/oauth/token", body: {
656
+ :grant_type => "refresh_token",
657
+ :redirect_uri => ZuoraConnect.configuration.oauth_client_redirect_uri,
658
+ :refresh_token => self.refresh_token
659
+ })
667
660
 
668
661
  if response.code == 200
669
662
  response_body = JSON.parse(response.body)
@@ -677,11 +670,11 @@ module ZuoraConnect
677
670
  end
678
671
  rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
679
672
  if (refresh_oauth_count += 1) < 3
680
- sleep(5)
681
- ZuoraConnect.logger.debug("REFRESH OAUTH - Connection Failure Retrying(#{refresh_oauth_count})", ex)
673
+ sleep(CONNECT_COMMUNICATION_SLEEP)
674
+ ZuoraConnect.logger.debug("REFRESH OAUTH - Connection Failure Retrying(#{refresh_oauth_count})", ex, self.default_ougai_items)
682
675
  retry
683
676
  else
684
- ZuoraConnect.logger.fatal("REFRESH OAUTH - Connection Failed", ex)
677
+ Rails.logger.fatal("REFRESH OAUTH - Connection Failed", ex, self.default_ougai_items)
685
678
  raise
686
679
  end
687
680
  rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
@@ -692,10 +685,10 @@ module ZuoraConnect
692
685
  return if !self.oauth_expired?
693
686
 
694
687
  if (refresh_oauth_count += 1) < 3
695
- ZuoraConnect.logger.debug("REFRESH OAUTH - Communication Failure Retrying(#{refresh_oauth_count})", ex)
688
+ ZuoraConnect.logger.debug("REFRESH OAUTH - Communication Failure Retrying(#{refresh_oauth_count})", ex, self.default_ougai_items)
696
689
  retry
697
690
  else
698
- ZuoraConnect.logger.fatal("REFRESH OAUTH - Communication Failed #{ex.code}", ex)
691
+ ZuoraConnect.logger.fatal("REFRESH OAUTH - Communication Failed #{ex.code}", ex, self.default_ougai_items)
699
692
  raise
700
693
  end
701
694
  end
@@ -745,10 +738,10 @@ module ZuoraConnect
745
738
  end
746
739
  end
747
740
  if cached_instance.blank?
748
- ZuoraConnect.logger.debug("Cached AppInstance Missing")
741
+ ZuoraConnect.logger.debug("Cached AppInstance Missing", self.default_ougai_items)
749
742
  return session
750
743
  else
751
- ZuoraConnect.logger.debug("Cached AppInstance Found")
744
+ ZuoraConnect.logger.debug("Cached AppInstance Found", self.default_ougai_items)
752
745
  return decrypt_data(data: cached_instance, rescue_return: session).merge(session)
753
746
  end
754
747
  else
@@ -764,7 +757,7 @@ module ZuoraConnect
764
757
  if defined?(Redis.current)
765
758
  #Task data must be present and the last refresh cannot be old. We dont want to overwite new cache data with old
766
759
  if self.task_data.present? && (self.last_refresh.to_i > INSTANCE_REFRESH_WINDOW.ago.to_i)
767
- ZuoraConnect.logger.debug("Caching AppInstance")
760
+ ZuoraConnect.logger.debug("Caching AppInstance", self.default_ougai_items)
768
761
  Redis.current.setex("AppInstance:#{self.id}", INSTANCE_REDIS_CACHE_PERIOD.to_i, self.encrypt_data(data: self.save_data))
769
762
  end
770
763
  end
@@ -828,10 +821,10 @@ module ZuoraConnect
828
821
  begin
829
822
  return JSON.parse(encryptor.decrypt_and_verify(CGI::unescape(data)))
830
823
  rescue ActiveSupport::MessageVerifier::InvalidSignature => ex
831
- ZuoraConnect.logger.error("Error Decrypting", ex) if log_fatal
824
+ ZuoraConnect.logger.error("Error Decrypting", ex, self.default_ougai_items) if log_fatal
832
825
  return rescue_return
833
826
  rescue JSON::ParserError => ex
834
- ZuoraConnect.logger.error("JSON Parse Error", ex) if log_fatal
827
+ ZuoraConnect.logger.error("JSON Parse Error", ex, self.default_ougai_items) if log_fatal
835
828
  return encryptor.decrypt_and_verify(CGI::unescape(data))
836
829
  end
837
830
  end
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "2.0.57i"
2
+ VERSION = "2.0.57j"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.57i
4
+ version: 2.0.57j
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-07 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment