dragonfly-cloudinary 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Dragonfly::Cloudinary
2
2
 
3
- Simple Cloudinary data store for Dragonfly. Uploads and fetches only in JPG format.
3
+ Simple Cloudinary data store for Dragonfly.
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,5 +1,5 @@
1
1
  module Dragonfly
2
2
  module Cloudinary
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -4,17 +4,27 @@ module Dragonfly
4
4
  module DataStorage
5
5
  class CloudinaryStore
6
6
  def store(temp_object, opts={})
7
- result = ::Cloudinary::Uploader.upload(temp_object.path, format: 'jpg')
8
- result['public_id']
7
+ result = ::Cloudinary::Uploader.upload(temp_object.path)
8
+ result['public_id'] + "." + result['format']
9
9
  end
10
10
 
11
11
  def retrieve(uid)
12
- url = ::Cloudinary::Utils.cloudinary_url(uid, format: 'jpg')
12
+ url = ::Cloudinary::Utils.cloudinary_url public_id(uid), format: ext(uid) || 'jpg'
13
13
  ::Cloudinary::Downloader.download(url)
14
14
  end
15
15
 
16
16
  def destroy(uid)
17
- ::Cloudinary::Uploader.destroy(uid)
17
+ ::Cloudinary::Uploader.destroy public_id(uid)
18
+ end
19
+
20
+ private
21
+
22
+ def public_id(uid)
23
+ File.basename(uid, ext(uid))
24
+ end
25
+
26
+ def ext(uid)
27
+ File.extname(uid)
18
28
  end
19
29
  end
20
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly-cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-23 00:00:00.000000000 Z
12
+ date: 2012-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: -202542125
92
+ hash: 604696563
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: -202542125
101
+ hash: 604696563
102
102
  requirements: []
103
103
  rubyforge_project:
104
104
  rubygems_version: 1.8.24