fdarchivo 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fdarchivo/archivo.rb +11 -9
- data/lib/fdarchivo/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9da3195db8c90d43fc809b61e51987df9e0a4ff530fc246abc8a2a80f0b45f8e
|
4
|
+
data.tar.gz: 82b6d653b8050c00fda5e08666e1928d792ea181bdd71632e11097aa4800665a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0673aa2e3b9e76bca5c8686f7bae08da1dfcea651df830f4c6287931847fb4c904193b910c58410364e15a2ff350c7445ba6871065aa2ad33e069cd686e80261
|
7
|
+
data.tar.gz: 8f4dd9970967e1ec74d42db0af2ca9b68acaf245aa7009d5c3a63ec1e914d849b256f439dfda45fa79caf2c225a8056822bbc9987b45ff109176ff0e9ab14b4f
|
data/lib/fdarchivo/archivo.rb
CHANGED
@@ -7,7 +7,8 @@ class Archivo
|
|
7
7
|
:DOC, # Documento
|
8
8
|
:ARC # Archivo
|
9
9
|
]
|
10
|
-
|
10
|
+
|
11
|
+
field :name, type: String
|
11
12
|
field :path, type: String
|
12
13
|
field :public_url, type: String
|
13
14
|
field :extension, type: String
|
@@ -30,17 +31,19 @@ class Archivo
|
|
30
31
|
logo: true
|
31
32
|
).destroy_all
|
32
33
|
end
|
33
|
-
doc.extension = doc.path.split('.').last
|
34
|
-
doc.tipo = check_tipo(doc.extension)
|
35
|
-
|
36
|
-
doc.
|
37
|
-
|
38
|
-
|
34
|
+
doc.extension = doc.path.split('.').last unless doc.extension
|
35
|
+
doc.tipo = check_tipo(doc.extension) unless doc.tipo
|
36
|
+
unless doc.path
|
37
|
+
if doc.tmp && doc.owner.blank?
|
38
|
+
doc.path = "#{doc._id.to_s}.#{doc.extension}"
|
39
|
+
else
|
40
|
+
doc.path = "#{doc.owner&.class&.to_s&.underscore}/#{doc.owner&._id.to_s}/#{doc&._id.to_s}.#{doc&.extension}"
|
41
|
+
end
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
42
45
|
before_destroy do |doc|
|
43
|
-
Fdarchivo.new(doc
|
46
|
+
Fdarchivo.new(doc&._id&.to_s)&.archivo.try(:delete)
|
44
47
|
end
|
45
48
|
|
46
49
|
|
@@ -54,7 +57,6 @@ class Archivo
|
|
54
57
|
end
|
55
58
|
end
|
56
59
|
def self.reclamar(code, old_owner, owner)
|
57
|
-
ap self.where(tmp: true, upload_code: code, owner: old_owner)
|
58
60
|
self.where(tmp: true, upload_code: code, owner: old_owner).collect do |doc|
|
59
61
|
doc.reclamar(owner: owner)
|
60
62
|
end
|
data/lib/fdarchivo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fdarchivo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- afuenteposadilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: mongoid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.1'
|
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: '
|
40
|
+
version: '7.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: google-cloud-storage
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,7 +83,7 @@ files:
|
|
83
83
|
- lib/fdarchivo/fdpath.rb
|
84
84
|
- lib/fdarchivo/version.rb
|
85
85
|
- lib/tasks/fdarchivo_tasks.rake
|
86
|
-
homepage:
|
86
|
+
homepage:
|
87
87
|
licenses:
|
88
88
|
- MIT
|
89
89
|
metadata: {}
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.0.
|
105
|
+
rubygems_version: 3.0.9
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Summary of Fdarchivo.
|