From: Tom Clegg Date: Wed, 16 Jan 2013 02:55:17 +0000 (-0800) Subject: add Specimen resource X-Git-Tag: 1.1.0~3509 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/dde9d7d5609fcd982d1d0c8502a0114ef3fb45de add Specimen resource --- diff --git a/app/assets/javascripts/specimens.js.coffee b/app/assets/javascripts/specimens.js.coffee new file mode 100644 index 0000000000..761567942f --- /dev/null +++ b/app/assets/javascripts/specimens.js.coffee @@ -0,0 +1,3 @@ +# 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/ diff --git a/app/assets/stylesheets/specimens.css.scss b/app/assets/stylesheets/specimens.css.scss new file mode 100644 index 0000000000..460e42e180 --- /dev/null +++ b/app/assets/stylesheets/specimens.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Specimens controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/orvos/v1/specimens_controller.rb b/app/controllers/orvos/v1/specimens_controller.rb new file mode 100644 index 0000000000..22620df5e9 --- /dev/null +++ b/app/controllers/orvos/v1/specimens_controller.rb @@ -0,0 +1,2 @@ +class Orvos::V1::SpecimensController < ApplicationController +end diff --git a/app/helpers/specimens_helper.rb b/app/helpers/specimens_helper.rb new file mode 100644 index 0000000000..8c30d973ab --- /dev/null +++ b/app/helpers/specimens_helper.rb @@ -0,0 +1,2 @@ +module SpecimensHelper +end diff --git a/app/models/specimen.rb b/app/models/specimen.rb new file mode 100644 index 0000000000..a7de822bd7 --- /dev/null +++ b/app/models/specimen.rb @@ -0,0 +1,9 @@ +class Specimen < ActiveRecord::Base + include AssignUuid + include KindAndEtag + include CommonApiTemplate + + api_accessible :superuser, :extend => :common do |t| + t.add :material + end +end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 9e8b0131f8..7f100f3604 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -8,3 +8,8 @@ # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end + +ActiveSupport::Inflector.inflections do |inflect| + inflect.plural /^(specimen)$/i, '\1s' + inflect.singular /^(specimen)s/i, '\1' +end diff --git a/config/routes.rb b/config/routes.rb index 8acc5bb6f5..bbfbe862f8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Server::Application.routes.draw do + resources :specimens resources :collections resources :metadata resources :nodes @@ -70,6 +71,7 @@ Server::Application.routes.draw do resources :pipelines resources :pipeline_invocations resources :pipelineInvocations + resources :specimens match '/schema' => 'schema#show' match '/nodes/:uuid/ping' => 'nodes#ping', :as => :ping_node match '/metadata/:target_kind/:target_uuid' => 'metadata#index' diff --git a/db/migrate/20130116024233_create_specimens.rb b/db/migrate/20130116024233_create_specimens.rb new file mode 100644 index 0000000000..443369e7bd --- /dev/null +++ b/db/migrate/20130116024233_create_specimens.rb @@ -0,0 +1,20 @@ +class CreateSpecimens < ActiveRecord::Migration + def up + create_table :specimens 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 :material + + t.timestamps + end + add_index :specimens, :uuid, :unique => true + end + def down + drop_table :specimens + end +end diff --git a/db/schema.rb b/db/schema.rb index aa21ec4c6c..9d2c4297fe 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130113214204) do +ActiveRecord::Schema.define(:version => 20130116024233) do create_table "collections", :force => true do |t| t.string "locator" @@ -109,4 +109,18 @@ ActiveRecord::Schema.define(:version => 20130113214204) do add_index "pipelines", ["uuid"], :name => "index_pipelines_on_uuid", :unique => true + create_table "specimens", :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 "material" + t.datetime "updated_at" + end + + add_index "specimens", ["uuid"], :name => "index_specimens_on_uuid", :unique => true + end diff --git a/test/fixtures/specimens.yml b/test/fixtures/specimens.yml new file mode 100644 index 0000000000..6254218df8 --- /dev/null +++ b/test/fixtures/specimens.yml @@ -0,0 +1,21 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + uuid: MyString + created_at: 2013-01-15 18:42:33 + created_by_client: MyString + created_by_user: MyString + modified_at: 2013-01-15 18:42:33 + modified_by_client: MyString + modified_by_user: MyString + material: MyString + +two: + uuid: MyString + created_at: 2013-01-15 18:42:33 + created_by_client: MyString + created_by_user: MyString + modified_at: 2013-01-15 18:42:33 + modified_by_client: MyString + modified_by_user: MyString + material: MyString diff --git a/test/functional/specimens_controller_test.rb b/test/functional/specimens_controller_test.rb new file mode 100644 index 0000000000..8401ecc8eb --- /dev/null +++ b/test/functional/specimens_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SpecimensControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/specimens_helper_test.rb b/test/unit/helpers/specimens_helper_test.rb new file mode 100644 index 0000000000..825af25e24 --- /dev/null +++ b/test/unit/helpers/specimens_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SpecimensHelperTest < ActionView::TestCase +end diff --git a/test/unit/specimen_test.rb b/test/unit/specimen_test.rb new file mode 100644 index 0000000000..a9abc8c776 --- /dev/null +++ b/test/unit/specimen_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SpecimenTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end