BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
81eb5c7f
Commit
81eb5c7f
authored
Feb 06, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move serializers pagination class to separate module
This helps to avoid conflicts with `Paginator` class that seems to be used by some bundled libs.
parent
10c1a4d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
17 deletions
+21
-17
environment_serializer.rb
app/serializers/environment_serializer.rb
+1
-1
pipeline_serializer.rb
app/serializers/pipeline_serializer.rb
+1
-1
pagination.rb
lib/gitlab/serializer/pagination.rb
+19
-15
No files found.
app/serializers/environment_serializer.rb
View file @
81eb5c7f
...
@@ -8,7 +8,7 @@ class EnvironmentSerializer < BaseSerializer
...
@@ -8,7 +8,7 @@ class EnvironmentSerializer < BaseSerializer
end
end
def
with_pagination
(
request
,
response
)
def
with_pagination
(
request
,
response
)
tap
{
@paginator
=
Paginator
.
new
(
request
,
response
)
}
tap
{
@paginator
=
Gitlab
::
Serializer
::
Pagination
.
new
(
request
,
response
)
}
end
end
def
itemized?
def
itemized?
...
...
app/serializers/pipeline_serializer.rb
View file @
81eb5c7f
...
@@ -4,7 +4,7 @@ class PipelineSerializer < BaseSerializer
...
@@ -4,7 +4,7 @@ class PipelineSerializer < BaseSerializer
entity
PipelineEntity
entity
PipelineEntity
def
with_pagination
(
request
,
response
)
def
with_pagination
(
request
,
response
)
tap
{
@paginator
=
Paginator
.
new
(
request
,
response
)
}
tap
{
@paginator
=
Gitlab
::
Serializer
::
Pagination
.
new
(
request
,
response
)
}
end
end
def
paginated?
def
paginated?
...
...
app/serializers/paginator
.rb
→
lib/gitlab/serializer/pagination
.rb
View file @
81eb5c7f
class
Paginator
module
Gitlab
include
API
::
Helpers
::
Pagination
module
Serializer
class
Pagination
include
::
API
::
Helpers
::
Pagination
def
initialize
(
request
,
response
)
def
initialize
(
request
,
response
)
@request
=
request
@request
=
request
@response
=
response
@response
=
response
end
end
private
private
# Methods needed by `API::Helpers::Pagination`
# Methods needed by `API::Helpers::Pagination`
#
#
attr_reader
:request
attr_reader
:request
def
params
def
params
@request
.
query_parameters
@request
.
query_parameters
end
end
def
header
(
header
,
value
)
def
header
(
header
,
value
)
@response
.
headers
[
header
]
=
value
@response
.
headers
[
header
]
=
value
end
end
end
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