Class: Api::V1::AppInstanceController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/zuora_connect/api/v1/app_instance_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
# File 'app/controllers/zuora_connect/api/v1/app_instance_controller.rb', line 6

def create
  Apartment::Tenant.create(session['AppInstance'])
  respond_to do |format|
    format.json {render :json => "Created"}
  end
end

#dropObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/zuora_connect/api/v1/app_instance_controller.rb', line 13

def drop
  instance_id = @appinstance.id
  if session["#{instance_id}::destroy"] && ZuoraConnect::AppInstance.where(:id => instance_id).size != 0
    ZuoraConnect::AppInstance.destroy(instance_id)
    msg = Apartment::Tenant.drop(instance_id)
    respond_to do |format|
      message = Hash.new
      message = {"error" => {:message => msg.error_message}} if msg.error_message != ""
      message["message"] = msg.result_status == 1 ? "success" : "error"
      format.json {render :json => message}
    end
  else
    respond_to do |format|
      format.json {render :json => { "message" => "Unauthorized"}}
    end
  end
end

#statusObject



31
32
33
34
# File 'app/controllers/zuora_connect/api/v1/app_instance_controller.rb', line 31

def status


end