grape-listing 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grape_listing.rb +5 -0
- data/lib/listing_service/args_handling.rb +4 -4
- metadata +42 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 475f3252f68c43b45789964dbfa412320f83dc4f23e60a51e084ce4c85fe2472
|
4
|
+
data.tar.gz: fb085471aab7e821f270b34643b479dddf686a294bc4830162b8e06015999422
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e60e6c6e94d7dd830f05cccebef438e14590b576119b038a4f8255b90fb14f74de6f1d8d1cb67986ab85c0581c8a3ae47f08a85b8fe6fa792d0732df464481
|
7
|
+
data.tar.gz: 368098c1f481f028f0d3eaf31681c42e0f721e62c98bfe9c8ccbce28756cdc939960efcc49663acb193a3756be503bd6c3ad48d81e019422ee821b3d71123db9
|
data/lib/grape_listing.rb
CHANGED
@@ -4,7 +4,7 @@ module GrapeListing
|
|
4
4
|
private
|
5
5
|
|
6
6
|
def handle_args(**args)
|
7
|
-
# обрабатываемая
|
7
|
+
# обрабатываемая модель
|
8
8
|
@model = args[:model]
|
9
9
|
|
10
10
|
# параметры запроса и текущий пользователь
|
@@ -18,7 +18,7 @@ module GrapeListing
|
|
18
18
|
@grape_entity = args[:entity]
|
19
19
|
@fields = args[:fields]
|
20
20
|
|
21
|
-
#
|
21
|
+
# scopes для применения
|
22
22
|
@scopes = args[:scopes] || {}
|
23
23
|
|
24
24
|
# offset / limit
|
@@ -47,7 +47,7 @@ module GrapeListing
|
|
47
47
|
def records_count
|
48
48
|
# получение кол-ва записей из кеша
|
49
49
|
cache_key = "#{@model}_records_count"
|
50
|
-
cached =
|
50
|
+
cached = GrapeListing.cache.read(cache_key)
|
51
51
|
return cached if cached
|
52
52
|
|
53
53
|
# получение кол-ва записей из запроса к БД
|
@@ -55,7 +55,7 @@ module GrapeListing
|
|
55
55
|
|
56
56
|
# кеширование кол-ва записей при превышении порогового значения
|
57
57
|
if count >= 1_000
|
58
|
-
|
58
|
+
GrapeListing.cache.write(cache_key, count, expires_in: 30.minutes)
|
59
59
|
end
|
60
60
|
|
61
61
|
count
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-listing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Павел Бабин
|
@@ -11,61 +11,89 @@ cert_chain: []
|
|
11
11
|
date: 2024-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '7.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '7.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: addressable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: '2.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: '2.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: dalli
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.2.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.2.6
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fast_excel
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: grape
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: grape-entity
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
89
|
+
version: 1.0.0
|
62
90
|
type: :runtime
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
96
|
+
version: 1.0.0
|
69
97
|
description: Фильтрация, пагинация и формирование эл. таблиц на базе Grape
|
70
98
|
email: babin359@gmail.com
|
71
99
|
executables: []
|
@@ -105,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
133
|
- !ruby/object:Gem::Version
|
106
134
|
version: '0'
|
107
135
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.4.10
|
109
137
|
signing_key:
|
110
138
|
specification_version: 4
|
111
139
|
summary: Формирование списков записей для API на базе Grape
|