zuora_connect 3.0.0.pre.a → 3.0.0.pre.b
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: d7d9c3445983c015ce0615581bee9d36802b113c220caf4404f4bed697fc67ac
|
4
|
+
data.tar.gz: 29428d8aec94b04f215ac3faa5faba871cf1c21f60eb804abe6f501adafdb0ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb4cee9b6e964dbd417e758bf03e1a7cf1461d600e327110ad0155c5fd710e7083fb2d476697a24fe5d327a22eea4585982dbe1133b32b7c849a921a1004fe07
|
7
|
+
data.tar.gz: 7bd1393e58a2b341a2c64d8b8d870bbc13e906fa99ba22dd201a2afd250642505b1480469cfa5788dfd45215fe726b3af5a117d6eb80e623cc55e8d37bbd65cc
|
@@ -168,6 +168,7 @@ module ZuoraConnect
|
|
168
168
|
end
|
169
169
|
|
170
170
|
self.build_task(task_data: mock_task_data, session: session)
|
171
|
+
self.set_backup_creds
|
171
172
|
self.last_refresh = Time.now.to_i
|
172
173
|
else
|
173
174
|
time_expire = (session["#{self.id}::last_refresh"] || Time.now).to_i - INSTANCE_REFRESH_WINDOW.ago.to_i
|
@@ -289,10 +290,7 @@ module ZuoraConnect
|
|
289
290
|
elsif type == :user
|
290
291
|
begin
|
291
292
|
sql = <<-eos
|
292
|
-
SELECT zuora_users.zuora_identity_response
|
293
|
-
FROM "#{self.id}".zuora_users
|
294
|
-
ORDER BY zuora_users.updated_at DESC
|
295
|
-
LIMIT 1;
|
293
|
+
SELECT zuora_users.zuora_identity_response FROM "#{self.id}".zuora_users ORDER BY zuora_users.updated_at DESC LIMIT 1;
|
296
294
|
eos
|
297
295
|
user = ActiveRecord::Base.connection.execute(sql).to_a.first
|
298
296
|
|
@@ -352,7 +350,7 @@ module ZuoraConnect
|
|
352
350
|
skip_connect ||= false
|
353
351
|
begin
|
354
352
|
#Check how app was deployed
|
355
|
-
if self.
|
353
|
+
if !self.auto_deployed? && !skip_connect
|
356
354
|
self.check_oauth_state
|
357
355
|
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
|
358
356
|
|
@@ -363,17 +361,9 @@ module ZuoraConnect
|
|
363
361
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("JSON parse error", response.body, response.code)
|
364
362
|
end
|
365
363
|
|
366
|
-
self.build_task(task_data: parsed_json, session: session)
|
367
|
-
|
368
|
-
|
369
|
-
self.zuora_logins = self.strip_cache_data(object: parsed_json.dup, keys: ['applications', 'tokens', 'user_settings'])
|
370
|
-
self.save(:validate => false)
|
371
|
-
rescue Aws::KMS::Errors::ValidationException, *AWS_AUTH_ERRORS => ex
|
372
|
-
Rails.logger.warn(AWS_AUTH_ERRORS_MSG, ex)
|
373
|
-
rescue => ex
|
374
|
-
Rails.logger.error(AWS_AUTH_ERRORS_MSG, ex)
|
375
|
-
end
|
376
|
-
end
|
364
|
+
self.build_task(task_data: parsed_json, session: session)
|
365
|
+
self.set_backup_creds
|
366
|
+
self.save(validate: false) if self.changed?
|
377
367
|
else
|
378
368
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
379
369
|
end
|
@@ -418,8 +408,16 @@ module ZuoraConnect
|
|
418
408
|
end
|
419
409
|
|
420
410
|
#### START KMS ENCRYPTION Methods ####
|
411
|
+
def set_backup_creds
|
412
|
+
if self.kms_key.present? && self.kms_key.match(/^arn:aws:.*/) && self.task_data.present?
|
413
|
+
self.zuora_logins = self.strip_cache_data(object: self.task_data.dup, keys: ['applications', 'tokens', 'user_settings'])
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
421
417
|
def zuora_logins=(val)
|
422
418
|
write_attribute(:zuora_logins, kms_encrypt(val.to_json))
|
419
|
+
rescue Aws::KMS::Errors::ValidationException, Aws::KMS::Errors::NotFoundException, *AWS_AUTH_ERRORS => ex
|
420
|
+
Rails.logger.warn(AWS_AUTH_ERRORS_MSG, ex)
|
423
421
|
end
|
424
422
|
|
425
423
|
def zuora_logins
|
@@ -582,7 +580,7 @@ module ZuoraConnect
|
|
582
580
|
parsed_json = JSON.parse(response.body)
|
583
581
|
|
584
582
|
#Set Org
|
585
|
-
if self.
|
583
|
+
if self.auto_deployed? && parsed_json['organization'].present?
|
586
584
|
login_cache = self.zuora_logins
|
587
585
|
login_cache.delete('organization')
|
588
586
|
self.zuora_logins = login_cache.merge({'organizations' => [parsed_json['organization']]})
|
@@ -86,13 +86,6 @@ module ZuoraConnect
|
|
86
86
|
@status, @headers, @response = @app.call(env)
|
87
87
|
ensure
|
88
88
|
|
89
|
-
# If the url contains any CSS or JavaScript files then do not collect metrics for them
|
90
|
-
if ["css", "assets", "jpg", "png", "jpeg", "ico"].any? { |word| env['PATH_INFO'].include?(word) } || /.*\.js$/.match(env['PATH_INFO'])
|
91
|
-
tags = {status: @status, controller: 'ActionController', action: 'Assets', app_instance: 0}
|
92
|
-
values = {response_time: ((Time.now - start_time)*1000).round(2) }
|
93
|
-
ZuoraObservability::Metrics.write_to_telegraf(direction: 'request-inbound-assets', tags: tags, values: values)
|
94
|
-
end
|
95
|
-
|
96
89
|
# Uncomment following block of code for handling engine requests/requests without controller
|
97
90
|
# else
|
98
91
|
# # Handling requests which do not have controllers (engines)
|
@@ -677,10 +677,17 @@ module ZuoraConnect
|
|
677
677
|
|
678
678
|
def setup_instance_via_dev_mode
|
679
679
|
session["appInstance"] = ZuoraConnect.configuration.dev_mode_appinstance
|
680
|
-
|
681
|
-
|
682
|
-
values = {
|
683
|
-
|
680
|
+
session["#{ZuoraConnect.configuration.dev_mode_appinstance}::admin"] = ZuoraConnect.configuration.dev_mode_admin
|
681
|
+
|
682
|
+
values = {
|
683
|
+
id: ZuoraConnect.configuration.dev_mode_appinstance,
|
684
|
+
access_token: ZuoraConnect.configuration.dev_mode_user,
|
685
|
+
refresh_token: ZuoraConnect.configuration.dev_mode_pass,
|
686
|
+
token: ZuoraConnect.configuration.dev_mode_pass+ZuoraConnect.configuration.dev_mode_pass,
|
687
|
+
api_token: ZuoraConnect.configuration.dev_mode_pass+ZuoraConnect.configuration.dev_mode_pass
|
688
|
+
}
|
689
|
+
|
690
|
+
@appinstance = ZuoraConnect::AppInstance.find_by(:id => ZuoraConnect.configuration.dev_mode_appinstance.to_i)
|
684
691
|
ZuoraConnect::ZuoraUser.current_user_id = 0
|
685
692
|
if @appinstance.blank?
|
686
693
|
Apartment::Tenant.switch!("public")
|
@@ -690,14 +697,10 @@ module ZuoraConnect
|
|
690
697
|
Apartment::Tenant.drop(values[:appinstance].to_s)
|
691
698
|
retry
|
692
699
|
end
|
693
|
-
|
694
|
-
@appinstance = ZuoraConnect::AppInstance.new(:id => values[:appinstance].to_i, :access_token => values[:user], :refresh_token => values[:key], :token => "#{values[:key]}#{values[:key]}", :api_token => "#{values[:key]}#{values[:key]}")
|
695
|
-
@appinstance.save(:validate => false)
|
696
|
-
end
|
697
|
-
if @appinstance.access_token.blank? || @appinstance.refresh_token.blank? || @appinstance.token.blank? || @appinstance.api_token.blank?
|
698
|
-
@appinstance.update_attributes!(:access_token => values["user"], :refresh_token => values["key"], :token => "#{values[:key]}#{values[:key]}", :api_token => "#{values[:key]}#{values[:key]}")
|
700
|
+
@appinstance = ZuoraConnect::AppInstance.new()
|
699
701
|
end
|
700
|
-
|
702
|
+
@appinstance.assign_attributes(values)
|
703
|
+
@appinstance.save(:validate => false)
|
701
704
|
end
|
702
705
|
end
|
703
706
|
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.0.pre.
|
4
|
+
version: 3.0.0.pre.b
|
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-
|
11
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|