--- /dev/null
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
--- /dev/null
+// Place all the styles related to the Pipelines controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
render json: @object
end
+ def create
+ @attrs = params[resource_name]
+ if @attrs.class == String
+ @attrs = uncamelcase_hash_keys(JSON.parse @attrs)
+ end
+ @object = model_class.new @attrs
+ @object.save
+ show
+ end
+
protected
def model_class
controller_name.classify.constantize
end
+ def resource_name # params[] key used by client
+ controller_name.classify.camelcase(:lower)
+ end
+
def find_object_by_uuid
logger.info params.inspect
@object = model_class.where('uuid=?', params[:uuid]).first
def render_list
@object_list = {
- :kind => "orvos##{model_class.to_s.camelize(:down)}List",
+ :kind => "orvos##{resource_name}List",
:etag => "",
:self_link => "",
:next_page_token => "",
--- /dev/null
+class Orvos::V1::PipelinesController < ApplicationController
+end
--- /dev/null
+module PipelinesHelper
+end
--- /dev/null
+class Pipeline < ActiveRecord::Base
+ include AssignUuid
+ serialize :components, Hash
+end
Server::Application.routes.draw do
+ resources :pipelines
resources :nodes
resources :collections
resources :metadata
resources :collections
resources :metadata
resources :nodes
+ resources :pipelines
match '/nodes/:uuid/ping' => 'nodes#ping', :as => :ping_node
match '/metadata/:target_kind/:target_uuid' => 'metadata#index'
end
--- /dev/null
+class CreatePipelines < ActiveRecord::Migration
+ def up
+ create_table :pipelines do |t|
+ t.string :uuid
+ t.string :created_by_client
+ t.string :created_by_user
+ t.datetime :created_at
+ t.string :modified_by_client
+ t.string :modified_by_user
+ t.datetime :modified_at
+ t.string :name
+ t.text :components
+
+ t.timestamps
+ end
+ add_index :pipelines, :uuid, :unique => true
+ end
+ def down
+ drop_table :pipelines
+ end
+end
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130107212832) do
+ActiveRecord::Schema.define(:version => 20130109175700) do
create_table "collections", :force => true do |t|
t.string "locator"
add_index "nodes", ["slot_number"], :name => "index_nodes_on_slot_number", :unique => true
add_index "nodes", ["uuid"], :name => "index_nodes_on_uuid", :unique => true
+ create_table "pipelines", :force => true do |t|
+ t.string "uuid"
+ t.string "created_by_client"
+ t.string "created_by_user"
+ t.datetime "created_at"
+ t.string "modified_by_client"
+ t.string "modified_by_user"
+ t.datetime "modified_at"
+ t.string "name"
+ t.text "components"
+ t.datetime "updated_at"
+ end
+
+ add_index "pipelines", ["uuid"], :name => "index_pipelines_on_uuid", :unique => true
+
end
--- /dev/null
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
--- /dev/null
+require 'test_helper'
+
+class PipelinesControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
--- /dev/null
+require 'test_helper'
+
+class PipelinesHelperTest < ActionView::TestCase
+end
--- /dev/null
+require 'test_helper'
+
+class PipelineTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end