[ARVADOS] created: 18358de3cd35ef29e8826f45897a3373a79de291

git at public.curoverse.com git at public.curoverse.com
Thu Mar 13 14:45:46 EDT 2014


        at  18358de3cd35ef29e8826f45897a3373a79de291 (commit)


commit 18358de3cd35ef29e8826f45897a3373a79de291
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Mar 13 14:45:40 2014 -0400

    Filters out "show", "index" and "destroy" methods from discovery document generation because they are
    redundant with "get", "list" and "delete".

diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb
index 75f015f..23706af 100644
--- a/services/api/app/controllers/arvados/v1/schema_controller.rb
+++ b/services/api/app/controllers/arvados/v1/schema_controller.rb
@@ -331,7 +331,8 @@ class Arvados::V1::SchemaController < ApplicationController
           if httpMethod and
               route.defaults[:controller] == 'arvados/v1/' + k.to_s.underscore.pluralize and
               !d_methods[action.to_sym] and
-              ctl_class.action_methods.include? action
+              ctl_class.action_methods.include? action and
+              ![:show, :index, :destroy].include?(action.to_sym)
             method = {
               id: "arvados.#{k.to_s.underscore.pluralize}.#{action}",
               path: route.path.spec.to_s.sub('/arvados/v1/','').sub('(.:format)','').sub(/:(uu)?id/,'{uuid}'),

commit 338bd17ff7567dca951a96192564537eca1c974d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Mar 13 14:44:22 2014 -0400

    Added offset to 'list' method on resources.
    Added "offset" and "limit" fields to the response.
    Removed "next_page_token" and "next_link" fields that were not being used.

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 7c10c84..7e44559 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -172,15 +172,31 @@ class ApplicationController < ActionController::Base
           where(*conditions)
       end
     end
+
     if params[:limit]
       begin
-        @objects = @objects.limit(params[:limit].to_i)
+        @limit = params[:limit].to_i
       rescue
         raise ArgumentError.new("Invalid value for limit parameter")
       end
     else
-      @objects = @objects.limit(100)
+      @limit = 100
     end
+    @objects = @objects.limit(@limit)
+
+    orders = []
+
+    if params[:offset]
+      begin
+        @objects = @objects.offset(params[:offset].to_i)
+        @offset = params[:offset].to_i
+      rescue
+        raise ArgumentError.new("Invalid value for limit parameter")
+      end
+    else
+      @offset = 0
+    end      
+
     orders = []
     if params[:order]
       params[:order].split(',').each do |order|
@@ -363,12 +379,12 @@ class ApplicationController < ActionController::Base
       :kind  => "arvados##{(@response_resource_name || resource_name).camelize(:lower)}List",
       :etag => "",
       :self_link => "",
-      :next_page_token => "",
-      :next_link => "",
+      :offset => @offset,
+      :limit => @limit,
       :items => @objects.as_api_response(nil)
     }
     if @objects.respond_to? :except
-      @object_list[:items_available] = @objects.except(:limit).count
+      @object_list[:items_available] = @objects.except(:limit).except(:offset).count
     end
     render json: @object_list
   end
diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb
index 7df2edb..75f015f 100644
--- a/services/api/app/controllers/arvados/v1/schema_controller.rb
+++ b/services/api/app/controllers/arvados/v1/schema_controller.rb
@@ -222,6 +222,14 @@ class Arvados::V1::SchemaController < ApplicationController
                   minimum: 0,
                   location: "query",
                 },
+                offset: {
+                  type: "integer",
+                  description: "Number of #{k.to_s.underscore.pluralize} to skip before first returned record.",
+                  default: 0,
+                  format: "int32",
+                  minimum: 0,
+                  location: "query",
+                },
                 where: {
                   type: "object",
                   description: "Conditions for filtering #{k.to_s.underscore.pluralize}.",

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list