zuora_connect 3.0.2.pre.g → 3.0.2.pre.h
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 +2 -2
- data/app/models/zuora_connect/login.rb +23 -11
- data/lib/zuora_connect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1daf70331d29259febac6329ca469eb0a452dbd2528b2fca8df344bf4eba70ae
|
4
|
+
data.tar.gz: d9a36bda5170c74140511e7e2538ad2e71c02af12c311cd57dbd9e825c970bbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4db46ecf8fa9ef1f8aea8e1622450e95ba85e9a1f34764e5461ecaa1a4da8987704a5fd15e73946030f9592253bf099db4f4e83515ea81064216bf058dddf05
|
7
|
+
data.tar.gz: 8a71664252ae4b807e0bfe851cb5246de049591787da15a909bb2e67e3c4addd960c0d0fbbdce47758716722bf4c245a0b1aa2b6adbbdb70155c4a23b0770754
|
@@ -266,7 +266,7 @@ module ZuoraConnect
|
|
266
266
|
|
267
267
|
params = {
|
268
268
|
name: self.task_data.dig('name'),
|
269
|
-
zuora_entity_ids: (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).map{|e| e['id']}.uniq,
|
269
|
+
zuora_entity_ids: (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).select {|entity| !entity['skip'].to_bool}.map{|e| e['id']}.uniq,
|
270
270
|
zuora_tenant_ids: tenants.map(&:to_s).uniq,
|
271
271
|
organizations: organizations
|
272
272
|
}
|
@@ -813,7 +813,7 @@ module ZuoraConnect
|
|
813
813
|
def strip_cache_data(object: {}, keys: ['applications', 'tokens','tenant_ids', 'organizations','user_settings'] )
|
814
814
|
keys.each {|key| object.delete(key) }
|
815
815
|
object.select {|k,v| k.include?('login') && v['tenant_type'] == 'Zuora'}.each do |login_key, login_data|
|
816
|
-
object[login_key]['entities'] = login_data.fetch('entities',[]).map {|entity| entity.slice('id', 'tenantId', 'entityId', 'displayName')}
|
816
|
+
object[login_key]['entities'] = login_data.fetch('entities',[]).map {|entity| entity.slice('id', 'tenantId', 'entityId', 'displayName', 'identifier')}
|
817
817
|
end
|
818
818
|
return object
|
819
819
|
end
|
@@ -1,27 +1,29 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
class Login
|
3
|
-
|
3
|
+
attr_accessor :clients, :identifier_to_ids, :default_entity
|
4
4
|
def initialize (fields)
|
5
|
-
|
5
|
+
self.clients = {}
|
6
|
+
self.identifier_to_ids = {}
|
6
7
|
if fields["tenant_type"] == "Zuora"
|
7
8
|
login_fields = fields.map{|k,v| [k.to_sym, v]}.to_h
|
8
9
|
login_type = fields.dig("authentication_type").blank? ? 'Basic' : fields.dig("authentication_type").capitalize
|
9
10
|
|
10
11
|
raise ZuoraConnect::Exceptions::InvalidCredentialSet.new("Cannot setup application with ZSession Login.") if login_type == "Session"
|
11
|
-
|
12
|
-
|
12
|
+
self.clients["Default"] = "::ZuoraAPI::#{login_type}".constantize.new(**login_fields)
|
13
|
+
self.default_entity = fields["entities"][0]["id"] if (fields.dig("entities") || []).size == 1
|
13
14
|
if fields["entities"] && fields["entities"].size > 0
|
14
15
|
fields["entities"].each do |entity|
|
15
|
-
params = {:entity_id => entity["id"]}.merge(login_fields)
|
16
|
-
|
16
|
+
params = {:entity_id => entity["id"], :entity_identifier => entity["identifier"]}.merge(login_fields)
|
17
|
+
self.clients[entity["id"]] = "::ZuoraAPI::#{login_type}".constantize.new(**params)
|
18
|
+
self.identifier_to_ids[entity["identifier"]] = entity["id"]
|
17
19
|
end
|
18
20
|
end
|
19
|
-
self.attr_builder("available_entities",
|
21
|
+
self.attr_builder("available_entities", self.clients.keys)
|
20
22
|
end
|
21
23
|
fields.each do |k,v|
|
22
24
|
self.attr_builder(k,v)
|
23
25
|
end
|
24
|
-
|
26
|
+
self.default_entity ||= "Default"
|
25
27
|
end
|
26
28
|
|
27
29
|
def attr_builder(field,val)
|
@@ -29,9 +31,19 @@ module ZuoraConnect
|
|
29
31
|
send("#{field}=", val)
|
30
32
|
end
|
31
33
|
|
32
|
-
def client(id =
|
33
|
-
|
34
|
-
|
34
|
+
def client(id = self.default_entity)
|
35
|
+
use_entity_name = self.identifier_to_ids.keys.include?(id)
|
36
|
+
|
37
|
+
# Translate entity name to entity id
|
38
|
+
id = self.identifier_to_ids[id] if use_entity_name
|
39
|
+
|
40
|
+
client = id.blank? ? self.clients[self.default_entity] : self.clients[id]
|
35
41
|
|
42
|
+
if client
|
43
|
+
client.entity_header_type = use_entity_name ? :entity_name : :entity_id
|
44
|
+
end
|
45
|
+
|
46
|
+
client
|
47
|
+
end
|
36
48
|
end
|
37
49
|
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.0.2.pre.
|
4
|
+
version: 3.0.2.pre.h
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|