fdarchivo 0.2.0 → 0.2.1

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: 005b6cf06fbb4ac590148345acacae4b8ec71aeca31933284f4f37e885177d9a
4
- data.tar.gz: a7289a1a1f4447014af918fd62bd17ea10519f7a6ba7395b5649ec3e5e0fca2f
3
+ metadata.gz: 9da3195db8c90d43fc809b61e51987df9e0a4ff530fc246abc8a2a80f0b45f8e
4
+ data.tar.gz: 82b6d653b8050c00fda5e08666e1928d792ea181bdd71632e11097aa4800665a
5
5
  SHA512:
6
- metadata.gz: 96257433aa8daf84da3b022afd638527e458f8ae4897951e00caed265083f2c227be2e18a5c61a89b45146b12435a9f3f2d501db8158ef7451442b547c02f006
7
- data.tar.gz: 250d5c6a48ef1a0bb199aff61fc97dd5166a3d6754da01508d98e721b03545d36834196cf1b973f4fa4540f96b2609592912a53abdf7cc52fa40561eacfec878
6
+ metadata.gz: 0673aa2e3b9e76bca5c8686f7bae08da1dfcea651df830f4c6287931847fb4c904193b910c58410364e15a2ff350c7445ba6871065aa2ad33e069cd686e80261
7
+ data.tar.gz: 8f4dd9970967e1ec74d42db0af2ca9b68acaf245aa7009d5c3a63ec1e914d849b256f439dfda45fa79caf2c225a8056822bbc9987b45ff109176ff0e9ab14b4f
@@ -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
- if doc.tmp && doc.owner.blank?
36
- doc.path = "#{doc._id.to_s}.#{doc.extension}"
37
- else
38
- doc.path = "#{doc.owner.class.to_s.underscore}/#{doc.owner._id.to_s}/#{doc._id.to_s}.#{doc.extension}"
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._id.to_s).archivo.try(:delete)
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
@@ -1,3 +1,3 @@
1
1
  class Fdarchivo
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
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.2.0
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: 2021-04-01 00:00:00.000000000 Z
11
+ date: 2022-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -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.8
105
+ rubygems_version: 3.0.9
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Summary of Fdarchivo.