Class: OMF::SFA::AM::Rest::ResourceHandler

Inherits:
RestHandler
  • Object
show all
Defined in:
lib/omf-sfa/am/am-rest/resource_handler.rb

Overview

Handles an individual resource

Instance Method Summary collapse

Methods inherited from RestHandler

#call, #convert_to_html, #find_handler, #html_template, load_api_template, #on_delete, #on_get, #on_post, render_html, #render_html, service_name, set_service_name

Constructor Details

#initialize(opts = {}) ⇒ ResourceHandler

Returns a new instance of ResourceHandler.



10
11
12
13
14
15
16
17
18
# File 'lib/omf-sfa/am/am-rest/resource_handler.rb', line 10

def initialize(opts = {})
  super
  @resource_class = OMF::SFA::Resource::OComponent
  # Define handlers
  opts[:resource_handler] = self
  # @coll_handlers = {
    # projects: (opts[:project_handler] || ProjectHandler.new(opts))
  # }
end

Instance Method Details

#show_resource_list(opts) ⇒ Object

SUPPORTING FUNCTIONS



21
22
23
24
25
26
27
28
29
30
# File 'lib/omf-sfa/am/am-rest/resource_handler.rb', line 21

def show_resource_list(opts)
  authenticator = Thread.current["authenticator"]
  prefix = about = opts[:req].path
  # if project = opts[:context]
    # users = project.users
  # else
    resources = OMF::SFA::Resource::OComponent.all()
  # end
  show_resources(resources, :resources, opts)
end