Method: Orchestrator::Api::SystemsController#funcs

Defined in:
app/controllers/orchestrator/api/systems_controller.rb

#funcsObject

returns a list of functions available to call



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'app/controllers/orchestrator/api/systems_controller.rb', line 158

def funcs
    params.require(:module)
    sys = System.get(id)
    if sys
        para = params.permit(:module, :index)
        index = para[:index]
        index = index.nil? ? 0 : (index.to_i - 1);

        mod = sys.get(para[:module].to_sym, index)
        if mod
            funcs = mod.instance.public_methods(false)
            priv = []
            funcs.each do |func|
                if ::Orchestrator::Core::PROTECTED[func]
                    priv << func
                end
            end
            render json: (funcs - priv)
        else
            render nothing: true, status: :not_found
        end
    else
        render nothing: true, status: :not_found
    end
end