zuora_connect 1.4.13a → 1.4.13

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
  SHA1:
3
- metadata.gz: 2e57dbd41b6b3061db0b57e211bf1b53deee71d6
4
- data.tar.gz: 2a18c93ae7ab502bd165fa6dda57a21ff70b4db5
3
+ metadata.gz: e73c25e9febca6028ce9eea3567c32f5581657a9
4
+ data.tar.gz: 6f1da4f69f89c488ab5dbb552dc18e2b774143d2
5
5
  SHA512:
6
- metadata.gz: 9b739b5d69418ddc0dcac8d70e454a932a9c829090685eae8d75d011ad3bdc12894f238b57ea5cb37dfd7e459bf10b2792413a7bf1e0d4bfc78074ff496f3c76
7
- data.tar.gz: d57d581cd02e8c52b24d204e31edfac7af8ae7a96563cbde43255d19b39f95da6bad91b012b287ff6a3337eb24f7a9093fdf1ac5c06784cdb0879087f2243fa5
6
+ metadata.gz: 88081b7081819c38d4017b4429938d728a0e0422cc9d745f1be1ad7c72798143c7b61e88fd59c99c43db8a09cde3468bc4aa6cefa157d0fea376d9cc37474151
7
+ data.tar.gz: cdfe231a983d87f0f91baa038315cecf79e069ed53df50493800fbf2950dee5151863a2b59d1729648cf24500f202c5cb0592ceb8b31fd7c0bf70e5520186ff4
@@ -23,20 +23,16 @@ module ZuoraConnect
23
23
  end
24
24
 
25
25
  def cache_app_instance
26
- if defined?(Redis)
27
- Redis.current.set("AppInstance:#{self.id}", encrypt_data(self.save_data.to_json))
28
- Redis.current.expire("AppInstance:#{self.id}", 60.minutes.to_i)
29
- Redis.current.del("Deleted:#{self.id}")
30
- end
26
+ $redis.set("AppInstance:#{self.id}", encrypt_data(self.save_data.to_json))
27
+ $redis.expire("AppInstance:#{self.id}", 60.minutes.to_i)
28
+ $redis.del("Deleted:#{self.id}")
31
29
  end
32
30
 
33
31
  def decrypt_data(data)
34
- return data if data.blank?
35
32
  return Rails.env == 'development' ? JSON.parse(data) : JSON.parse(encryptor.decrypt_and_verify(CGI::unescape(data)))
36
33
  end
37
34
 
38
35
  def encrypt_data(data)
39
- return data if data.blank?
40
36
  return Rails.env == 'development' ? data : encryptor.encrypt_and_sign(data)
41
37
  end
42
38
 
@@ -55,18 +51,13 @@ module ZuoraConnect
55
51
  def catalog_lookup(entity_id: nil, object: :product, object_id: nil, map_lower_objects: true)
56
52
  entity_reference = entity_id.blank? ? 'Default' : entity_id
57
53
  object_hierarchy = (JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog_mapping #> \'{%s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s LIMIT 1' % [entity_reference, self.id]).first["item"] || "{}") [object_id] || {"productId" => "SAFTEY", "productRatePlanId" => "SAFTEY", "productRatePlanChargeId" => "SAFTEY"})
58
-
59
- if defined?(Redis) && !object_id.blank?
60
- stub_catalog = decrypt_data(Redis.current.get("Catalog:#{self.id}:#{object_id}"))
61
- end
62
54
 
63
55
  case object
64
56
  when :product
65
57
  if object_id.blank?
66
- stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, self.id]).first["item"] || "{}")
67
- Redis.current.set("Catalog:#{self.id}:#{object_id}", encrypt_data(stub_catalog))
58
+ stub_catalog = JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, self.id]).first["item"] || "{}")
68
59
  else
69
- stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s, %s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, object_id, self.id]).first["item"] || "{}")
60
+ stub_catalog = JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s, %s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, object_id, self.id]).first["item"] || "{}")
70
61
  end
71
62
 
72
63
  if !map_lower_objects
@@ -74,10 +65,9 @@ module ZuoraConnect
74
65
  end
75
66
  when :rateplan
76
67
  if object_id.blank?
77
- stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute('SELECT json_object_agg(rateplan_id, rateplan) AS item FROM "public"."zuora_connect_app_instances", jsonb_each(("public"."zuora_connect_app_instances"."catalog" #> \'{%s}\' )) AS e(product_id, product), jsonb_each(product #> \'{productRatePlans}\') AS ee(rateplan_id, rateplan) WHERE "id" = %s' % [entity_reference, self.id]).first["item"] || "{}")
78
- Redis.current.set("Catalog:#{self.id}:#{object_id}", encrypt_data(stub_catalog))
68
+ stub_catalog = JSON.parse(ActiveRecord::Base.connection.execute('SELECT json_object_agg(rateplan_id, rateplan) AS item FROM "public"."zuora_connect_app_instances", jsonb_each(("public"."zuora_connect_app_instances"."catalog" #> \'{%s}\' )) AS e(product_id, product), jsonb_each(product #> \'{productRatePlans}\') AS ee(rateplan_id, rateplan) WHERE "id" = %s' % [entity_reference, self.id]).first["item"] || "{}")
79
69
  else
80
- stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s, %s, productRatePlans, %s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, object_hierarchy['productId'], object_id, self.id]).first["item"] || "{}")
70
+ stub_catalog = JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s, %s, productRatePlans, %s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, object_hierarchy['productId'], object_id, self.id]).first["item"] || "{}")
81
71
  end
82
72
 
83
73
  if !map_lower_objects
@@ -85,10 +75,9 @@ module ZuoraConnect
85
75
  end
86
76
  when :charge
87
77
  if object_id.blank?
88
- stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute('SELECT json_object_agg(charge_id, charge) as item FROM "public"."zuora_connect_app_instances", jsonb_each(("public"."zuora_connect_app_instances"."catalog" #> \'{%s}\' )) AS e(product_id, product), jsonb_each(product #> \'{productRatePlans}\') AS ee(rateplan_id, rateplan), jsonb_each(rateplan #> \'{productRatePlanCharges}\') AS eee(charge_id, charge) WHERE "id" = %s' % [entity_reference, self.id]).first["item"] || "{}")
89
- Redis.current.set("Catalog:#{self.id}:#{object_id}", encrypt_data(stub_catalog))
78
+ stub_catalog = JSON.parse(ActiveRecord::Base.connection.execute('SELECT json_object_agg(charge_id, charge) as item FROM "public"."zuora_connect_app_instances", jsonb_each(("public"."zuora_connect_app_instances"."catalog" #> \'{%s}\' )) AS e(product_id, product), jsonb_each(product #> \'{productRatePlans}\') AS ee(rateplan_id, rateplan), jsonb_each(rateplan #> \'{productRatePlanCharges}\') AS eee(charge_id, charge) WHERE "id" = %s' % [entity_reference, self.id]).first["item"] || "{}")
90
79
  else
91
- stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s, %s, productRatePlans, %s, productRatePlanCharges, %s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, object_hierarchy['productId'], object_hierarchy['productRatePlanId'], object_id, self.id]).first["item"] || "{}")
80
+ stub_catalog = JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog #> \'{%s, %s, productRatePlans, %s, productRatePlanCharges, %s}\' AS item FROM "public"."zuora_connect_app_instances" WHERE "id" = %s' % [entity_reference, object_hierarchy['productId'], object_hierarchy['productRatePlanId'], object_id, self.id]).first["item"] || "{}")
92
81
  end
93
82
  end
94
83
 
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "1.4.13a"
2
+ VERSION = "1.4.13"
3
3
  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.13a
4
+ version: 1.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
@@ -297,9 +297,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
297
  version: '0'
298
298
  required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  requirements:
300
- - - ">"
300
+ - - ">="
301
301
  - !ruby/object:Gem::Version
302
- version: 1.3.1
302
+ version: '0'
303
303
  requirements: []
304
304
  rubyforge_project:
305
305
  rubygems_version: 2.6.8