zuora_connect 1.6.06 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/zuora_connect/app_instance_base.rb +25 -20
- data/app/models/zuora_connect/login.rb +13 -12
- data/lib/zuora_connect/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aeb9466de005d8eff32c27e0ecd08694aa351ad
|
4
|
+
data.tar.gz: cf8deeee4650bd0fd595fba68758d1e3e1c831a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c0a73ea96d302e9643b7277940c5618a0cc1a79f911e6bf0ab44d04235e6bb76ea054c7b6247b477af4378633636a01aa48ee9296931cebc6a3b5993ba012b5
|
7
|
+
data.tar.gz: 2f1d5a979d8f1a81e3e3eac212bf27f5162d42dcfdab26ab3acd2ca97a3eeac983e42891b17d7c7ad3eb9f53dc50e91fbc5da0f6f76d0e84e237d4cd19179f4e
|
@@ -223,7 +223,7 @@ module ZuoraConnect
|
|
223
223
|
Rails.logger.debug("[#{self.id}] REFRESH TASK - Connect Task Info Request Time #{response_time.round(2).to_s}")
|
224
224
|
if response.code == 200
|
225
225
|
build_task(JSON.parse(response.body), session)
|
226
|
-
|
226
|
+
self.last_refresh = Time.now.to_i
|
227
227
|
self.cache_app_instance
|
228
228
|
self.reset_mark_for_refresh
|
229
229
|
else
|
@@ -253,21 +253,23 @@ module ZuoraConnect
|
|
253
253
|
|
254
254
|
#### START Task Mathods ####
|
255
255
|
def build_task(task_data, session)
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
if
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
else
|
269
|
-
tmp.client.current_session = session["#{self.id}::#{k}:session"] if !session.nil? && v["tenant_type"] == "Zuora" && session["#{self.id}::#{k}:session"]
|
256
|
+
@task_data = task_data
|
257
|
+
@mode = @task_data["mode"]
|
258
|
+
@task_data.each do |k,v|
|
259
|
+
if k.match(/^(.*)_login$/)
|
260
|
+
tmp = ZuoraConnect::Login.new(v)
|
261
|
+
if session.present? && v["tenant_type"] == "Zuora"
|
262
|
+
if tmp.entities.size > 0
|
263
|
+
tmp.entities.each do |value|
|
264
|
+
entity_id = value["id"]
|
265
|
+
tmp.client(entity_id).current_session = session["#{self.id}::#{k}::#{entity_id}:current_session"] if session["#{self.id}::#{k}::#{entity_id}:current_session"]
|
266
|
+
tmp.client(entity_id).bearer_token = session["#{self.id}::#{k}::#{entity_id}:bearer_token"] if session["#{self.id}::#{k}::#{entity_id}:bearer_token"]
|
267
|
+
tmp.client(entity_id).oauth_session_expires_at = session["#{self.id}::#{k}::#{entity_id}:oauth_session_expires_at"] if session["#{self.id}::#{k}::#{entity_id}:oauth_session_expires_at"]
|
270
268
|
end
|
269
|
+
else
|
270
|
+
tmp.client.current_session = session["#{self.id}::#{k}:current_session"] if session["#{self.id}::#{k}:current_session"]
|
271
|
+
tmp.client.bearer_token = session["#{self.id}::#{k}:bearer_token"] if session["#{self.id}::#{k}:bearer_token"] && tmp.client.respond_to?(:bearer_token) ## need incase session id goes from basic to aouth in same redis store
|
272
|
+
tmp.client.oauth_session_expires_at = session["#{self.id}::#{k}:oauth_session_expires_at"] if session["#{self.id}::#{k}:oauth_session_expires_at"] && tmp.client.respond_to?(:oauth_session_expires_at)
|
271
273
|
end
|
272
274
|
@logins[k] = tmp
|
273
275
|
self.attr_builder(k, @logins[k])
|
@@ -443,10 +445,14 @@ module ZuoraConnect
|
|
443
445
|
if login.tenant_type == "Zuora"
|
444
446
|
if login.available_entities.size > 1 && Rails.application.config.session_store != ActionDispatch::Session::CookieStore
|
445
447
|
login.available_entities.each do |entity_key|
|
446
|
-
session["#{self.id}::#{key}::#{entity_key}:
|
448
|
+
session["#{self.id}::#{key}::#{entity_key}:current_session"] = login.client(entity_key).current_session if login.client.respond_to?(:current_session)
|
449
|
+
session["#{self.id}::#{key}::#{entity_key}:bearer_token"] = login.client(entity_key).bearer_token if login.client.respond_to?(:bearer_token)
|
450
|
+
session["#{self.id}::#{key}::#{entity_key}:oauth_session_expires_at"] = login.client(entity_key).oauth_session_expires_at if login.client.respond_to?(:oauth_session_expires_at)
|
447
451
|
end
|
448
452
|
else
|
449
|
-
session["#{self.id}::#{key}:
|
453
|
+
session["#{self.id}::#{key}:current_session"] = login.client.current_session if login.client.respond_to?(:current_session)
|
454
|
+
session["#{self.id}::#{key}:bearer_token"] = login.client.bearer_token if login.client.respond_to?(:bearer_token)
|
455
|
+
session["#{self.id}::#{key}:oauth_session_expires_at"] = login.client.oauth_session_expires_at if login.client.respond_to?(:oauth_session_expires_at)
|
450
456
|
end
|
451
457
|
end
|
452
458
|
end
|
@@ -496,7 +502,7 @@ module ZuoraConnect
|
|
496
502
|
def encrypt_data(data: nil)
|
497
503
|
return data if data.blank?
|
498
504
|
|
499
|
-
if Rails.env
|
505
|
+
if ['development', 'test'].include?(Rails.env)
|
500
506
|
return data.to_json
|
501
507
|
else
|
502
508
|
return encryptor.encrypt_and_sign(data.to_json)
|
@@ -745,7 +751,6 @@ module ZuoraConnect
|
|
745
751
|
Redis.current.set("Catalog:#{self.id}:#{object_id}:Hierarchy", encrypt_data(data: object_hierarchy))
|
746
752
|
Redis.current.set("Catalog:#{self.id}:#{object_id}:Children:#{child_objects}", encrypt_data(data: stub_catalog)) if cache
|
747
753
|
end
|
748
|
-
|
749
754
|
return stub_catalog
|
750
755
|
end
|
751
756
|
### END Catalog Helping Methods #####
|
@@ -850,4 +855,4 @@ module ZuoraConnect
|
|
850
855
|
method_hook :refresh, :updateOption, :update_logins, :before => :check_oauth_state
|
851
856
|
method_hook :new_session, :refresh, :build_task, :after => :apartment_switch
|
852
857
|
end
|
853
|
-
end
|
858
|
+
end
|
@@ -3,20 +3,21 @@ module ZuoraConnect
|
|
3
3
|
|
4
4
|
def initialize (fields)
|
5
5
|
@clients = {}
|
6
|
-
if fields["tenant_type"] == "Zuora"
|
7
|
-
|
8
|
-
|
9
|
-
fields["
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
if fields["tenant_type"] == "Zuora"
|
7
|
+
login_fields = fields.map{|k,v| [k.to_sym, v]}.to_h
|
8
|
+
|
9
|
+
fields["authentication_type"] = "basic" if fields["authentication_type"].nil? || fields["authentication_type"].blank?
|
10
|
+
|
11
|
+
@clients["Default"] = "::ZuoraAPI::#{fields["authentication_type"].capitalize}".constantize.new(login_fields)
|
12
|
+
@default_entity = fields["entities"][0]["id"] if fields["entities"].size == 1 if fields["entities"] && fields["entities"].size > 0
|
13
|
+
if fields["entities"] && fields["entities"].size > 0
|
14
|
+
fields["entities"].each do |entity|
|
15
|
+
params = {:entity_id => entity["id"]}.merge(login_fields)
|
16
|
+
@clients[entity["id"]] = "::ZuoraAPI::#{fields["authentication_type"].capitalize}".constantize.new(params)
|
17
|
+
end
|
13
18
|
end
|
14
|
-
|
15
|
-
@clients["Default"] = ::ZuoraAPI::Basic.new(fields.map{|k,v| [k.to_sym, v]}.to_h)
|
19
|
+
self.attr_builder("available_entities", @clients.keys)
|
16
20
|
end
|
17
|
-
|
18
|
-
self.attr_builder("available_entities",@clients.keys) if fields["tenant_type"] == "Zuora"
|
19
|
-
|
20
21
|
fields.each do |k,v|
|
21
22
|
self.attr_builder(k,v)
|
22
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
@@ -169,7 +169,7 @@ dependencies:
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
- !ruby/object:Gem::Dependency
|
172
|
-
name:
|
172
|
+
name: factory_bot
|
173
173
|
requirement: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
175
|
- - ">="
|
@@ -210,6 +210,34 @@ dependencies:
|
|
210
210
|
- - ">="
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
|
+
- !ruby/object:Gem::Dependency
|
214
|
+
name: webmock
|
215
|
+
requirement: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - ">="
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
220
|
+
type: :development
|
221
|
+
prerelease: false
|
222
|
+
version_requirements: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - ">="
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
227
|
+
- !ruby/object:Gem::Dependency
|
228
|
+
name: fakeredis
|
229
|
+
requirement: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - ">="
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '0'
|
234
|
+
type: :development
|
235
|
+
prerelease: false
|
236
|
+
version_requirements: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
213
241
|
description: Description of Connect.
|
214
242
|
email:
|
215
243
|
- connect@zuora.com
|