OSDN Git Service

API version returns last version set
authorNihad Abbasov <narkoz.2008@gmail.com>
Thu, 29 Nov 2012 21:42:22 +0000 (13:42 -0800)
committerNihad Abbasov <narkoz.2008@gmail.com>
Sat, 1 Dec 2012 10:03:51 +0000 (02:03 -0800)
  * fixed in grape v0.2.2

lib/api.rb
spec/support/api_helpers.rb

index 99e2074..d01d534 100644 (file)
@@ -2,8 +2,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
 
 module Gitlab
   class API < Grape::API
-    VERSION = 'v2'
-    version VERSION, using: :path
+    version 'v2', using: :path
 
     rescue_from ActiveRecord::RecordNotFound do
       rack_response({'message' => '404 Not found'}.to_json, 404)
index 7d90119..c4514bf 100644 (file)
@@ -18,7 +18,7 @@ module ApiHelpers
   #
   # Returns the relative path to the requested API resource
   def api(path, user = nil)
-    "/api/#{Gitlab::API::VERSION}#{path}" +
+    "/api/#{Gitlab::API.version}#{path}" +
 
       # Normalize query string
       (path.index('?') ? '' : '?') +