zuora_connect 3.1.2.pre.a → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71565c519f52d6be0809d472180939cd58d19e68458870c59b02a2fee0a5b2b8
4
- data.tar.gz: 0d84051d7b89cba49350eab6dfb0cecd2735f6b7977ee8311ac179941b70f4c7
3
+ metadata.gz: 493dd9cc489602b3f459c2eb71bf944ae8e4d48dd5179a68836e6b6586ce02de
4
+ data.tar.gz: 79dfe48b44bf8c8fd9f95931ae8d7b9db43d4194cc62172a3ca08778678e003d
5
5
  SHA512:
6
- metadata.gz: e32a55f439c3cdfcdb237d6b4cd6f6d52bc86566503c9089e37a98215d16ec65c8607da6b3612fffbf9aca6b2730bc0c07a524e7feb2b4f089fb0a4302f9c850
7
- data.tar.gz: f1ba32eedf0ded2b2c2e923776a0a8bb7485e1b7ec9aa5eb731dc92b185a23ddf0bb3a82bc8badafdc3e1cd591a5e20d0b7cd50813605b3ebf56dacd878c84a8
6
+ metadata.gz: 887d066e13ff882c1b2a96290d88207359d710a1b87989a5442aa45e152e4312213c936e14adbc6c1b0f11c29edaaf8107803a4733b55684279803ae55e3a2ac
7
+ data.tar.gz: d774d37dc4adab8073d88521c59bb4d58a994626f81e17c1b9421b9273b56f5f7903c50375614d613c5961846fd0f52de94eb19b58a2d0ec956051668f41b0b0
@@ -1,11 +1,11 @@
1
1
  module ZuoraConnect
2
2
  class StaticController < ApplicationController
3
- before_action :authenticate_connect_app_request, :except => [:health, :initialize_app, :provision, :instance_user]
4
- before_action :clear_connect_app_session, :only => [:health, :initialize_app, :provision, :instance_user]
5
- after_action :persist_connect_app_session, :except => [:health, :initialize_app, :provision, :instance_user]
3
+ before_action :authenticate_connect_app_request, :except => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
4
+ before_action :clear_connect_app_session, :only => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
5
+ after_action :persist_connect_app_session, :except => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
6
6
 
7
7
  skip_before_action :verify_authenticity_token, :only => [:initialize_app, :provision]
8
- http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision, :instance_user]
8
+ http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision, :instance_user, :instance_drop]
9
9
 
10
10
 
11
11
  def health
@@ -119,6 +119,40 @@ module ZuoraConnect
119
119
  }, status: 500
120
120
  end
121
121
 
122
+ def instance_drop
123
+ ZuoraConnect::AppInstance.read_master_db do
124
+ instance_id = params[:id]
125
+ @appinstance = ZuoraConnect::AppInstance.find(instance_id)
126
+ if @appinstance.drop_instance
127
+ ZuoraConnect::AppInstance.destroy(instance_id)
128
+ msg = Apartment::Tenant.drop(instance_id)
129
+
130
+ if msg.error_message.present?
131
+ render json: { "message" => msg.error_message }, status: :bad_request
132
+ else
133
+ render json: {
134
+ status: 200,
135
+ message: 'Success',
136
+ app_instance_id: instance_id
137
+ }, status: 200
138
+ end
139
+ else
140
+ render json: { "message" => @appinstance.drop_message }, status: :bad_request
141
+ end
142
+ end
143
+ rescue StandardError => e
144
+ message = 'Failed to drop instance'
145
+ if performed?
146
+ Rails.logger.error("#{message}: #{performed?}", e)
147
+ else
148
+ Rails.logger.error(message, e)
149
+ render json: {
150
+ status: 500,
151
+ message: message
152
+ }, status: 500
153
+ end
154
+ end
155
+
122
156
  private
123
157
 
124
158
  def clear_connect_app_session
@@ -18,10 +18,29 @@ class Redis
18
18
  def self.current=(redis)
19
19
  @current = redis
20
20
  end
21
+
22
+ def self.subscriber
23
+ @subscriber ||= Redis.new
24
+ end
25
+
26
+ def self.subscriber=(redis)
27
+ @subscriber = redis
28
+ end
29
+
30
+ def self.publisher
31
+ @publisher ||= Redis.new
32
+ end
33
+
34
+ def self.publisher=(redis)
35
+ @publisher = redis
36
+ end
21
37
  end
22
38
 
23
39
  if defined?(Redis.current)
24
40
  Redis.current = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'Redis')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
41
+ Redis.subscriber = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'RedisSubscriber')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
42
+ Redis.publisher = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'RedisPublisher')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
43
+
25
44
  browser_urls['Redis'] = { "url" => redis_url }
26
45
  if defined?(Resque.redis)
27
46
  if resque_url != redis_url
data/config/routes.rb CHANGED
@@ -4,6 +4,7 @@ ZuoraConnect::Engine.routes.draw do
4
4
 
5
5
  if ENV['PROVISION_USER'].present? && ENV['PROVISION_SECRET'].present?
6
6
  post '/provision' => 'static#provision'
7
+ post '/instance/:id/drop' => 'static#instance_drop'
7
8
  get '/instance/:id/user' => 'static#instance_user'
8
9
  end
9
10
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.1.2-a"
4
+ VERSION = "3.1.4"
5
5
  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.1.2.pre.a
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-22 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -452,9 +452,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
452
452
  version: '0'
453
453
  required_rubygems_version: !ruby/object:Gem::Requirement
454
454
  requirements:
455
- - - ">"
455
+ - - ">="
456
456
  - !ruby/object:Gem::Version
457
- version: 1.3.1
457
+ version: '0'
458
458
  requirements: []
459
459
  rubygems_version: 3.3.7
460
460
  signing_key: