myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2231] trunk: Modified REST API so that it adds l


From: noreply
Subject: [myexperiment-hackers] [2231] trunk: Modified REST API so that it adds license_id rather than license to workflows and files .
Date: Tue, 16 Jun 2009 10:30:51 -0400 (EDT)

Revision
2231
Author
drn05r
Date
2009-06-16 10:30:50 -0400 (Tue, 16 Jun 2009)

Log Message

Modified REST API so that it adds license_id rather than license to workflows and files.
Added GET license and GET licenses API calls.

Modified Paths

Diff

Modified: trunk/config/tables.xml


(Binary files differ)

Modified: trunk/lib/rest.rb (2230 => 2231)


--- trunk/lib/rest.rb	2009-06-16 13:02:22 UTC (rev 2230)
+++ trunk/lib/rest.rb	2009-06-16 14:30:50 UTC (rev 2231)
@@ -560,6 +560,7 @@
     when 'PackContributableEntry'; return rest_resource_uri(ob.contributable)
     when 'PackRemoteEntry';        return ob.uri
     when 'ContentType';            return nil
+    when 'License';                return license_url(ob)
 
     when 'Creditation';     return nil
     when 'Attribution';     return nil
@@ -600,6 +601,7 @@
     when 'PackRemoteEntry';        return "#{base}/external-pack-item.xml?id=#{ob.id}"
     when 'Tagging';                return "#{base}/tagging.xml?id=#{ob.id}"
     when 'ContentType';            return "#{base}/type.xml?id=#{ob.id}"
+    when 'License';                return "#{base}/license.xml?id=#{ob.id}"
 
     when 'Creditation';     return "#{base}/credit.xml?id=#{ob.id}"
     when 'Attribution';     return nil
@@ -632,6 +634,7 @@
     when 'Comment';                return 'comment'
     when 'Bookmark';               return 'favourite'
     when 'ContentType';            return 'type'
+    when 'License';                return 'license'
   end
 
   return 'object'
@@ -657,6 +660,7 @@
     when 'PackRemoteEntry';        return ob.title     
     when 'Workflow::Version';      return ob.title
     when 'ContentType';            return ob.title
+    when 'License';                return ob.title
   end
 
   return ''
@@ -863,8 +867,16 @@
 
     ob.title        = title        if title
     ob.body         = description  if description
-    ob.license      = license_type if license_type
+    #ob.license_id   = License.find_by_unique_name(license_type) if license_type
 
+    if license_type
+      ob.license = License.find_by_unique_name(license_type)
+      if ob.license.nil?
+        ob.errors.add("License type")
+        return rest_response(400, :object => ob)
+      end
+    end
+   
     # handle workflow type
 
     if type

reply via email to

[Prev in Thread] Current Thread [Next in Thread]