paginated 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/paginated/serialization.rb +5 -5
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 656e1f3fdd6c8b600f642a2e88fd395927ba28510a0ae8cdb2e34a4dddea25ea
|
4
|
+
data.tar.gz: 94d7e802d02e4882c1ec74cd88395a263007a31939689a06cb92ef01ee60e4d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd60a2ca45d5dbc33b085a5d6911619afcf841c2291c0976517b144e38bb41de453fd86fbc7b42ade9d38e5ff4bb307490411f69c532649e37ca78a5225fc5f2
|
7
|
+
data.tar.gz: d3197bf624354ea4127a4527e35bbdb04a5bc35b8c8a83dc42db0afbc0a50f3105aa3f03bc5c7da139c3ef98f0011b8e9d48e14bf2cc9391d5837d501258e44a
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Paginated.new.collection()
|
|
29
29
|
|
30
30
|
`fields: %i[...]` - список полей, которые должны присутствовать в списке записей (передается вместо `serializer`).
|
31
31
|
|
32
|
-
`
|
32
|
+
`entity: 'UserEntity'` - название класса Grape Entity, который обработает каждую запись (передается вместо `fields`).
|
33
33
|
|
34
34
|
`params:` - передаваемые параметры для фильтрации записей.
|
35
35
|
|
@@ -19,8 +19,8 @@ module Serialization
|
|
19
19
|
# сериализация с помощью переданных полей или сериалайзера
|
20
20
|
if @fields
|
21
21
|
serialize_with_fields
|
22
|
-
elsif @attrs[:
|
23
|
-
|
22
|
+
elsif @attrs[:entity]
|
23
|
+
serialize_with_entity
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -35,9 +35,9 @@ module Serialization
|
|
35
35
|
@objects = @objects.map { |i| @fields.zip(i).to_h }
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
|
40
|
-
@objects = @objects.map { |i|
|
38
|
+
def serialize_with_entity
|
39
|
+
entity = @attrs[:entity].constantize
|
40
|
+
@objects = @objects.map { |i| entity.represent(i).as_json }
|
41
41
|
end
|
42
42
|
|
43
43
|
def sort_proc
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paginated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Павел Бабин
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: grape
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: grape-entity
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
27
55
|
description: Простая пагинация записей и поиск для Rails-приложений
|
28
56
|
email: babin359@gmail.com
|
29
57
|
executables: []
|