Class: Hippo::API::Handlers::Tenant

Inherits:
ControllerBase show all
Defined in:
lib/hippo/api/handlers/tenant.rb

Instance Attribute Summary

Attributes inherited from ControllerBase

#data, #model, #params

Instance Method Summary collapse

Methods inherited from ControllerBase

#initialize

Methods included from FormattedReply

#json_status_str, #record_active_record_errors, #records_for_reply, #std_api_reply

Constructor Details

This class inherits a constructor from Hippo::API::ControllerBase

Instance Method Details

#showObject


5
6
7
# File 'lib/hippo/api/handlers/tenant.rb', line 5

def show
    std_api_reply(:retrieve, Hippo::Tenant.current.bootstrap_data, success: true)
end

#updateObject


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hippo/api/handlers/tenant.rb', line 9

def update
    tenant = Hippo::Tenant.current
    tenant.assign_attributes(data.slice(*Hippo::Tenant::PUBLIC_ATTRS))
    success = tenant.save
    if success && tenant.slug_previously_changed?
        Hippo::Tenant.system.perform do
            Hippo::Templates::TenantChange.create(tenant).deliver
        end
    end
    std_api_reply(:update, tenant,
                  only: Hippo::Tenant::PUBLIC_ATTRS,
                  success: success)
end