Sha256: 815dd67f223961fd137d3b07d9ec3bfcd7e659bb4b5deca2424f562d3c3fb7a3

Contents?: true

Size: 818 Bytes

Versions: 4

Compression:

Stored size: 818 Bytes

Contents

module Hippo::API::Handlers

    class Tenant < Hippo::API::ControllerBase
        PUBLIC_ATTRS = %w{slug name}

        def show
            std_api_reply(:retrieve, Hippo::Tenant.current, only: PUBLIC_ATTRS)
        end

        # isn't really a create, but FE will think it's creating because we don't expose the id
        def create
            tenant = Hippo::Tenant.current
            tenant.assign_attributes(data.slice(*PUBLIC_ATTRS))
            success = tenant.save
            if success
                Hippo::Tenant.system.perform do
                    Hippo::Templates::TenantChange.create(tenant).deliver
                end
            end
            std_api_reply(:update, tenant,
                          only: PUBLIC_ATTRS,
                          success: success)
        end
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hippo-fw-0.9.5 lib/hippo/api/handlers/tenant.rb
hippo-fw-0.9.4 lib/hippo/api/handlers/tenant.rb
hippo-fw-0.9.3 lib/hippo/api/handlers/tenant.rb
hippo-fw-0.9.2 lib/hippo/api/handlers/tenant.rb