cloudinary 1.0.51 → 1.0.52

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,9 +91,13 @@ class Cloudinary::Api
91
91
  call_api(:delete, "transformations/#{transformation_string(transformation)}", {}, options)
92
92
  end
93
93
 
94
- # updates - currently only supported update is the "allowed_for_strict" boolean flag
94
+ # updates - supports:
95
+ # "allowed_for_strict" boolean
96
+ # "unsafe_update" transformation params - updates a named transformation parameters without regenerating existing images
95
97
  def self.update_transformation(transformation, updates, options={})
96
- call_api(:put, "transformations/#{transformation_string(transformation)}", only(updates, :allowed_for_strict), options)
98
+ params = only(updates, :allowed_for_strict)
99
+ params[:unsafe_update] = transformation_string(updates[:unsafe_update]) if updates[:unsafe_update]
100
+ call_api(:put, "transformations/#{transformation_string(transformation)}", params, options)
97
101
  end
98
102
 
99
103
  def self.create_transformation(name, definition, options={})
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.51"
3
+ VERSION = "1.0.52"
4
4
  end
data/spec/api_spec.rb CHANGED
@@ -11,6 +11,8 @@ describe Cloudinary::Api do
11
11
  Cloudinary::Uploader.upload("spec/logo.png", :public_id=>"api_test", :tags=>"api_test_tag", :eager=>[:width=>100,:crop=>:scale])
12
12
  Cloudinary::Uploader.upload("spec/logo.png", :public_id=>"api_test2", :tags=>"api_test_tag", :eager=>[:width=>100,:crop=>:scale])
13
13
  @api.delete_transformation("api_test_transformation") rescue nil
14
+ @api.delete_transformation("api_test_transformation2") rescue nil
15
+ @api.delete_transformation("api_test_transformation3") rescue nil
14
16
  end
15
17
 
16
18
  it "should allow listing resource_types" do
@@ -149,6 +151,15 @@ describe Cloudinary::Api do
149
151
  lambda{@api.transformation("api_test_transformation2")}.should raise_error(Cloudinary::Api::NotFound)
150
152
  end
151
153
 
154
+ it "should allow unsafe update of named transformation" do
155
+ @api.create_transformation("api_test_transformation3", "crop"=>"scale", "width"=>102)
156
+ @api.update_transformation("api_test_transformation3", :unsafe_update=>{"crop"=>"scale", "width"=>103})
157
+ transformation = @api.transformation("api_test_transformation3")
158
+ transformation.should_not be_blank
159
+ transformation["info"].should == ["crop"=>"scale", "width"=>103]
160
+ transformation["used"].should == false
161
+ end
162
+
152
163
  it "should allow deleting implicit transformation" do
153
164
  @api.transformation("c_scale,w_100")
154
165
  @api.delete_transformation("c_scale,w_100")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.51
4
+ version: 1.0.52
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-03-28 00:00:00.000000000 Z
14
+ date: 2013-03-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client