cloudinary 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,9 +30,12 @@ class Cloudinary::Utils
30
30
  named_transformation = base_transformations.join(".")
31
31
  base_transformations = []
32
32
  end
33
+
34
+ effect = options.delete(:effect)
35
+ effect = Array(effect).flatten.join(":") if effect.is_a?(Array) || effect.is_a?(Hash)
33
36
 
34
- params = {:w=>width, :h=>height, :t=>named_transformation, :c=>crop, :b=>background}
35
- { :x=>:x, :y=>:y, :r=>:radius, :d=>:default_image, :g=>:gravity, :q=>:quality, :p=>:prefix, :a=>:angle, :l=>:overlay, :f=>:fetch_format, :e=>:effects }.each do
37
+ params = {:w=>width, :h=>height, :t=>named_transformation, :c=>crop, :b=>background, :e=>effect}
38
+ { :x=>:x, :y=>:y, :r=>:radius, :d=>:default_image, :g=>:gravity, :q=>:quality, :p=>:prefix, :a=>:angle, :l=>:overlay, :f=>:fetch_format }.each do
36
39
  |param, option|
37
40
  params[param] = options.delete(option)
38
41
  end
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.23"
3
+ VERSION = "1.0.24"
4
4
  end
data/spec/utils_spec.rb CHANGED
@@ -206,11 +206,25 @@ describe Cloudinary::Utils do
206
206
  result.should == "http://res.cloudinary.com/test123/image/fetch/f_jpg/http://cloudinary.com/images/logo.png"
207
207
  end
208
208
 
209
- it "should support effects" do
210
- options = {:effects=>"sepia"}
209
+ it "should support effect" do
210
+ options = {:effect=>"sepia"}
211
211
  result = Cloudinary::Utils.cloudinary_url("test", options)
212
212
  options.should == {}
213
213
  result.should == "http://res.cloudinary.com/test123/image/upload/e_sepia/test"
214
214
  end
215
+
216
+ it "should support effect with hash param" do
217
+ options = {:effect=>{"sepia"=>10}}
218
+ result = Cloudinary::Utils.cloudinary_url("test", options)
219
+ options.should == {}
220
+ result.should == "http://res.cloudinary.com/test123/image/upload/e_sepia:10/test"
221
+ end
222
+
223
+ it "should support effect with array param" do
224
+ options = {:effect=>["sepia", 10]}
225
+ result = Cloudinary::Utils.cloudinary_url("test", options)
226
+ options.should == {}
227
+ result.should == "http://res.cloudinary.com/test123/image/upload/e_sepia:10/test"
228
+ end
215
229
 
216
230
  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.23
5
+ version: 1.0.24
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-14 00:00:00 +03:00
15
+ date: 2012-05-17 00:00:00 +03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency