care 0.1.0 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14977cccfa8498c0a1f393c82b87cd82e17158f2d011a87cec06bfb1f985bf23
4
- data.tar.gz: 925a627e30e5336da9831c25d81dfce770b824839f16a0339f3801e660974405
3
+ metadata.gz: e0d173cca687ef272ba0759ff347995723a34052af354aa01a22fac55614bbd9
4
+ data.tar.gz: f4975d1110fe9eed49cb1e1964a716be88d78fb012faba92472576371bfa7658
5
5
  SHA512:
6
- metadata.gz: 0c436afc6b630ee40142a5d0548114c32df40611d50b2697b427c3c1bab94db2d4f08059aac3b0b9d229df128f1c69ebfd6b25ead68a4b0de01df23f97999ddf
7
- data.tar.gz: 79c72894f82c9af2a30a152b3137e285c2b105fc5cbd9af7fb36ff22466ccbd39e7f3c2954225d663f318b15639afc4d8099e713c2c6162b4f83d3feb2ce0357
6
+ metadata.gz: db5fac70a2cf214bf2294077411da7924f6c25c6dd3b458d48eab4338cbbe4cf2a20fe5e37f69e55c9c9992fa28e3e319d7b2c33fdfccf3827bf99a78909a244
7
+ data.tar.gz: c8f3cd3169d948c88a1ec55fefc14fab39c74eed92e564e46e51e62dfcef832b72b7819d0da03888f7915592da59dda0c7ba1ea147553307c34d88de9e78eff5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- care (0.1.0)
4
+ care (0.1.6)
5
5
  active_model_serializers (~> 0.10.10)
6
6
  activerecord-import
7
7
  cancancan
@@ -19,49 +19,48 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- actionpack (5.2.4.1)
23
- actionview (= 5.2.4.1)
24
- activesupport (= 5.2.4.1)
25
- rack (~> 2.0, >= 2.0.8)
22
+ actionpack (6.1.0)
23
+ actionview (= 6.1.0)
24
+ activesupport (= 6.1.0)
25
+ rack (~> 2.0, >= 2.0.9)
26
26
  rack-test (>= 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.2.4.1)
30
- activesupport (= 5.2.4.1)
28
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
29
+ actionview (6.1.0)
30
+ activesupport (= 6.1.0)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- active_model_serializers (0.10.10)
36
- actionpack (>= 4.1, < 6.1)
37
- activemodel (>= 4.1, < 6.1)
34
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
35
+ active_model_serializers (0.10.12)
36
+ actionpack (>= 4.1, < 6.2)
37
+ activemodel (>= 4.1, < 6.2)
38
38
  case_transform (>= 0.2)
39
39
  jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
40
- activemodel (5.2.4.1)
41
- activesupport (= 5.2.4.1)
42
- activerecord (5.2.4.1)
43
- activemodel (= 5.2.4.1)
44
- activesupport (= 5.2.4.1)
45
- arel (>= 9.0)
40
+ activemodel (6.1.0)
41
+ activesupport (= 6.1.0)
42
+ activerecord (6.1.0)
43
+ activemodel (= 6.1.0)
44
+ activesupport (= 6.1.0)
46
45
  activerecord-import (1.0.7)
47
46
  activerecord (>= 3.2)
48
- activesupport (5.2.4.1)
47
+ activesupport (6.1.0)
49
48
  concurrent-ruby (~> 1.0, >= 1.0.2)
50
- i18n (>= 0.7, < 2)
51
- minitest (~> 5.1)
52
- tzinfo (~> 1.1)
53
- arel (9.0.0)
49
+ i18n (>= 1.6, < 2)
50
+ minitest (>= 5.1)
51
+ tzinfo (~> 2.0)
52
+ zeitwerk (~> 2.3)
54
53
  ast (2.4.1)
55
54
  bcrypt (3.1.16)
56
55
  builder (3.2.4)
57
- cancancan (3.1.0)
56
+ cancancan (3.2.0)
58
57
  case_transform (0.2)
59
58
  activesupport
60
59
  centrifuge (1.2.0)
61
60
  httpclient
62
61
  multi_json
63
- concurrent-ruby (1.1.5)
64
- crass (1.0.5)
62
+ concurrent-ruby (1.1.7)
63
+ crass (1.0.6)
65
64
  database_cleaner (1.8.5)
66
65
  database_cleaner-active_record (1.8.0)
67
66
  activerecord
@@ -77,46 +76,46 @@ GEM
77
76
  dotenv-rails (2.7.6)
78
77
  dotenv (= 2.7.6)
79
78
  railties (>= 3.2)
80
- erubi (1.9.0)
79
+ erubi (1.10.0)
81
80
  factory_bot (5.2.0)
82
81
  activesupport (>= 4.2.0)
83
82
  factory_bot_rails (5.2.0)
84
83
  factory_bot (~> 5.2.0)
85
84
  railties (>= 4.2.0)
86
- faker (2.14.0)
85
+ faker (2.15.1)
87
86
  i18n (>= 1.6, < 2)
88
87
  httpclient (2.8.3)
89
- i18n (1.7.1)
88
+ i18n (1.8.5)
90
89
  concurrent-ruby (~> 1.0)
91
90
  jsonapi-renderer (0.2.2)
92
91
  jwt (2.2.2)
93
- kaminari (1.1.1)
92
+ kaminari (1.2.1)
94
93
  activesupport (>= 4.1.0)
95
- kaminari-actionview (= 1.1.1)
96
- kaminari-activerecord (= 1.1.1)
97
- kaminari-core (= 1.1.1)
98
- kaminari-actionview (1.1.1)
94
+ kaminari-actionview (= 1.2.1)
95
+ kaminari-activerecord (= 1.2.1)
96
+ kaminari-core (= 1.2.1)
97
+ kaminari-actionview (1.2.1)
99
98
  actionview
100
- kaminari-core (= 1.1.1)
101
- kaminari-activerecord (1.1.1)
99
+ kaminari-core (= 1.2.1)
100
+ kaminari-activerecord (1.2.1)
102
101
  activerecord
103
- kaminari-core (= 1.1.1)
104
- kaminari-core (1.1.1)
105
- loofah (2.4.0)
102
+ kaminari-core (= 1.2.1)
103
+ kaminari-core (1.2.1)
104
+ loofah (2.8.0)
106
105
  crass (~> 1.0.2)
107
106
  nokogiri (>= 1.5.9)
108
107
  method_source (1.0.0)
109
108
  mini_portile2 (2.4.0)
110
- minitest (5.13.0)
109
+ minitest (5.14.2)
111
110
  multi_json (1.15.0)
112
- nokogiri (1.10.7)
111
+ nokogiri (1.10.10)
113
112
  mini_portile2 (~> 2.4.0)
114
113
  orm_adapter (0.5.0)
115
- parallel (1.19.2)
114
+ parallel (1.20.1)
116
115
  parser (2.7.2.0)
117
116
  ast (~> 2.4.1)
118
117
  prometheus-client (1.0.0)
119
- rack (2.0.8)
118
+ rack (2.2.3)
120
119
  rack-test (1.1.0)
121
120
  rack (>= 1.0, < 3)
122
121
  rails-dom-testing (2.0.3)
@@ -124,31 +123,31 @@ GEM
124
123
  nokogiri (>= 1.6)
125
124
  rails-html-sanitizer (1.3.0)
126
125
  loofah (~> 2.3)
127
- railties (5.2.4.1)
128
- actionpack (= 5.2.4.1)
129
- activesupport (= 5.2.4.1)
126
+ railties (6.1.0)
127
+ actionpack (= 6.1.0)
128
+ activesupport (= 6.1.0)
130
129
  method_source
131
130
  rake (>= 0.8.7)
132
- thor (>= 0.19.0, < 2.0)
131
+ thor (~> 1.0)
133
132
  rainbow (3.0.0)
134
- rake (13.0.1)
135
- regexp_parser (1.8.2)
133
+ rake (13.0.3)
134
+ regexp_parser (2.0.1)
136
135
  responders (3.0.1)
137
136
  actionpack (>= 5.0)
138
137
  railties (>= 5.0)
139
138
  rexml (3.2.4)
140
- rspec (3.9.0)
141
- rspec-core (~> 3.9.0)
142
- rspec-expectations (~> 3.9.0)
143
- rspec-mocks (~> 3.9.0)
144
- rspec-core (3.9.3)
145
- rspec-support (~> 3.9.3)
146
- rspec-expectations (3.9.2)
139
+ rspec (3.10.0)
140
+ rspec-core (~> 3.10.0)
141
+ rspec-expectations (~> 3.10.0)
142
+ rspec-mocks (~> 3.10.0)
143
+ rspec-core (3.10.0)
144
+ rspec-support (~> 3.10.0)
145
+ rspec-expectations (3.10.0)
147
146
  diff-lcs (>= 1.2.0, < 2.0)
148
- rspec-support (~> 3.9.0)
149
- rspec-mocks (3.9.1)
147
+ rspec-support (~> 3.10.0)
148
+ rspec-mocks (3.10.0)
150
149
  diff-lcs (>= 1.2.0, < 2.0)
151
- rspec-support (~> 3.9.0)
150
+ rspec-support (~> 3.10.0)
152
151
  rspec-rails (4.0.1)
