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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6b76d9be
Commit
6b76d9be
authored
Feb 15, 2020
by
Rajendra Kadam
Committed by
Stan Hu
Feb 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate token into own class files
parent
925f3613
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
30 deletions
+55
-30
changelogs/unreleased/refactoring-entities-file-25.yml
changelogs/unreleased/refactoring-entities-file-25.yml
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+0
-30
lib/api/entities/feature.rb
lib/api/entities/feature.rb
+22
-0
lib/api/entities/feature_gate.rb
lib/api/entities/feature_gate.rb
+10
-0
lib/api/entities/impersonation_token.rb
lib/api/entities/impersonation_token.rb
+9
-0
lib/api/entities/impersonation_token_with_token.rb
lib/api/entities/impersonation_token_with_token.rb
+9
-0
No files found.
changelogs/unreleased/refactoring-entities-file-25.yml
0 → 100644
View file @
6b76d9be
---
title
:
Separate token entities into own class files
merge_request
:
24974
author
:
Rajendra Kadam
type
:
added
lib/api/entities.rb
View file @
6b76d9be
...
...
@@ -169,36 +169,6 @@ module API
expose
:last_pipeline
,
using:
Entities
::
PipelineBasic
expose
:variables
,
using:
Entities
::
Variable
end
class
ImpersonationToken
<
PersonalAccessToken
expose
:impersonation
end
class
ImpersonationTokenWithToken
<
PersonalAccessTokenWithToken
expose
:impersonation
end
class
FeatureGate
<
Grape
::
Entity
expose
:key
expose
:value
end
class
Feature
<
Grape
::
Entity
expose
:name
expose
:state
expose
:gates
,
using:
FeatureGate
do
|
model
|
model
.
gates
.
map
do
|
gate
|
value
=
model
.
gate_values
[
gate
.
key
]
# By default all gate values are populated. Only show relevant ones.
if
(
value
.
is_a?
(
Integer
)
&&
value
.
zero?
)
||
(
value
.
is_a?
(
Set
)
&&
value
.
empty?
)
next
end
{
key:
gate
.
key
,
value:
value
}
end
.
compact
end
end
end
end
...
...
lib/api/entities/feature.rb
0 → 100644
View file @
6b76d9be
# frozen_string_literal: true
module
API
module
Entities
class
Feature
<
Grape
::
Entity
expose
:name
expose
:state
expose
:gates
,
using:
Entities
::
FeatureGate
do
|
model
|
model
.
gates
.
map
do
|
gate
|
value
=
model
.
gate_values
[
gate
.
key
]
# By default all gate values are populated. Only show relevant ones.
if
(
value
.
is_a?
(
Integer
)
&&
value
.
zero?
)
||
(
value
.
is_a?
(
Set
)
&&
value
.
empty?
)
next
end
{
key:
gate
.
key
,
value:
value
}
end
.
compact
end
end
end
end
lib/api/entities/feature_gate.rb
0 → 100644
View file @
6b76d9be
# frozen_string_literal: true
module
API
module
Entities
class
FeatureGate
<
Grape
::
Entity
expose
:key
expose
:value
end
end
end
lib/api/entities/impersonation_token.rb
0 → 100644
View file @
6b76d9be
# frozen_string_literal: true
module
API
module
Entities
class
ImpersonationToken
<
Entities
::
PersonalAccessToken
expose
:impersonation
end
end
end
lib/api/entities/impersonation_token_with_token.rb
0 → 100644
View file @
6b76d9be
# frozen_string_literal: true
module
API
module
Entities
class
ImpersonationTokenWithToken
<
Entities
::
PersonalAccessTokenWithToken
expose
:impersonation
end
end
end
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