grape_serializer 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/list_entity.rb +15 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec5780f05eec17c12e08c6b1019b01dffa10bb2ab6f84d3b6aed4c7599cfc9c9
4
- data.tar.gz: 663ee82abe66d374bbe27e829eeb260af807feb841c1e6b6f924cb07814c85c6
3
+ metadata.gz: 6e4c68d3adfb3518cffdcd294ca2b0d7b1ef828afd09fc8af8fae89296f36e92
4
+ data.tar.gz: 8c09ad8e4ec38069d4deb3bc69d057ffbb0a930871094949efa7e6b85017a9f1
5
5
  SHA512:
6
- metadata.gz: 5e37dfa59c2d90146b2db5f235358522c9d12e6b2515cc7885b95222ce71be2899f0b1aeb10d7833e1d59e7fab75ccaed70fa686e345339c08948fc703533840
7
- data.tar.gz: 510d83ef0942faecdd8fd044e6e201f3816099c8369ddd6d56b0929dc7c581ac93c59350ea635ad674e2a69959125ce2d4f639ad8d310121858a008e0020dc71
6
+ metadata.gz: 5db0cf312dc08b04e40a5a6888f0e10e20d3bb85c3f97eb7403dda9117dbfbec5e13a92b4778a0ac7b72892c27038fcd70128626f9997062b0bcd8d9e51fde81
7
+ data.tar.gz: c1ed3468512a73894c2f328f6e78d76c8cdf6efe3877ce63fb2b82bfa0b79d6aae41baec10c11cd677a17a9da9401a453b169a9b58816f0ab76b3dcac8f3972a
data/lib/list_entity.rb CHANGED
@@ -15,15 +15,27 @@ class ListEntity < ServiceEntity
15
15
  end
16
16
 
17
17
  def total_count
18
- pagination_items.total_count
18
+ if pagination_items.respond_to?(:total_count)
19
+ pagination_items.total_count
20
+ elsif pagination_items.respond_to?(:length)
21
+ pagination_items.length
22
+ end
19
23
  end
20
24
 
21
25
  def current_page
22
- pagination_items.current_page
26
+ if pagination_items.respond_to?(:current_page)
27
+ pagination_items.current_page
28
+ else
29
+ 1
30
+ end
23
31
  end
24
32
 
25
33
  def total_pages
26
- pagination_items.total_pages
34
+ if pagination_items.respond_to?(:total_pages)
35
+ pagination_items.total_pages
36
+ else
37
+ 0
38
+ end
27
39
  end
28
40
 
29
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiaRou Lee