motor-admin-pz 0.4.18.1 → 0.4.21
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01224f114847f19ba5c8e9e07a27727513054bf72b47202df20f705f1cf77078
|
4
|
+
data.tar.gz: 3485e39fab2541a58048658ffa471148063854c666a27cdcb5023cdaac566ce6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4759c92b2dc52ffffdf8420be7639bb3ef42eb2fad5d9b259505dcb6f3b8fe2453780070602da33156a42663555465c40b9db81926251f5ea3a868c472cfa8ef
|
7
|
+
data.tar.gz: 67cfb0fb8d5e52297d0aaabca6b89ffccfd336cc1ce4d60e60b658b5718d6571544ed62dee1ce2dc038e402ea81b327bd213df6bdeefd4cd69c7b604ec230480
|
@@ -9,7 +9,13 @@ module Motor
|
|
9
9
|
load_and_authorize_resource :attachment, class: 'ActiveStorage::Attachment', parent: false
|
10
10
|
|
11
11
|
def create
|
12
|
-
|
12
|
+
blob = if file_params[:key]
|
13
|
+
ActiveStorage::Blob.create!(file_params)
|
14
|
+
else
|
15
|
+
ActiveStorage::Blob.create_and_upload!(file_params)
|
16
|
+
end
|
17
|
+
|
18
|
+
@attachment.assign_attributes(blob: blob, record: record)
|
13
19
|
@attachment.assign_attributes(record_type: '', record_id: 0) unless record
|
14
20
|
|
15
21
|
if @attachment.save(validate: false)
|
@@ -36,12 +42,20 @@ module Motor
|
|
36
42
|
end
|
37
43
|
|
38
44
|
def file_params
|
39
|
-
params.require(:data).require(:file).permit(:io, :filename
|
45
|
+
attrs = params.require(:data).require(:file).permit(:io, :filename, :key,
|
46
|
+
:checksum, :byte_size,
|
47
|
+
:content_type).to_h.symbolize_keys
|
48
|
+
|
49
|
+
return attrs if params.dig(:data, :file, :base64).blank?
|
50
|
+
|
51
|
+
attrs[:io] = StringIO.new(Base64.urlsafe_decode64(params[:data][:file][:base64]))
|
52
|
+
|
53
|
+
attrs
|
40
54
|
end
|
41
55
|
|
42
56
|
def attachment_params
|
43
57
|
if params[:data].present?
|
44
|
-
params.require(:data).except(:file).permit
|
58
|
+
params.require(:data).except(:file).permit(:name, :record_type, :record_id)
|
45
59
|
else
|
46
60
|
{}
|
47
61
|
end
|
@@ -24,6 +24,8 @@ module Motor
|
|
24
24
|
params: request_params[:params],
|
25
25
|
headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
|
26
26
|
|
27
|
+
response.to_hash.each { |key, (value)| headers[key] = value }
|
28
|
+
|
27
29
|
self.response_body = response.body
|
28
30
|
self.status = response.code.to_i
|
29
31
|
end
|
@@ -18,6 +18,8 @@ module Motor
|
|
18
18
|
variables: request_params[:variables],
|
19
19
|
headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
|
20
20
|
|
21
|
+
response.to_hash.each { |key, (value)| headers[key] = value }
|
22
|
+
|
21
23
|
self.response_body = response.body
|
22
24
|
self.status = response.code.to_i
|
23
25
|
end
|
data/lib/motor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motor-admin-pz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ar_lazy_preload
|