Module: Hope::Server::Resources::Source

Defined in:
lib/hope/server/resources/source.rb

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hope/server/resources/source.rb', line 6

def self.registered app

  app.get "/sources" do
    respond_with Hope::Source.sources.values.map(&:serializable_hash)
  end

  app.post "/sources" do
    source_type = body["type"]
    source_class = Hope::Source.const_get(source_type)
    src = source_class.new(body["name"], body["opts"])
  end
  
end