153
152
  actionpack (>= 4.2)
154
153
  activesupport (>= 4.2)
@@ -157,7 +156,7 @@ GEM
157
156
  rspec-expectations (~> 3.9)
158
157
  rspec-mocks (~> 3.9)
159
158
  rspec-support (~> 3.9)
160
- rspec-support (3.9.3)
159
+ rspec-support (3.10.0)
161
160
  rubocop (0.93.1)
162
161
  parallel (~> 1.10)
163
162
  parser (>= 2.7.1.5)
@@ -167,18 +166,18 @@ GEM
167
166
  rubocop-ast (>= 0.6.0)
168
167
  ruby-progressbar (~> 1.7)
169
168
  unicode-display_width (>= 1.4.0, < 2.0)
170
- rubocop-ast (0.8.0)
169
+ rubocop-ast (1.3.0)
171
170
  parser (>= 2.7.1.5)
172
171
  ruby-progressbar (1.10.1)
173
172
  shoulda-matchers (4.4.1)
174
173
  activesupport (>= 4.2.0)
175
174
  thor (1.0.1)
176
- thread_safe (0.3.6)
177
- tzinfo (1.2.6)
178
- thread_safe (~> 0.1)
175
+ tzinfo (2.0.4)
176
+ concurrent-ruby (~> 1.0)
179
177
  unicode-display_width (1.7.0)
180
- warden (1.2.8)
181
- rack (>= 2.0.6)
178
+ warden (1.2.9)
179
+ rack (>= 2.0.9)
180
+ zeitwerk (2.4.2)
182
181
 
183
182
  PLATFORMS
184
183
  ruby
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require_relative 'searcher'
2
3
 
3
4
  module Care::AutoFinder
4
5
  #
@@ -25,7 +26,7 @@ module Care::AutoFinder
25
26
 
26
27
  def search(items)
27
28
  if params[:search].present?
28
- Searcher.call(items: items, columns: columns, search: params[:search])
29
+ Care::AutoFinder::Searcher.call(items: items, columns: columns, search: params[:search])
29
30
  else
30
31
  items
31
32
  end
data/lib/care/seed.rb CHANGED
@@ -5,13 +5,15 @@ module Care
5
5
  table_name = path.split("/").last.gsub(".json", "").gsub(/^\d*_/, "")
6
6
  puts "*** Преднаполнение таблицы #{table_name} ***"
7
7
  items = ActiveSupport::JSON.decode(File.read(path))
8
- begin
9
- items_class = table_name.classify.constantize
8
+ table_name = table_name.gsub('dictionary_', 'dictionary/') || table_name
9
+ if (items_class = table_name.classify.safe_constantize)
10
10
  items_class.import(items, on_duplicate_key_update: :all)
11
- rescue NameError => _e # Не обнаружен класс с описанием модели
12
- keys = items[0].keys.join(",")
11
+ else
12
+ keys = items[0].keys
13
+ v_keys = keys.join(",")
13
14
  values = items.map { |i| "(#{i.values.map { |v| "'#{v}'" }.join(",")})" }.join(",")
14
- sql = "insert into #{table_name}(#{keys}) values #{values} on conflict (id) do nothing"
15
+ set_keys = keys.map{|k| "#{k} = excluded.#{k}"}.join(", ")
16
+ sql = "insert into #{table_name}(#{v_keys}) values #{values} on conflict (id) do update set #{set_keys}"
15
17
  puts sql
16
18
  ActiveRecord::Base.connection.execute sql
17
19
  end
@@ -1,6 +1,7 @@
1
1
  RSpec.shared_context "set_authorization" do
2
2
 
3
- let(:organization_id) { SecureRandom.uuid }
3
+ let(:'Organization-Id') { SecureRandom.uuid }
4
+ let(:organization_id) { send(:'Organization-Id') }
4
5
 
5
6
  let(:payload) do
6
7
  {
@@ -9,7 +9,7 @@ RSpec.shared_context "parameters" do |parameter_tags|
9
9
  required: true
10
10
  end
11
11
  if parameter_tags.include?(:organization_id)
12
- parameter name: :organization_id,
12
+ parameter name: :'Organization-Id',
13
13
  description: "Organization ID текущей организации",
14
14
  in: :header,
15
15
  type: :string,
data/lib/care/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Care
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.6"
5
5
  end
@@ -24,7 +24,7 @@ module Authorization
24
24
  end
25
25
 
26
26
  def current_organization_id
27
- @current_organization_id ||= request.headers[:organization_id]
27
+ @current_organization_id ||= request.headers['organization-id']
28
28
  end
29
29
 
30
30
  def permissions
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: care
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Валерий Маханов
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt