cloudinary 1.0.21 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@ module Cloudinary::CarrierWave
77
77
  set_or_yell(@transformation, :height, args[1])
78
78
  set_or_yell(@transformation, :crop, :scale)
79
79
  when :crop
80
- set_or_yell(@transformation, :width, args[0])
80
+ set_or_yell(@transformation, :width, args[0])
81
81
  set_or_yell(@transformation, :height, args[1])
82
82
  set_or_yell(@transformation, :gravity, args[2].to_s.downcase)
83
83
  set_or_yell(@transformation, :crop, :crop)
@@ -86,6 +86,13 @@ module Cloudinary::CarrierWave
86
86
  |attr, value|
87
87
  set_or_yell(@transformation, attr, value)
88
88
  end
89
+ else
90
+ if args.blank?
91
+ send(name).each do
92
+ |attr, value|
93
+ set_or_yell(@transformation, attr, value)
94
+ end
95
+ end
89
96
  end
90
97
  end
91
98
  @transformation
@@ -1,8 +1,18 @@
1
1
  class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
2
2
  def store!(file)
3
3
  if uploader.class.version_names.blank?
4
- return store_cloudinary_version(file.version) if file.is_a?(Cloudinary::CarrierWave::PreloadedCloudinaryFile)
5
-
4
+ case file
5
+ when Cloudinary::CarrierWave::PreloadedCloudinaryFile
6
+ return store_cloudinary_version(file.version)
7
+ when Cloudinary::CarrierWave::CloudinaryFile
8
+ return nil # Nothing to do
9
+ when Cloudinary::CarrierWave::RemoteFile
10
+ data = file.uri.to_s
11
+ else
12
+ data = file.file
13
+ data.rewind if !file.is_path? && data.respond_to?(:rewind)
14
+ end
15
+
6
16
  # This is the toplevel, need to upload the actual file.
7
17
  params = uploader.transformation.dup
8
18
  params[:return_error] = true
@@ -13,13 +23,6 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
13
23
  eager_versions = uploader.versions.values.select(&:eager)
14
24
  params[:eager] = eager_versions.map{|version| [version.transformation, version.format]} if eager_versions.length > 0
15
25
 
16
- data = nil
17
- if (file.is_a?(Cloudinary::CarrierWave::RemoteFile))
18
- data = file.uri.to_s
19
- else
20
- data = file.file
21
- data.rewind if !file.is_path? && data.respond_to?(:rewind)
22
- end
23
26
  uploader.metadata = Cloudinary::Uploader.upload(data, params)
24
27
  if uploader.metadata["error"]
25
28
  raise Cloudinary::CarrierWave::UploadError.new(uploader.metadata["error"]["message"], uploader.metadata["error"]["http_code"])
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.21"
3
+ VERSION = "1.0.22"
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.21
5
+ version: 1.0.22
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nadav Soferman
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2012-05-09 00:00:00 +03:00
15
+ date: 2012-05-10 00:00:00 +03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency