cloudinary 1.10.1.pre.rc → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb25e44546e36644c7d562315948d628363ac984bffa7996d0bee6892b58847c
4
- data.tar.gz: c3e79edcf802119dfeac58f0d29d21486069e1ae3969cc29ccc1dcd7fb67fa5f
3
+ metadata.gz: c1a428a9c1a34b4a9b89df196292b88396095867df660cc2c327d7427dab2d1f
4
+ data.tar.gz: 43a242c30de9e936d416b6cce0af16029456e913b31609e772631c02c2367409
5
5
  SHA512:
6
- metadata.gz: 7709d94ff7742280031303c25fb8c19f8f45404b0d44eb372fb3a08865996433274780dee195be1a203467653f88de221cb28fbaa585d9a6559c78ac85fb80cf
7
- data.tar.gz: ad6b1ea6ecda326aad5afd5b3d794abd1851778d59bab1ec692f6ea69da4897fc8edaea0a36bfd9b30b1e5988786556ed1c3fa5eb43c731681dfbda3fd834407
6
+ metadata.gz: b17ad9f448a25c419ef19ea8df67d87d774fdf9fe03c48300a9575fd2efcd3cc0ce51990a1656db517334ad1aefadd1e3f4923a6c5bef539771f6c8fccdeee84
7
+ data.tar.gz: ae35973b12d626696eba7c41d631c36f30f9a3c8fb107fffeed37161959958b91dfa1d5e5682962c077f3db2314d82b2e802e0a65c55cbaa9d1f022e778013ed
@@ -1,4 +1,27 @@
1
1
 
