zuora_connect 3.1.2 → 3.1.3

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: 7e7d747f5419f91b21caca64a6e6a23cba1d35f0698c6bb2ad1a675ef30cfecb
4
- data.tar.gz: 8375c348a777bfb628cc0bda0f5feca421ac7366e6b1d9adaa46677de9705b69
3
+ metadata.gz: 669d11bc2e10ece9fb5f4d014b412739545cf7d17c6858b0588f8d6c566be41e
4
+ data.tar.gz: a077b09e7c4e5e3bdb10742c99100a11842d6d5bb31ca520a97d44c8e9ac51c0
5
5
  SHA512:
6
- metadata.gz: b676e5e8922bd5b1b8de5955391b12be819498a6a9e6b0e0a7c04a0484d08891dd1f3cf26c4bb6d762c8cea9eb1851566035a2af8c44d8b998d033ec0d7be0af
7
- data.tar.gz: 88883530f0a643369c645e47ed7ed545f5088cf904af9d92c31ca320527bc19cae8773169067cf339abb68c251299b8e9f10a1dd0874d3d9b0d7e30bc208f428
6
+ metadata.gz: b043fa5b788040e781843eb2c2f20aba5a7b2d1f8d014e89ac31aa3574a451473dd1d89a08d479f71215f6f386d288e5fdb315316fcf31de8121d39224778d7c
7
+ data.tar.gz: f151cb64ecddc869299c25f9a1012601ededb097e469fd86a060ca0c8b82e074559df24724600880a8afea9f3995550c9c504af311d1e24248fbdcfaa6013197
@@ -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
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
 
@@ -2,15 +2,18 @@ namespace :db do
2
2
  desc 'Also create shared_extensions Schema'
3
3
  task :extensions => :environment do
4
4
  # Create Schema
5
- at_exit {
6
- ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;'
7
- # Enable Hstore
8
- ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS HSTORE SCHEMA shared_extensions;'
9
- # Enable UUID-OSSP
10
- ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA shared_extensions;'
11
- }
5
+ ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;'
6
+ # Enable Hstore
7
+ ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS HSTORE SCHEMA shared_extensions;'
8
+ # Enable UUID-OSSP
9
+ ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA shared_extensions;'
12
10
  end
13
11
  end
14
12
 
15
- Rake::Task["db:create"].enhance [:extensions]
16
- Rake::Task["db:test:purge"].enhance [:extensions]
13
+ Rake::Task["db:create"].enhance do
14
+ Rake::Task["db:extensions"].invoke
15
+ end
16
+
17
+ Rake::Task["db:test:purge"].enhance do
18
+ Rake::Task["db:extensions"].invoke
19
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.1.2"
4
+ VERSION = "3.1.3"
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
4
+ version: 3.1.3
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-21 00:00:00.000000000 Z
11
+ date: 2022-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment