zuora_connect 2.0.60e → 2.0.60f

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: 9efee2fa39c05fb2cf07a2e9a49e14b76a75e68c8be87f008018287a45551ceb
4
- data.tar.gz: f59b6c98c859dc205afc28a2eae57d5037b6d9cc1f41a5dd33e36d3e2b55a307
3
+ metadata.gz: 2c0b307a59b8fdea6b65f97152dfeb29ce391030160c744aa04b3cb38f87691c
4
+ data.tar.gz: 7eeed93e89cee77af7521b36daf9465e53b7e0ce4b3e97edaf10e2882426029a
5
5
  SHA512:
6
- metadata.gz: 73b79ce54de6008219f2f3fd2abce7defccc27454f3328cf57b02ff116ea7faef8d22d5789566bad372e440c38f486a6bc2062ed2c1ff497d0ea1ac3863cbbdd
7
- data.tar.gz: 940145c4211fa0be98c0e099f69df168a3224d17695c8fe3efa70ad4ed6fcc4788377d4ed74f17fd089f3c8adab481a1b224c33a46f71701403b00dbc1d386b6
6
+ metadata.gz: b93072f75b28ade9243d6ebf16dfd7f884744420a6d620f25747067f05c0c0ef6c261eb4d567b41395ff19106dfe4045f769278c760b317ae4799269e849fec1
7
+ data.tar.gz: b68884827084f3c53ce8bf0cd827bbe311fa6be686e3aad61293375d173876ded63eee6f94391fda51f060f17aff3dc98d728119951bd2f0dc4921ceed2ca759
@@ -338,6 +338,10 @@ module ZuoraConnect
338
338
  raise
339
339
  end
340
340
 
341
+ def aws_secrets
342
+ (Rails.application.secrets.aws || {}).transform_keys { |key| key.to_s }
343
+ end
344
+
341
345
  #### START KMS ENCRYPTION Methods ####
342
346
  def zuora_logins=(val)
343
347
  write_attribute(:zuora_logins, kms_encrypt(val.to_json))
@@ -350,7 +354,7 @@ module ZuoraConnect
350
354
 
351
355
  def kms_decrypt(value)
352
356
  kms_tries ||= 0
353
- kms_client = Aws::KMS::Client.new({region: Rails.application.secrets.aws['AWS_REGION'], credentials: self.aws_auth_client}.delete_if { |k, v| v.blank? })
357
+ kms_client = Aws::KMS::Client.new({region: aws_secrets['AWS_REGION'], credentials: self.aws_auth_client}.delete_if { |k, v| v.blank? })
354
358
  resp = kms_client.decrypt({ciphertext_blob: [value].pack("H*") })
355
359
  return resp.plaintext
356
360
  rescue *AWS_AUTH_ERRORS => ex
@@ -365,7 +369,7 @@ module ZuoraConnect
365
369
 
366
370
  def kms_encrypt(value)
367
371
  kms_tries ||= 0
368
- kms_client = Aws::KMS::Client.new({region: Rails.application.secrets.aws['AWS_REGION'], credentials: self.aws_auth_client}.delete_if {|k,v| v.blank? })
372
+ kms_client = Aws::KMS::Client.new({region: aws_secrets['AWS_REGION'], credentials: self.aws_auth_client}.delete_if {|k,v| v.blank? })
369
373
 
370
374
  resp = kms_client.encrypt({key_id: kms_key, plaintext: value})
371
375
  return resp.ciphertext_blob.unpack('H*').first
@@ -380,12 +384,12 @@ module ZuoraConnect
380
384
  end
381
385
 
382
386
  def kms_key
383
- return ENV['AWS_KMS_ARN'] || Rails.application.secrets.dig(:aws,'AWS_KMS_ARN')
387
+ return ENV['AWS_KMS_ARN'] || aws_secrets['AWS_KMS_ARN']
384
388
  end
385
389
 
386
390
  def aws_auth_client
387
391
  if Rails.env.to_s == 'development'
388
- return Aws::Credentials.new(Rails.application.secrets.aws['AWS_ACCESS_KEY_ID'], Rails.application.secrets.aws['AWS_SECRET_ACCESS_KEY'])
392
+ return Aws::Credentials.new(aws_secrets['AWS_ACCESS_KEY_ID'], aws_secrets['AWS_SECRET_ACCESS_KEY'])
389
393
  else
390
394
  return nil
391
395
  end
@@ -2,7 +2,33 @@ module ActiveRecord
2
2
  module ConnectionAdapters
3
3
  class PostgreSQLAdapter < AbstractAdapter
4
4
  private
5
- def load_additional_types(type_map, oids = nil)
5
+ def load_additional_types_latest(oids = nil)
6
+ initializer = OID::TypeMapInitializer.new(type_map)
7
+ if supports_ranges?
8
+ query = <<-SQL
9
+ SELECT DISTINCT on (t.typname) t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
10
+ FROM pg_type as t
11
+ LEFT JOIN pg_range as r ON oid = rngtypid
12
+ SQL
13
+ else
14
+ query = <<-SQL
15
+ SELECT DISTINCT on (t.typname) t.oid, t.typname, t.typelem, t.typdelim, t.typinput, t.typtype, t.typbasetype
16
+ FROM pg_type as t
17
+ SQL
18
+ end
19
+
20
+ if oids
21
+ query += "WHERE t.oid::integer IN (%s)" % oids.join(", ")
22
+ else
23
+ query += initializer.query_conditions_for_initial_load
24
+ end
25
+
26
+ execute_and_clear(query, "SCHEMA", []) do |records|
27
+ initializer.run(records)
28
+ end
29
+ end
30
+
31
+ def load_additional_types_deprecated(type_map, oids = nil)
6
32
  initializer = OID::TypeMapInitializer.new(type_map)
7
33
  if supports_ranges?
8
34
  query = <<-SQL
@@ -27,6 +53,13 @@ module ActiveRecord
27
53
  initializer.run(records)
28
54
  end
29
55
  end
56
+
57
+ rails_version = Rails.version.split('.').map { |x| x.to_i }
58
+ if (rails_version <=> [5, 2, 0]) >= 1
59
+ alias :load_additional_types :load_additional_types_latest
60
+ else
61
+ alias :load_additional_types :load_additional_types_deprecated
62
+ end
30
63
  end
31
64
  end
32
65
  end
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "2.0.60e"
2
+ VERSION = "2.0.60f"
3
3
  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: 2.0.60e
4
+ version: 2.0.60f
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-08-31 00:00:00.000000000 Z
11
+ date: 2020-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment