Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
634cbd71
Commit
634cbd71
authored
May 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor API classes. So api classes like Gitlab::Issues become API::Issues
parent
e6224942
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
31 additions
and
31 deletions
+31
-31
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
config/routes.rb
config/routes.rb
+3
-3
lib/api/api.rb
lib/api/api.rb
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/groups.rb
lib/api/groups.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
lib/api/internal.rb
lib/api/internal.rb
+2
-2
lib/api/issues.rb
lib/api/issues.rb
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
lib/api/milestones.rb
lib/api/milestones.rb
+1
-1
lib/api/notes.rb
lib/api/notes.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+1
-1
lib/api/session.rb
lib/api/session.rb
+1
-1
lib/api/system_hooks.rb
lib/api/system_hooks.rb
+1
-1
lib/api/users.rb
lib/api/users.rb
+1
-1
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+1
-1
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+2
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+1
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+1
-1
spec/requests/api/milestones_spec.rb
spec/requests/api/milestones_spec.rb
+1
-1
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+1
-1
spec/requests/api/session_spec.rb
spec/requests/api/session_spec.rb
+1
-1
spec/requests/api/system_hooks_spec.rb
spec/requests/api/system_hooks_spec.rb
+1
-1
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+1
-1
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+1
-1
spec/support/api_helpers.rb
spec/support/api_helpers.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
634cbd71
...
...
@@ -152,7 +152,7 @@ class ApplicationController < ActionController::Base
def
add_gon_variables
gon
.
default_issues_tracker
=
Project
.
issues_tracker
.
default_value
gon
.
api_version
=
Gitlab
::
API
.
version
gon
.
api_version
=
API
::
API
.
version
gon
.
api_token
=
current_user
.
private_token
if
current_user
gon
.
gravatar_url
=
request
.
ssl?
?
Gitlab
.
config
.
gravatar
.
ssl_url
:
Gitlab
.
config
.
gravatar
.
plain_url
gon
.
relative_url_root
=
Gitlab
.
config
.
gitlab
.
relative_url_root
...
...
config/routes.rb
View file @
634cbd71
require
'sidekiq/web'
require
'api/api'
Gitlab
::
Application
.
routes
.
draw
do
#
...
...
@@ -7,9 +8,8 @@ Gitlab::Application.routes.draw do
get
'search'
=>
"search#show"
# API
require
'api'
Gitlab
::
API
.
logger
Rails
.
logger
mount
Gitlab
::
API
=>
'/api'
API
::
API
.
logger
Rails
.
logger
mount
API
::
API
=>
'/api'
constraint
=
lambda
{
|
request
|
request
.
env
[
"warden"
].
authenticate?
and
request
.
env
[
'warden'
].
user
.
admin?
}
constraints
constraint
do
...
...
lib/api.rb
→
lib/api
/api
.rb
View file @
634cbd71
Dir
[
"
#{
Rails
.
root
}
/lib/api/*.rb"
].
each
{
|
file
|
require
file
}
module
Gitlab
module
API
class
API
<
Grape
::
API
version
'v3'
,
using: :path
...
...
lib/api/entities.rb
View file @
634cbd71
module
Gitlab
module
API
module
Entities
class
User
<
Grape
::
Entity
expose
:id
,
:username
,
:email
,
:name
,
:bio
,
:skype
,
:linkedin
,
:twitter
,
...
...
lib/api/groups.rb
View file @
634cbd71
module
Gitlab
module
API
# groups API
class
Groups
<
Grape
::
API
before
{
authenticate!
}
...
...
lib/api/helpers.rb
View file @
634cbd71
module
Gitlab
module
API
module
APIHelpers
def
current_user
@current_user
||=
User
.
find_by_authentication_token
(
params
[
:private_token
]
||
env
[
"HTTP_PRIVATE_TOKEN"
])
...
...
lib/api/internal.rb
View file @
634cbd71
module
Gitlab
module
API
# Internal access API
class
Internal
<
Grape
::
API
namespace
'internal'
do
...
...
@@ -58,7 +58,7 @@ module Gitlab
get
"/check"
do
{
api_version:
Gitlab
::
API
.
version
,
api_version:
API
.
version
,
gitlab_version:
Gitlab
::
VERSION
,
gitlab_rev:
Gitlab
::
REVISION
,
}
...
...
lib/api/issues.rb
View file @
634cbd71
module
Gitlab
module
API
# Issues API
class
Issues
<
Grape
::
API
before
{
authenticate!
}
...
...
lib/api/merge_requests.rb
View file @
634cbd71
module
Gitlab
module
API
# MergeRequest API
class
MergeRequests
<
Grape
::
API
before
{
authenticate!
}
...
...
lib/api/milestones.rb
View file @
634cbd71
module
Gitlab
module
API
# Milestones API
class
Milestones
<
Grape
::
API
before
{
authenticate!
}
...
...
lib/api/notes.rb
View file @
634cbd71
module
Gitlab
module
API
# Notes API
class
Notes
<
Grape
::
API
before
{
authenticate!
}
...
...
lib/api/projects.rb
View file @
634cbd71
module
Gitlab
module
API
# Projects API
class
Projects
<
Grape
::
API
before
{
authenticate!
}
...
...
lib/api/session.rb
View file @
634cbd71
module
Gitlab
module
API
# Users API
class
Session
<
Grape
::
API
# Login to get token
...
...
lib/api/system_hooks.rb
View file @
634cbd71
module
Gitlab
module
API
# Hooks API
class
SystemHooks
<
Grape
::
API
before
{
...
...
lib/api/users.rb
View file @
634cbd71
module
Gitlab
module
API
# Users API
class
Users
<
Grape
::
API
before
{
authenticate!
}
...
...
spec/requests/api/groups_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user1
)
{
create
(
:user
)
}
...
...
spec/requests/api/internal_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -12,7 +12,7 @@ describe Gitlab::API do
get
api
(
"/internal/check"
)
response
.
status
.
should
==
200
json_response
[
'api_version'
].
should
==
Gitlab
::
API
.
version
json_response
[
'api_version'
].
should
==
API
::
API
.
version
end
end
...
...
spec/requests/api/issues_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/requests/api/merge_requests_spec.rb
View file @
634cbd71
require
"spec_helper"
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/requests/api/milestones_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
enable_observers
}
...
...
spec/requests/api/notes_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/requests/api/projects_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
enable_observers
}
...
...
spec/requests/api/session_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/requests/api/system_hooks_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/requests/api/users_spec.rb
View file @
634cbd71
require
'spec_helper'
describe
Gitlab
::
API
do
describe
API
::
API
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/routing/routing_spec.rb
View file @
634cbd71
...
...
@@ -7,7 +7,7 @@ describe SearchController, "routing" do
end
end
# gitlab_api /api
Gitlab
::API
# gitlab_api /api
API
::API
# resque /info/resque Resque::Server
# /:path Grack
describe
"Mounted Apps"
,
"routing"
do
...
...
spec/support/api_helpers.rb
View file @
634cbd71
...
...
@@ -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/
#{
API
::
API
.
version
}#{
path
}
"
+
# Normalize query string
(
path
.
index
(
'?'
)
?
''
:
'?'
)
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment