quick_file 0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,13 +22,28 @@ module QuickFile
22
22
  def add_style(style_name, blk)
23
23
  processes[style_name.to_s] = {:blk => blk}
24
24
  end
25
+ def quick_file_mongo_keys!
26
+ key :sta, Integer # state
27
+ key :orf, String # original filename
28
+ key :sty, Hash # styles
29
+ key :sto, String, :default => "s3" # storage
30
+ key :oty, String # owner type
31
+ key :oid, ObjectId # owner id
32
+ key :err, Array # errors
33
+
34
+ attr_alias :state, :sta
35
+ attr_alias :original_filename, :orf
36
+ attr_alias :styles, :sty
37
+ attr_alias :storage_type, :sto
38
+ attr_alias :errors, :err
39
+ attr_alias :owner_type, :oty
40
+ end
25
41
  end
26
42
 
27
43
  module InstanceMethods
28
- def initialize
29
- @file = nil
30
- styles = {}
31
- errors = []
44
+ def owner=(obj)
45
+ self.oty = obj.class.to_s
46
+ self.oid = obj.id
32
47
  end
33
48
 
34
49
  def uploaded_file=(uf)
@@ -254,7 +269,16 @@ module QuickFile
254
269
  end
255
270
  self.state = STATES[:deleted]
256
271
  end
272
+
273
+ def url_hash
274
+ ret = {}
275
+ @@processes.keys.each do |style_name|
276
+ ret[style_name] = self.url(style_name.to_sym)
277
+ end
278
+ end
279
+
257
280
  end
258
281
 
259
282
  end
260
283
  end
284
+
@@ -1,3 +1,3 @@
1
1
  module QuickFile
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quick_file
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
16
- requirement: &70310906168420 !ruby/object:Gem::Requirement
16
+ requirement: &70135562226860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70310906168420
24
+ version_requirements: *70135562226860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fog
27
- requirement: &70310906168000 !ruby/object:Gem::Requirement
27
+ requirement: &70135562226440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70310906168000
35
+ version_requirements: *70135562226440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: active_support
38
- requirement: &70310906167580 !ruby/object:Gem::Requirement
38
+ requirement: &70135562226020 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70310906167580
46
+ version_requirements: *70135562226020
47
47
  description: A file upload library for use with MongoDB and S3
48
48
  email:
49
49
  - alangraham5@gmail.com