cloudinary 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/cloudinary.rb +21 -17
- data/lib/cloudinary/api.rb +3 -2
- data/lib/cloudinary/carrier_wave/remote.rb +2 -2
- data/lib/cloudinary/uploader.rb +2 -1
- data/lib/cloudinary/utils.rb +2 -6
- data/lib/cloudinary/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c4d1942e462293cb9a3cf7d73878104de63cc041ad6c9a82ae985e9ce1c6dd7
|
4
|
+
data.tar.gz: fd09572e0b1be22051a711fb7aacfc1f3f46856531b5c0a3caf50fea49eabae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66eea468a7816511382761d6ab667c39b4f90da2c765871d99a69d34091949a3fc8d4d2245cd3b53f18560a99eea59fdd2cdd0173d8e41e6ab8e040236d52dc4
|
7
|
+
data.tar.gz: 65c5d8536b106b88f6bf8de3a540df6ffed3f6fed39141d6dfbf47a5ae6b11f3ec37699722e5b20e8fe35c86f452f29ec0ba9b9f5edc776ce81efebbf8cd14f8
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
|
2
|
+
1.15.0 / 2020-06-11
|
3
|
+
===================
|
4
|
+
|
5
|
+
New functionality and features
|
6
|
+
------------------------------
|
7
|
+
|
8
|
+
* Add support for `accessibility_analysis` parameter
|
9
|
+
|
10
|
+
Other Changes
|
11
|
+
-------------
|
12
|
+
* Fix `download` function in `Cloudinary::CarrierWave`
|
13
|
+
* Fix handling of empty value in `if` parameter
|
14
|
+
* Fix consumption of configuration from environment variables
|
15
|
+
|
2
16
|
1.14.0 / 2020-05-06
|
3
17
|
===================
|
4
18
|
|
data/lib/cloudinary.rb
CHANGED
@@ -64,19 +64,7 @@ module Cloudinary
|
|
64
64
|
first_time = @@config.nil?
|
65
65
|
@@config ||= OpenStruct.new((YAML.load(ERB.new(IO.read(config_dir.join("cloudinary.yml"))).result)[config_env] rescue {}))
|
66
66
|
|
67
|
-
|
68
|
-
if first_time && ENV["CLOUDINARY_CLOUD_NAME"]
|
69
|
-
set_config(
|
70
|
-
"cloud_name" => ENV["CLOUDINARY_CLOUD_NAME"],
|
71
|
-
"api_key" => ENV["CLOUDINARY_API_KEY"],
|
72
|
-
"api_secret" => ENV["CLOUDINARY_API_SECRET"],
|
73
|
-
"secure_distribution" => ENV["CLOUDINARY_SECURE_DISTRIBUTION"],
|
74
|
-
"private_cdn" => ENV["CLOUDINARY_PRIVATE_CDN"].to_s == 'true',
|
75
|
-
"secure" => ENV["CLOUDINARY_SECURE"].to_s == 'true'
|
76
|
-
)
|
77
|
-
elsif first_time && ENV["CLOUDINARY_URL"]
|
78
|
-
config_from_url(ENV["CLOUDINARY_URL"])
|
79
|
-
end
|
67
|
+
config_from_env if first_time
|
80
68
|
|
81
69
|
set_config(new_config) if new_config
|
82
70
|
yield(@@config) if block_given?
|
@@ -140,18 +128,34 @@ module Cloudinary
|
|
140
128
|
end
|
141
129
|
|
142
130
|
private
|
143
|
-
|
131
|
+
|
132
|
+
def self.config_from_env
|
133
|
+
# Heroku support
|
134
|
+
if ENV["CLOUDINARY_CLOUD_NAME"]
|
135
|
+
config_keys = ENV.keys.select! { |key| key.start_with? "CLOUDINARY_" }
|
136
|
+
config_keys -= ["CLOUDINARY_URL"] # ignore it when explicit options are passed
|
137
|
+
config_keys.each do |full_key|
|
138
|
+
conf_key = full_key["CLOUDINARY_".length..-1].downcase # convert "CLOUDINARY_CONFIG_NAME" to "config_name"
|
139
|
+
conf_val = ENV[full_key]
|
140
|
+
conf_val = conf_val == 'true' if %w[true false].include?(conf_val) # cast relevant boolean values
|
141
|
+
set_config(conf_key => conf_val)
|
142
|
+
end
|
143
|
+
elsif ENV["CLOUDINARY_URL"]
|
144
|
+
config_from_url(ENV["CLOUDINARY_URL"])
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
144
148
|
def self.config_env
|
145
149
|
return ENV["CLOUDINARY_ENV"] if ENV["CLOUDINARY_ENV"]
|
146
150
|
return Rails.env if defined? Rails::env
|
147
151
|
nil
|
148
152
|
end
|
149
|
-
|
153
|
+
|
150
154
|
def self.config_dir
|
151
|
-
return Pathname.new(ENV["CLOUDINARY_CONFIG_DIR"]) if ENV["CLOUDINARY_CONFIG_DIR"]
|
155
|
+
return Pathname.new(ENV["CLOUDINARY_CONFIG_DIR"]) if ENV["CLOUDINARY_CONFIG_DIR"]
|
152
156
|
self.app_root.join("config")
|
153
157
|
end
|
154
|
-
|
158
|
+
|
155
159
|
def self.set_config(new_config)
|
156
160
|
new_config.each{|k,v| @@config.send(:"#{k}=", v) if !v.nil?}
|
157
161
|
end
|
data/lib/cloudinary/api.rb
CHANGED
@@ -78,7 +78,7 @@ 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,
|
81
|
+
call_api(:get, uri,
|
82
82
|
only(options,
|
83
83
|
:cinemagraph_analysis,
|
84
84
|
:colors,
|
@@ -90,7 +90,8 @@ class Cloudinary::Api
|
|
90
90
|
:pages,
|
91
91
|
:phash,
|
92
92
|
:quality_analysis,
|
93
|
-
:derived_next_cursor
|
93
|
+
:derived_next_cursor,
|
94
|
+
:accessibility_analysis
|
94
95
|
), options)
|
95
96
|
end
|
96
97
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Cloudinary::CarrierWave
|
2
2
|
def download!(uri, *args)
|
3
|
-
return super
|
3
|
+
return super unless self.cloudinary_should_handle_remote?
|
4
4
|
if respond_to?(:process_uri)
|
5
5
|
uri = process_uri(uri)
|
6
6
|
else # Backward compatibility with old CarrierWave
|
7
|
-
uri = URI.parse(Utils.smart_escape(Utils.smart_unescape(uri)))
|
7
|
+
uri = URI.parse(Cloudinary::Utils.smart_escape(Cloudinary::Utils.smart_unescape(uri)))
|
8
8
|
end
|
9
9
|
return if uri.to_s.blank?
|
10
10
|
self.original_filename = @cache_id = @filename = File.basename(uri.path).gsub(/[^a-zA-Z0-9\.\-\+_]/, '')
|
data/lib/cloudinary/uploader.rb
CHANGED
@@ -64,6 +64,7 @@ class Cloudinary::Uploader
|
|
64
64
|
:unique_filename => Cloudinary::Utils.as_safe_bool(options[:unique_filename]),
|
65
65
|
:upload_preset => options[:upload_preset],
|
66
66
|
:use_filename => Cloudinary::Utils.as_safe_bool(options[:use_filename]),
|
67
|
+
:accessibility_analysis => Cloudinary::Utils.as_safe_bool(options[:accessibility_analysis])
|
67
68
|
}
|
68
69
|
params
|
69
70
|
end
|
@@ -248,7 +249,7 @@ class Cloudinary::Uploader
|
|
248
249
|
end
|
249
250
|
end
|
250
251
|
|
251
|
-
# options may include 'exclusive' (boolean) which causes clearing this tag from all other resources
|
252
|
+
# options may include 'exclusive' (boolean) which causes clearing this tag from all other resources
|
252
253
|
def self.add_tag(tag, public_ids = [], options = {})
|
253
254
|
exclusive = options.delete(:exclusive)
|
254
255
|
command = exclusive ? "set_exclusive" : "add"
|
data/lib/cloudinary/utils.rb
CHANGED
@@ -302,12 +302,8 @@ class Cloudinary::Utils
|
|
302
302
|
# Translates the condition if provided.
|
303
303
|
# @return [string] "if_" + ifValue
|
304
304
|
# @private
|
305
|
-
def self.process_if(
|
306
|
-
|
307
|
-
ifValue = normalize_expression(ifValue)
|
308
|
-
|
309
|
-
ifValue = "if_" + ifValue
|
310
|
-
end
|
305
|
+
def self.process_if(if_value)
|
306
|
+
"if_" + normalize_expression(if_value) unless if_value.to_s.empty?
|
311
307
|
end
|
312
308
|
|
313
309
|
EXP_REGEXP = Regexp.new(PREDEFINED_VARS.keys.join("|")+'|('+CONDITIONAL_OPERATORS.keys.reverse.map { |k| Regexp.escape(k) }.join('|')+')(?=[ _])')
|
data/lib/cloudinary/version.rb
CHANGED
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.
|
4
|
+
version: 1.15.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: 2020-
|
13
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws_cf_signer
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
- !ruby/object:Gem::Version
|
254
254
|
version: '0'
|
255
255
|
requirements: []
|
256
|
-
rubygems_version: 3.
|
256
|
+
rubygems_version: 3.1.4
|
257
257
|
signing_key:
|
258
258
|
specification_version: 4
|
259
259
|
summary: Client library for easily using the Cloudinary service
|