2
+ 1.11.0 / 2018-12-12
3
+ ===================
4
+
5
+ New functionality and features
6
+ ------------------------------
7
+
8
+ * Support new parameters and values:
9
+ * `auto` keyword in the `start_offset`
10
+ * `art` artistic effect
11
+ * `fps`
12
+ * `quality_analysis`
13
+ * `quality_override`
14
+ * `pre` custom function transformation
15
+ * Add namespace to the cloudinary controller to avoiding conflicts (#319)
16
+
17
+ Other Changes
18
+ -------------
19
+
20
+ * Add "Join the Community"
21
+ * Merge pull request #290 from zenspider/fix_carrierwave_deps
22
+ * Fixed direct references to ::CarrierWave with `defined?` guards.
23
+ * Fix debugging output to use mutex so output isn't garbled.
24
+
2
25
  1.10.1-rc / 2018-11-20
3
26
  ======================
4
27
 
data/README.md CHANGED
@@ -266,6 +266,9 @@ Contact us [https://cloudinary.com/contact](https://cloudinary.com/contact)
266
266
 
267
267
  Stay tuned for updates, tips and tutorials: [Blog](https://cloudinary.com/blog), [Twitter](https://twitter.com/cloudinary), [Facebook](https://www.facebook.com/Cloudinary).
268
268
 
269
+ ## Join the Community ##########################################################
270
+
271
+ Impact the product, hear updates, test drive new features and more! Join [here](https://www.facebook.com/groups/CloudinaryCommunity).
269
272
 
270
273
  ## License #######################################################################
271
274
 
@@ -153,7 +153,7 @@ module Cloudinary
153
153
  end
154
154
  # Prevent require loop if included after Rails is already initialized.
155
155
  require "cloudinary/helper" if defined?(::ActionView::Base)
156
- require "cloudinary/controller" if defined?(::ActionController::Base)
156
+ require "cloudinary/cloudinary_controller" if defined?(::ActionController::Base)
157
157
  require "cloudinary/railtie" if defined?(Rails) && defined?(Rails::Railtie)
158
158
  require "cloudinary/engine" if defined?(Rails) && defined?(Rails::Engine)
159
159
 
@@ -78,7 +78,18 @@ class Cloudinary::Api
78
78
  resource_type = options[:resource_type] || "image"
79
79
  type = options[:type] || "upload"
80
80
  uri = "resources/#{resource_type}/#{type}/#{public_id}"
81
- call_api(:get, uri, only(options, :colors, :exif, :faces, :image_metadata, :pages, :phash, :coordinates, :max_results), options)
81
+ call_api(:get, uri,
82
+ only(options,
83
+ :colors,
84
+ :coordinates,
85
+ :exif,
86
+ :faces,
87
+ :image_metadata,
88
+ :max_results,
89
+ :pages,
90
+ :phash,
91
+ :quality_analysis
92
+ ), options)
82
93
  end
83
94
 
84
95
  def self.restore(public_ids, options={})
@@ -94,19 +105,20 @@ class Cloudinary::Api
94
105
  uri = "resources/#{resource_type}/#{type}/#{public_id}"
95
106
  update_options = {
96
107
  :access_control => Cloudinary::Utils.json_array_param(options[:access_control]),
97
- :tags => options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(","),
108
+ :auto_tagging => options[:auto_tagging] && options[:auto_tagging].to_f,
109
+ :background_removal => options[:background_removal],
110
+ :categorization => options[:categorization],
98
111
  :context => Cloudinary::Utils.encode_context(options[:context]),
99
- :face_coordinates => Cloudinary::Utils.encode_double_array(options[:face_coordinates]),
100
112
  :custom_coordinates => Cloudinary::Utils.encode_double_array(options[:custom_coordinates]),
113
+ :detection => options[:detection],
114
+ :face_coordinates => Cloudinary::Utils.encode_double_array(options[:face_coordinates]),
101
115
  :moderation_status => options[:moderation_status],
102
- :raw_convert => options[:raw_convert],
116
+ :notification_url => options[:notification_url],
117
+ :quality_override => options[:quality_override],
103
118
  :ocr => options[:ocr],
104
- :categorization => options[:categorization],
105
- :detection => options[:detection],
119
+ :raw_convert => options[:raw_convert],
106
120
  :similarity_search => options[:similarity_search],
107
- :background_removal => options[:background_removal],
108
- :auto_tagging => options[:auto_tagging] && options[:auto_tagging].to_f,
109
- :notification_url => options[:notification_url]
121
+ :tags => options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(",")
110
122
  }
111
123
  call_api(:post, uri, update_options, options)
112
124
  end
@@ -3,7 +3,7 @@ require 'cloudinary/carrier_wave/process'
3
3
  require 'cloudinary/carrier_wave/error'
4
4
  require 'cloudinary/carrier_wave/remote'
5
5
  require 'cloudinary/carrier_wave/preloaded'
6
- require 'cloudinary/carrier_wave/storage'
6
+ require 'cloudinary/carrier_wave/storage' if defined?(::CarrierWave) # HACK
7
7
 
8
8
  module Cloudinary::CarrierWave
9
9
 
@@ -1,4 +1,4 @@
1
- module CloudinaryController
1
+ module Cloudinary::CloudinaryController
2
2
  protected
3
3
 
4
4
  def valid_cloudinary_response?
@@ -10,4 +10,4 @@ module CloudinaryController
10
10
  end
11
11
  end
12
12
 
13
- ActionController::Base.send :include, CloudinaryController
13
+ ActionController::Base.send :include, Cloudinary::CloudinaryController
@@ -299,7 +299,9 @@ class Cloudinary::Migrator
299
299
 
300
300
  def debug(message)
301
301
  if @debug
302
- $stderr.print "#{Time.now} Cloudinary::Migrator #{message}\n"
302
+ mutex.synchronize{
303
+ $stderr.print "#{Time.now} Cloudinary::Migrator #{message}\n"
304
+ }
303
305
  end
304
306
  end
305
307
 
@@ -51,6 +51,8 @@ class Cloudinary::Uploader
51
51
  :phash => Cloudinary::Utils.as_safe_bool(options[:phash]),
52
52
  :proxy => options[:proxy],
53
53
  :public_id => options[:public_id],
54
+ :quality_analysis => Cloudinary::Utils.as_safe_bool(options[:quality_analysis]),
55
+ :quality_override => options[:quality_override],
54
56
  :raw_convert => options[:raw_convert],
55
57
  :responsive_breakpoints => Cloudinary::Utils.generate_responsive_breakpoints_string(options[:responsive_breakpoints]),
56
58
  :return_delete_token => Cloudinary::Utils.as_safe_bool(options[:return_delete_token]),
@@ -85,6 +85,7 @@ class Cloudinary::Utils
85
85
  end_offset
86
86
  fetch_format
87
87
  flags
88
+ fps
88
89
  gravity
89
90
  height
90
91
  if
@@ -190,10 +191,14 @@ class Cloudinary::Utils
190
191
  options[:start_offset], options[:end_offset] = split_range options.delete(:offset)
191
192
  end
192
193
 
194
+ fps = options.delete(:fps)
195
+ fps = fps.join('-') if fps.is_a? Array
196
+
193
197
  overlay = process_layer(options.delete(:overlay))
194
198
  underlay = process_layer(options.delete(:underlay))
195
199
  ifValue = process_if(options.delete(:if))
196
200
  custom_function = process_custom_function(options.delete(:custom_function))
201
+ custom_pre_function = process_custom_pre_function(options.delete(:custom_pre_function))
197
202
 
198
203
  params = {
199
204
  :a => normalize_expression(angle),
@@ -205,7 +210,8 @@ class Cloudinary::Utils
205
210
  :dpr => normalize_expression(dpr),
206
211
  :e => normalize_expression(effect),
207
212
  :fl => flags,
208
- :fn => custom_function,
213
+ :fn => custom_function || custom_pre_function,
214
+ :fps => fps,
209
215
  :h => normalize_expression(height),
210
216
  :l => overlay,
211
217
  :o => normalize_expression(options.delete(:opacity)),
@@ -1063,6 +1069,11 @@ class Cloudinary::Utils
1063
1069
  end
1064
1070
  private_class_method :process_video_params
1065
1071
 
1072
+ def self.process_custom_pre_function(param)
1073
+ value = process_custom_function(param)
1074
+ value ? "pre:#{value}" : NIL
1075
+ end
1076
+
1066
1077
  def self.process_custom_function(param)
1067
1078
  return param unless param.is_a? Hash
1068
1079
 
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.10.1-rc"
3
+ VERSION = "1.11.0"
4
4
  end
@@ -130,6 +130,13 @@ describe Cloudinary::Api do
130
130
  expect(resource["derived"].length).to eq(1)
131
131
  end
132
132
 
133
+ it "should support the quality_analysis parameter" do
134
+ resource = @api.resource(test_id_1, :quality_analysis => true)
135
+ expect(resource).not_to be_blank
136
+ expect(resource).to have_key("quality_analysis")
137
+ expect(resource["quality_analysis"]).to have_key("focus")
138
+ end
139
+
133
140
  it "should allow deleting derived resource" do
134
141
  derived_resource_id = "derived_id"
135
142
  expect(RestClient::Request).to receive(:execute).with(deep_hash_value( {[:payload, :derived_resource_ids] => derived_resource_id}))
@@ -375,6 +382,14 @@ describe Cloudinary::Api do
375
382
  Cloudinary::Api.update("public_id", {:auto_tagging => 0.5})
376
383
  end
377
384
 
385
+ it "should support quality_override" do
386
+ ['auto:advanced', 'auto:best', '80:420', 'none'].each do |q|
387
+ expected = {[:payload, :quality_override] => q}
388
+ expect(RestClient::Request).to receive(:execute).with(deep_hash_value(expected))
389
+ Cloudinary::Api.update Pathname.new(TEST_IMG), :quality_override => q
390
+ end
391
+ end
392
+
378
393
  it "should support listing by moderation kind and value" do
379
394
  expect(RestClient::Request).to receive(:execute).with(deep_hash_value([:url] => /.*manual\/approved$/, [:payload, :max_results] => 1000))
380
395
  Cloudinary::Api.resources_by_moderation(:manual, :approved, :max_results => 1000)
@@ -35,6 +35,20 @@ describe Cloudinary::Uploader do
35
35
  expect(result["status"]).to eq("pending")
36
36
  end
37
37
 
38
+ it "should support the quality_analysis parameter" do
39
+ result = Cloudinary::Uploader.upload(Pathname.new(TEST_IMG), :quality_analysis => true, :tags => [TEST_TAG, TIMESTAMP_TAG])
40
+ expect(result).to have_key("quality_analysis")
41
+ expect(result["quality_analysis"]).to have_key("focus")
42
+ end
43
+
44
+ it "should support the quality_override parameter" do
45
+ ['auto:advanced', 'auto:best', '80:420', 'none'].each do |q|
46
+ expected = {[:payload, :quality_override] => q}
47
+ expect(RestClient::Request).to receive(:execute).with(deep_hash_value(expected))
48
+ Cloudinary::Uploader.upload Pathname.new(TEST_IMG), :quality_override => q
49
+ end
50
+ end
51
+
38
52
  describe '.rename' do
39
53
  before(:all) do
40
54
  @result = Cloudinary::Uploader.upload(TEST_IMG, :tags => [TEST_TAG, TIMESTAMP_TAG])
@@ -458,6 +458,12 @@ describe Cloudinary::Utils do
458
458
  .and empty_options
459
459
  end
460
460
 
461
+ it "should support artistic effect" do
462
+ expect(["test", { :effect => "art:incognito"}])
463
+ .to produce_url("#{upload_path}/e_art:incognito/test")
464
+ .and empty_options
465
+ end
466
+
461
467
  it "should support keyframe_interval" do
462
468
  expect(["test", { :keyframe_interval => 10 }])
463
469
  .to produce_url("#{upload_path}/ki_10/test")
@@ -945,5 +951,20 @@ describe Cloudinary::Utils do
945
951
  expect( actual).to eq("fn_#{custom_function_remote_str}")
946
952
 
947
953
  end
954
+
955
+ it 'should accept a string value' do
956
+ actual = Cloudinary::Utils.generate_transformation_string :custom_pre_function => custom_function_wasm_str
957
+ expect( actual).to eq("fn_pre:#{custom_function_wasm_str}")
958
+ end
959
+ it 'should accept a hash of options' do
960
+ actual = Cloudinary::Utils.generate_transformation_string :custom_pre_function => custom_function_wasm
961
+ expect( actual).to eq("fn_pre:#{custom_function_wasm_str}")
962
+ end
963
+ it 'should base64 encoded URL for a remote function' do
964
+ actual = Cloudinary::Utils.generate_transformation_string :custom_pre_function => custom_function_remote
965
+ expect( actual).to eq("fn_pre:#{custom_function_remote_str}")
966
+
967
+ end
968
+
948
969
  end
949
970
  end
@@ -106,6 +106,11 @@ describe Cloudinary::Utils do
106
106
  .to produce_url("#{upload_path}/#{short}_35p/video_id")
107
107
  .and empty_options
108
108
  end
109
+ it 'should support the "auto" keyword' do
110
+ expect(["video_id", { :resource_type => 'video', long => 'auto' }])
111
+ .to produce_url("#{upload_path}/#{short}_auto/video_id")
112
+ .and empty_options
113
+ end
109
114
  end
110
115
  end
111
116
 
@@ -161,6 +166,20 @@ describe Cloudinary::Utils do
161
166
 
162
167
  end
163
168
  end
169
+ it "should support the fps parameter" do
170
+ [
171
+ ['24-29.97', 'fps_24-29.97'],
172
+ [24, 'fps_24'],
173
+ [24.973, 'fps_24.973'],
174
+ ['24', 'fps_24'],
175
+ ['-24', 'fps_-24'],
176
+ ['$v', 'fps_$v'],
177
+ [[24, 29.97], 'fps_24-29.97'],
178
+ [['24', '$v'], 'fps_24-$v']
179
+ ].each do |value, param|
180
+ expect(Cloudinary::Utils.generate_transformation_string(:fps => value)).to eq(param)
181
+ end
182
+ end
164
183
  end
165
184
 
166
185
  end
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.10.1.pre.rc
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadav Soferman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-11-20 00:00:00.000000000 Z
13
+ date: 2018-12-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws_cf_signer
@@ -171,7 +171,7 @@ files:
171
171
  - lib/cloudinary/carrier_wave/process.rb
172
172
  - lib/cloudinary/carrier_wave/remote.rb
173
173
  - lib/cloudinary/carrier_wave/storage.rb
174
- - lib/cloudinary/controller.rb
174
+ - lib/cloudinary/cloudinary_controller.rb
175
175
  - lib/cloudinary/downloader.rb
176
176
  - lib/cloudinary/engine.rb
177
177
  - lib/cloudinary/exceptions.rb
@@ -244,9 +244,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  requirements:
247
- - - ">"
247
+ - - ">="
248
248
  - !ruby/object:Gem::Version
249
- version: 1.3.1
249
+ version: '0'
250
250
  requirements: []
251
251
  rubyforge_project: cloudinary
252
252
  rubygems_version: 2.7.8