Sha256: 162c1ec082a1dd8057bac0b2014f1dfd2a0392b40291028739e764c3ef479fa0

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

class BrandAliasesHandler < BaseHandler
    def mount
        @server.mount_proc('/brand/aliases') do |req, res|
            if req.request_method == 'GET'
                begin
                    aliases = get_brand_aliases
                    res.status = 200
                    res.body = JSON.generate({ success: true, aliases: aliases })

                rescue StandardError => e
                    handle_error(res, e, "Error fetching brand aliases")
                end
            else
                method_not_allowed(res)
            end
            res.content_type = 'application/json'
        end
    end

    def get_brand_aliases
        AliasGeneratorManager.aliases_json
    rescue StandardError => e
        Solara.logger.failure("Error getting brand aliases: #{e.message}")
        raise
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solara-0.2.2 solara/lib/core/dashboard/handler/brand_alisases_handler.rb
solara-0.2.1 solara/lib/core/dashboard/handler/brand_alisases_handler.rb