zuora_connect_oauth_alpha 2.1 → 2.11
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: 44d299fd0ade55d38b0dab6af9d077e7bf0d06103614a325a4b14b0a48928557
|
4
|
+
data.tar.gz: 280362ee816ea6a4aaa9d955f1c0561cb47258f07c85523de1c59042c51e22b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df7695697be2d5c8e91c993066b58056673201e1f322764ba8176b1a380c7a513a4285abd2cad385950e306a449ac2fcff44b07a99a6185f231b1ef0cb0bc398
|
7
|
+
data.tar.gz: 2c2a3a5cfe9df47e01d482c884b12885656705334b03308fdf3d7ff5a6acf64475ea5f9259c144013751c5da518a2b4e2c5ff4c39b203d166eb8ed21cb968dbb
|
@@ -4,7 +4,7 @@ module ZuoraConnect
|
|
4
4
|
after_initialize :init
|
5
5
|
self.table_name = "zuora_connect_app_instances"
|
6
6
|
attr_accessor :options, :mode, :logins, :task_data, :last_refresh, :username, :password, :s3_client, :api_version
|
7
|
-
|
7
|
+
|
8
8
|
REFRESH_TIMEOUT = 2.minute #Used to determine how long to wait on current refresh call before executing another
|
9
9
|
INSTANCE_REFRESH_WINDOW = 30.minutes #Used to set how how long till app starts attempting to refresh cached task connect data
|
10
10
|
INSTANCE_REDIS_CACHE_PERIOD = 60.minutes #Used to determine how long to cached task data will live for
|
@@ -25,7 +25,7 @@ module ZuoraConnect
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def apartment_switch(method = nil, migrate = false)
|
28
|
-
begin
|
28
|
+
begin
|
29
29
|
Apartment::Tenant.switch!(self.id) if self.persisted?
|
30
30
|
rescue Apartment::TenantNotFound => ex
|
31
31
|
Apartment::Tenant.create(self.id.to_s)
|
@@ -70,7 +70,7 @@ module ZuoraConnect
|
|
70
70
|
raise ZuoraConnect::Exceptions::HoldingPattern if holding_pattern && !self.mark_for_refresh
|
71
71
|
self.refresh(session)
|
72
72
|
|
73
|
-
elsif (self.id != session["appInstance"].to_i)
|
73
|
+
elsif (self.id != session["appInstance"].to_i)
|
74
74
|
Rails.logger.info("[#{self.id}] REFRESHING - AppInstance ID(#{self.id}) does not match session id(#{session["appInstance"].to_i})")
|
75
75
|
raise ZuoraConnect::Exceptions::HoldingPattern if holding_pattern && !self.mark_for_refresh
|
76
76
|
self.refresh(session)
|
@@ -81,11 +81,11 @@ module ZuoraConnect
|
|
81
81
|
self.refresh(session)
|
82
82
|
|
83
83
|
elsif session["#{self.id}::last_refresh"].blank?
|
84
|
-
Rails.logger.info("[#{self.id}] REFRESHING - No Time on Cookie")
|
84
|
+
Rails.logger.info("[#{self.id}] REFRESHING - No Time on Cookie")
|
85
85
|
raise ZuoraConnect::Exceptions::HoldingPattern if holding_pattern && !self.mark_for_refresh
|
86
86
|
self.refresh(session)
|
87
87
|
|
88
|
-
# If the cache is expired and we can aquire a refresh lock
|
88
|
+
# If the cache is expired and we can aquire a refresh lock
|
89
89
|
elsif (session["#{self.id}::last_refresh"].to_i < INSTANCE_REFRESH_WINDOW.ago.to_i) && self.mark_for_refresh
|
90
90
|
Rails.logger.info("[#{self.id}] REFRESHING - Session Old by #{time_expire.abs} second")
|
91
91
|
self.refresh(session)
|
@@ -230,7 +230,7 @@ module ZuoraConnect
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def oauth_expired?
|
233
|
-
(self.oauth_expires_at < Time.now)
|
233
|
+
return self.oauth_expires_at.present? ? (self.oauth_expires_at < Time.now) : true
|
234
234
|
end
|
235
235
|
|
236
236
|
def refresh_oauth
|
@@ -268,7 +268,7 @@ module ZuoraConnect
|
|
268
268
|
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
269
269
|
sleep(5)
|
270
270
|
self.reload_attributes([:refresh_token, :oauth_expires_at, :access_token]) #Reload only the refresh token for retry
|
271
|
-
|
271
|
+
|
272
272
|
#After reload, if nolonger expired return
|
273
273
|
return if !self.oauth_expired?
|
274
274
|
|
@@ -301,7 +301,7 @@ module ZuoraConnect
|
|
301
301
|
|
302
302
|
def mark_for_refresh
|
303
303
|
return defined?(Redis.current) ? Redis.current.set("AppInstance:#{self.id}:Refreshing", true, {:nx => true, :ex => REFRESH_TIMEOUT.to_i}) : true
|
304
|
-
end
|
304
|
+
end
|
305
305
|
|
306
306
|
def data_lookup(session: {})
|
307
307
|
if defined?(PaperTrail)
|
@@ -661,7 +661,7 @@ module ZuoraConnect
|
|
661
661
|
### END S3 Helping Methods #####
|
662
662
|
|
663
663
|
### START Aggregate Grouping Helping Methods ####
|
664
|
-
def self.refresh_aggregate_table(aggregate_name: 'all_tasks_processing', table_name: 'tasks', where_clause: "where status in ('Processing', 'Queued')", index_table: true)
|
664
|
+
def self.refresh_aggregate_table(aggregate_name: 'all_tasks_processing', table_name: 'tasks', where_clause: "where status in ('Processing', 'Queued')", index_table: true)
|
665
665
|
self.update_functions
|
666
666
|
#Broke function into two parts to ensure transaction size was small enough
|
667
667
|
ActiveRecord::Base.connection.execute('SELECT "shared_extensions".refresh_aggregate_table(\'%s\', \'%s\', %s, \'Table\');' % [aggregate_name, table_name, ActiveRecord::Base.connection.quote(where_clause)])
|
@@ -673,13 +673,13 @@ module ZuoraConnect
|
|
673
673
|
end
|
674
674
|
### END Aggregate Grouping Helping Methods #####
|
675
675
|
|
676
|
-
# Overide this method to avoid the new session call for api requests that use the before filter authenticate_app_api_request.
|
676
|
+
# Overide this method to avoid the new session call for api requests that use the before filter authenticate_app_api_request.
|
677
677
|
# This can be usefull for apps that dont need connect metadata call, or credentials, to operate for api requests
|
678
678
|
def new_session_for_api_requests(params: {})
|
679
679
|
return true
|
680
680
|
end
|
681
681
|
|
682
|
-
# Overide this method to avoid the new session call for ui requests that use the before filter authenticate_connect_app_request.
|
682
|
+
# Overide this method to avoid the new session call for ui requests that use the before filter authenticate_connect_app_request.
|
683
683
|
# This can be usefull for apps that dont need connect metadata call, or credentials, to operate for ui requests
|
684
684
|
def new_session_for_ui_requests(params: {})
|
685
685
|
return true
|
@@ -1,6 +1,6 @@
|
|
1
1
|
redis_url = ENV["REDIS_URL"].present? ? ENV["REDIS_URL"] : defined?(Rails.application.secrets.redis) ? Rails.application.secrets.redis : 'redis://localhost:6379/1'
|
2
2
|
if defined?(Redis.current)
|
3
|
-
Redis.current = Redis.new(:url => redis_url, :timeout => 10)
|
3
|
+
Redis.current = Redis.new(:url => redis_url, :timeout => 10, :reconnect_attempts => 2)
|
4
4
|
if defined?(Resque.redis)
|
5
5
|
Resque.redis = Redis.current
|
6
6
|
end
|
@@ -90,7 +90,7 @@ module Resque
|
|
90
90
|
|
91
91
|
#Remove Queues under Api Limits
|
92
92
|
api_limit_instances = Redis.current.keys('APILimits:*').map {|key| key.split('APILimits:').last.to_i}
|
93
|
-
real_queues = real_queues.select {|key| key if !api_limit_instances.include?((key.match(/^(\d*)_.*/) || [])[1].to_i)}
|
93
|
+
real_queues = real_queues.select {|key| key if !api_limit_instances.include?((key.match(/^(\d*)_.*/) || [])[1].to_i)} ## 2
|
94
94
|
|
95
95
|
#Queue Pausing
|
96
96
|
paused_instances = Redis.current.keys('resque:PauseQueue:*').map {|key| key.split('resque:PauseQueue:').last.to_i}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect_oauth_alpha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.11'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.2.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.2.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,20 +27,23 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.2.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: zuora_api_oauth_alpha
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
39
|
+
version: '2.12'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
46
|
+
version: '2.12'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: httparty
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|