grape_serializer 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grape_serializer.rb +1 -0
- data/lib/list_entity.rb +29 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec5780f05eec17c12e08c6b1019b01dffa10bb2ab6f84d3b6aed4c7599cfc9c9
|
4
|
+
data.tar.gz: 663ee82abe66d374bbe27e829eeb260af807feb841c1e6b6f924cb07814c85c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e37dfa59c2d90146b2db5f235358522c9d12e6b2515cc7885b95222ce71be2899f0b1aeb10d7833e1d59e7fab75ccaed70fa686e345339c08948fc703533840
|
7
|
+
data.tar.gz: 510d83ef0942faecdd8fd044e6e201f3816099c8369ddd6d56b0929dc7c581ac93c59350ea635ad674e2a69959125ce2d4f639ad8d310121858a008e0020dc71
|
data/lib/grape_serializer.rb
CHANGED
data/lib/list_entity.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
class ListEntity < ServiceEntity
|
2
|
+
|
3
|
+
def self.inherited(subclass)
|
4
|
+
subclass.present_collection true
|
5
|
+
|
6
|
+
subclass.expose :total_count
|
7
|
+
subclass.expose :current_page
|
8
|
+
subclass.expose :total_pages
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def pagination_items
|
14
|
+
object[:items]
|
15
|
+
end
|
16
|
+
|
17
|
+
def total_count
|
18
|
+
pagination_items.total_count
|
19
|
+
end
|
20
|
+
|
21
|
+
def current_page
|
22
|
+
pagination_items.current_page
|
23
|
+
end
|
24
|
+
|
25
|
+
def total_pages
|
26
|
+
pagination_items.total_pages
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JiaRou Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape-entity
|
@@ -32,6 +32,7 @@ extra_rdoc_files: []
|
|
32
32
|
files:
|
33
33
|
- lib/grape_response.rb
|
34
34
|
- lib/grape_serializer.rb
|
35
|
+
- lib/list_entity.rb
|
35
36
|
- lib/service_entity.rb
|
36
37
|
homepage: https://github.com/kdan-mobile-software-ltd/grape_serializer
|
37
38
|
licenses:
|