zuora_connect 3.1.0.pre.c → 3.1.0.pre.d
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a5ca7980f0c3e5418bbd8b34d277421c00bbe709870ca1f17088c16e65a7454
|
4
|
+
data.tar.gz: 5465170884c82258888725799568a8d43e70ddceb968652c284335397023875f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 623b63683caba7ac18d08da2fba2b9d5db96eb24b9d0e0b833b85d4d707a2f2c34f1dc687248b9e034271cae4a4f402e0a78ce227cecfbbf9e467de07189771f
|
7
|
+
data.tar.gz: 2f27d2fe72ad6abe199a49b8872c6ed1e581257d62a62576452331e215f46f48ec17a88c13d75491573c27a71d151d3c1b0bb2f9258d3e1cd458213ed3f5b1b4
|
@@ -43,7 +43,12 @@ module ZuoraConnect
|
|
43
43
|
|
44
44
|
def cache_bust
|
45
45
|
if defined?(Redis.current)
|
46
|
+
@appinstance.fetch_connect_data #Fetch data and set in database if kms key is used
|
47
|
+
@appinstance.cache_app_instance(force_cache: true) #Update cache in redis
|
46
48
|
Redis.current.del("AppInstance:#{@appinstance.id}")
|
49
|
+
@appinstance.cache_app_instance(force_cache: true) #Update cache in redis
|
50
|
+
#TODO: Could be a chance another thread cache back to old value, but will eventually cache will get consitent, move to nolonger needing redis cache
|
51
|
+
|
47
52
|
respond_to do |format|
|
48
53
|
format.json {render json: {}, status: :ok}
|
49
54
|
end
|
@@ -351,28 +351,33 @@ module ZuoraConnect
|
|
351
351
|
self.id >= 25000000
|
352
352
|
end
|
353
353
|
|
354
|
+
def fetch_connect_data
|
355
|
+
self.check_oauth_state
|
356
|
+
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
|
357
|
+
|
358
|
+
if response.code == 200
|
359
|
+
begin
|
360
|
+
parsed_json = JSON.parse(response.body)
|
361
|
+
rescue JSON::ParserError => ex
|
362
|
+
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("JSON parse error", response.body, response.code)
|
363
|
+
end
|
364
|
+
|
365
|
+
self.build_task(task_data: parsed_json, session: session)
|
366
|
+
self.set_backup_creds
|
367
|
+
self.save(validate: false) if self.changed?
|
368
|
+
else
|
369
|
+
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
|
354
374
|
def refresh(session: {})
|
355
375
|
refresh_count ||= 0
|
356
376
|
skip_connect ||= ZuoraConnect.configuration.skip_connect
|
357
377
|
begin
|
358
378
|
#Check how app was deployed
|
359
|
-
if !self.auto_deployed? && !skip_connect
|
360
|
-
self.
|
361
|
-
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
|
362
|
-
|
363
|
-
if response.code == 200
|
364
|
-
begin
|
365
|
-
parsed_json = JSON.parse(response.body)
|
366
|
-
rescue JSON::ParserError => ex
|
367
|
-
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("JSON parse error", response.body, response.code)
|
368
|
-
end
|
369
|
-
|
370
|
-
self.build_task(task_data: parsed_json, session: session)
|
371
|
-
self.set_backup_creds
|
372
|
-
self.save(validate: false) if self.changed?
|
373
|
-
else
|
374
|
-
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
375
|
-
end
|
379
|
+
if !self.auto_deployed? && (!skip_connect || self['zuora_logins'].blank?)
|
380
|
+
self.fetch_connect_data
|
376
381
|
else
|
377
382
|
self.build_task(task_data: self.zuora_logins, session: session)
|
378
383
|
end
|
@@ -775,10 +780,10 @@ module ZuoraConnect
|
|
775
780
|
Redis.current.del("AppInstance:#{self.id}")
|
776
781
|
end
|
777
782
|
|
778
|
-
def cache_app_instance
|
783
|
+
def cache_app_instance(force_cache: false)
|
779
784
|
if defined?(Redis.current)
|
780
785
|
#Task data must be present and the last refresh cannot be old. We dont want to overwite new cache data with old
|
781
|
-
if self.task_data.present? && (self.last_refresh.to_i > INSTANCE_REFRESH_WINDOW.ago.to_i)
|
786
|
+
if self.task_data.present? && ((self.last_refresh.to_i > INSTANCE_REFRESH_WINDOW.ago.to_i ) || force_cache)
|
782
787
|
ZuoraConnect.logger.debug("Caching AppInstance", self.default_ougai_items)
|
783
788
|
Redis.current.setex("AppInstance:#{self.id}", INSTANCE_REDIS_CACHE_PERIOD.to_i, self.encrypt_data(data: self.save_data))
|
784
789
|
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: 3.1.0.pre.
|
4
|
+
version: 3.1.0.pre.d
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|