rename Metadatum to Link, head to head_uuid, tail to tail_uuid
authorTom Clegg <tom@clinicalfuture.com>
Mon, 28 Jan 2013 21:19:08 +0000 (13:19 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Mon, 28 Jan 2013 21:20:14 +0000 (13:20 -0800)
14 files changed:
app/assets/javascripts/links.js.coffee [moved from app/assets/javascripts/metadata.js.coffee with 100% similarity]
app/assets/stylesheets/links.css.scss [moved from app/assets/stylesheets/metadata.css.scss with 63% similarity]
app/controllers/application_controller.rb
app/controllers/links_controller.rb [moved from app/controllers/metadata_controller.rb with 100% similarity]
app/helpers/links_helper.rb [new file with mode: 0644]
app/helpers/metadata_helper.rb [deleted file]
app/models/link.rb [new file with mode: 0644]
app/models/metadatum.rb [deleted file]
app/models/orvos_base.rb
config/routes.rb
test/fixtures/links.yml [moved from test/fixtures/metadata.yml with 100% similarity]
test/functional/links_controller_test.rb [moved from test/functional/metadata_controller_test.rb with 100% similarity]
test/unit/helpers/links_helper_test.rb [moved from test/unit/helpers/metadata_helper_test.rb with 100% similarity]
test/unit/link_test.rb [moved from test/unit/metadatum_test.rb with 100% similarity]

similarity index 63%
rename from app/assets/stylesheets/metadata.css.scss
rename to app/assets/stylesheets/links.css.scss
index bcefd20cdff950c47ec6679131e256fe1ecb89a2..220eb7091fa783ec5716ce111c69d89f9576833d 100644 (file)
@@ -1,3 +1,3 @@
-// Place all the styles related to the Metadata controller here.
+// Place all the styles related to the Links controller here.
 // They will automatically be included in application.css.
 // You can use Sass (SCSS) here: http://sass-lang.com/
index e3f006b57692f3a40314c35b56427d2edc50751d..5dfb8bc8436e99b92dfee9be5ded1b49cc0d350f 100644 (file)
@@ -123,6 +123,6 @@ class ApplicationController < ActionController::Base
   end
 
   def verify_api_token
-    Metadatum.where(uuid: 'the-philosophers-stone').size rescue false
+    Link.where(uuid: 'the-philosophers-stone').size rescue false
   end
 end
diff --git a/app/helpers/links_helper.rb b/app/helpers/links_helper.rb
new file mode 100644 (file)
index 0000000..f6bc988
--- /dev/null
@@ -0,0 +1,2 @@
+module LinksHelper
+end
diff --git a/app/helpers/metadata_helper.rb b/app/helpers/metadata_helper.rb
deleted file mode 100644 (file)
index 300d90e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-module MetadataHelper
-end
diff --git a/app/models/link.rb b/app/models/link.rb
new file mode 100644 (file)
index 0000000..4110261
--- /dev/null
@@ -0,0 +1,5 @@
+class Link < OrvosBase
+  def self.by_tail(t, opts={})
+    where(opts.merge :tail_kind => t.kind, :tail_uuid => t.uuid)
+  end
+end
diff --git a/app/models/metadatum.rb b/app/models/metadatum.rb
deleted file mode 100644 (file)
index 9b8fab4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-class Metadatum < OrvosBase
-  def self.by_tail(t, opts={})
-    where(opts.merge :tail_kind => t.kind, :tail => t.uuid)
-  end
-end
index c3029fd8a5f9c990983fad0d3db6d9b05f10c316..e4eff9c93aa37ed6e587d47b70ba172538731dd2 100644 (file)
@@ -57,16 +57,16 @@ class OrvosBase < ActiveRecord::Base
   def save!
     self.save or raise Exception.new("Save failed")
   end
-  def metadata(*args)
+  def links(*args)
     o = {}
     o.merge!(args.pop) if args[-1].is_a? Hash
-    o[:metadata_class] ||= args.shift
+    o[:link_class] ||= args.shift
     o[:name] ||= args.shift
     o[:head_kind] ||= args.shift
     o[:tail_kind] = self.kind
-    o[:tail] = self.uuid
-    if all_metadata
-      return all_metadata.select do |m|
+    o[:tail_uuid] = self.uuid
+    if all_links
+      return all_links.select do |m|
         ok = true
         o.each do |k,v|
           if !v.nil?
@@ -79,20 +79,20 @@ class OrvosBase < ActiveRecord::Base
         ok
       end
     end
-    @metadata = $orvos_api_client.api Metadatum, '', { _method: 'GET', where: o, eager: true }
-    @metadata = $orvos_api_client.unpack_api_response(@metadata)
+    @links = $orvos_api_client.api Link, '', { _method: 'GET', where: o, eager: true }
+    @links = $orvos_api_client.unpack_api_response(@links)
   end
-  def all_metadata
-    return @all_metadata if @all_metadata
-    res = $orvos_api_client.api Metadatum, '', {
+  def all_links
+    return @all_links if @all_links
+    res = $orvos_api_client.api Link, '', {
       _method: 'GET',
       where: {
         tail_kind: self.kind,
-        tail: self.uuid
+        tail_uuid: self.uuid
       },
       eager: true
     }
-    @all_metadata = $orvos_api_client.unpack_api_response(res)
+    @all_links = $orvos_api_client.unpack_api_response(res)
   end
   def reload
     private_reload(self.uuid)
@@ -118,7 +118,7 @@ class OrvosBase < ActiveRecord::Base
         end
       end
     end
-    @all_metadata = nil
+    @all_links = nil
     self
   end
   def dup
index c67b601432bb7cd67d5db36de5c0f30eab1ba2e0..77f116801c6ab16f53b0eec62841d9f29613f89e 100644 (file)
@@ -20,7 +20,7 @@ Vcffarm::Application.routes.draw do
   resources :pipeline_invocations
 
 
-  resources :metadata
+  resources :links
 
 
   resources :collections
@@ -29,7 +29,7 @@ Vcffarm::Application.routes.draw do
 
   # Send unroutable requests to an arbitrary controller
   # (ends up at ApplicationController#render_not_found)
-  match '*a', :to => 'metadata#render_not_found'
+  match '*a', :to => 'links#render_not_found'
 
 
   # The priority is based upon order of creation: