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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc9d85fa238526c44cf07b472bd9976773d5bfe9cb04bdc97ecc81672df569cf
4
- data.tar.gz: fe05929e906cb16edb27e6987eb16d0d7b12ab824f9de49154b4bb1b84294fcf
3
+ metadata.gz: 475f3252f68c43b45789964dbfa412320f83dc4f23e60a51e084ce4c85fe2472
4
+ data.tar.gz: fb085471aab7e821f270b34643b479dddf686a294bc4830162b8e06015999422
5
5
  SHA512:
6
- metadata.gz: 8bf8698b3d478e54fbd02091a24a7d3a838c3a9fd30b79edb1b9941a92a722ef86a43850035f7c6e4ccd89384f4576160ae7fb09c8c665f0b706ba6f157cdf74
7
- data.tar.gz: e45bdb89068782fae208e8b6ec250fdf528b44cd7fffbd151247346eaf473a7c4206318a10a59ac3ce7f1e04280feca4e75580de945ee3e0bb1c8a553067d442
6
+ metadata.gz: e5e60e6c6e94d7dd830f05cccebef438e14590b576119b038a4f8255b90fb14f74de6f1d8d1cb67986ab85c0581c8a3ae47f08a85b8fe6fa792d0732df464481
7
+ data.tar.gz: 368098c1f481f028f0d3eaf31681c42e0f721e62c98bfe9c8ccbce28756cdc939960efcc49663acb193a3756be503bd6c3ad48d81e019422ee821b3d71123db9
data/lib/grape_listing.rb CHANGED
@@ -4,4 +4,9 @@ require 'grape_listing/configuration'
4
4
  require 'grape_listing_service'
5
5
 
6
6
  module GrapeListing
7
+
8
+ def self.cache
9
+ @cache ||= ActiveSupport::Cache.lookup_store(:mem_cache_store)
10
+ end
11
+
7
12
  end
@@ -4,7 +4,7 @@ module GrapeListing
4
4
  private
5
5
 
6
6
  def handle_args(**args)
7
- # обрабатываемая Rails модель
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
- # Rails scopes для применения
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 = Rails.cache.read(cache_key)
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
- Rails.cache.write(cache_key, count, expires_in: 30.minutes)
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.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: fast_excel
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
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: 0.5.0
26
+ version: '7.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: grape
28
+ name: addressable
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
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.0.0
40
+ version: '2.8'
41
41
  - !ruby/object:Gem::Dependency
42
- name: grape-entity
42
+ name: dalli
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
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: 1.0.0
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: rails
84
+ name: grape-entity
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: '7.0'
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: '7.0'
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.0.6
136
+ rubygems_version: 3.4.10
109
137
  signing_key:
110
138
  specification_version: 4
111
139
  summary: Формирование списков записей для API на базе Grape