cloudinary 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/lib/active_storage/service/cloudinary_service.rb +8 -4
- data/lib/cloudinary/account_api.rb +18 -0
- data/lib/cloudinary/api.rb +15 -0
- data/lib/cloudinary/carrier_wave/storage.rb +1 -1
- data/lib/cloudinary/helper.rb +1 -1
- data/lib/cloudinary/utils.rb +1 -1
- data/lib/cloudinary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ebe1af18bba09305ed12b463059d3d48e7673590b355aea4aef072a6d437348
|
4
|
+
data.tar.gz: a2129cbe78b2642aff5a974dc209aca465f59d2ea23ebfdf8a65fa57b74b0468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 212ab056a1cd705c76551a754b257e63e498ee1cbb11dfcd60f4d4ef63cbfc208c2440ac8bc80908de7661ca724194d724a2cf841cef1d260e7807f05ebf60f3
|
7
|
+
data.tar.gz: 90f4997c9994df2c9f8de3c45b23a885d39c8fc9c2cb49504f694d224597ba39e3d5d20f2619e9c826fae015a50dbee9bb28ddb25b430a40c7ee05ab9f6bd1cb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
2.1.0 / 2024-05-27
|
2
|
+
==================
|
3
|
+
|
4
|
+
New functionality and features
|
5
|
+
------------------------------
|
6
|
+
|
7
|
+
* Add support for `rename_folder` Admin API
|
8
|
+
* Add support for `delete_access_key` in Provisioning API
|
9
|
+
|
10
|
+
Other Changes
|
11
|
+
-------------
|
12
|
+
|
13
|
+
* Fix detection of base64 encoded files with complex MIME type
|
14
|
+
* Fix `fetch` url generation with Active Storage `folder` configuration
|
15
|
+
* Fix usage of deprecated `File.exists?` method
|
16
|
+
|
17
|
+
2.0.2 / 2024-04-09
|
18
|
+
==================
|
19
|
+
|
20
|
+
* Fix CarrierWave `store!` method
|
21
|
+
|
1
22
|
2.0.1 / 2024-04-09
|
2
23
|
==================
|
3
24
|
|
@@ -17,7 +17,9 @@ module CloudinaryHelper
|
|
17
17
|
alias cloudinary_url_internal_original cloudinary_url_internal
|
18
18
|
|
19
19
|
def cloudinary_url_internal(source, options = {})
|
20
|
-
|
20
|
+
if defined?(ActiveStorage::Blob.service.public_id) && options.fetch(:type, "").to_s != "fetch"
|
21
|
+
source = ActiveStorage::Blob.service.public_id(source)
|
22
|
+
end
|
21
23
|
cloudinary_url_internal_original(source, options)
|
22
24
|
end
|
23
25
|
end
|
@@ -58,7 +60,7 @@ module ActiveStorage
|
|
58
60
|
def url(key, filename: nil, content_type: '', **options)
|
59
61
|
instrument :url, key: key do |payload|
|
60
62
|
url = Cloudinary::Utils.cloudinary_url(
|
61
|
-
full_public_id_internal(key),
|
63
|
+
full_public_id_internal(key, options),
|
62
64
|
resource_type: resource_type(nil, key, content_type),
|
63
65
|
format: ext_for_file(key, filename, content_type),
|
64
66
|
**@options.merge(options.symbolize_keys)
|
@@ -231,10 +233,12 @@ module ActiveStorage
|
|
231
233
|
end
|
232
234
|
|
233
235
|
# Returns the full public id including folder.
|
234
|
-
def full_public_id_internal(key)
|
236
|
+
def full_public_id_internal(key, options = {})
|
235
237
|
public_id = public_id_internal(key)
|
236
238
|
|
237
|
-
|
239
|
+
options = @options.merge(options)
|
240
|
+
|
241
|
+
return public_id if !options[:folder] || options.fetch(:type).to_s == "fetch"
|
238
242
|
|
239
243
|
File.join(@options.fetch(:folder), public_id)
|
240
244
|
end
|
@@ -260,6 +260,24 @@ class Cloudinary::AccountApi
|
|
260
260
|
call_account_api(:put, ['sub_accounts', sub_account_id, 'access_keys', api_key], params, options.merge(content_type: :json))
|
261
261
|
end
|
262
262
|
|
263
|
+
# Deletes access key.
|
264
|
+
#
|
265
|
+
# @param [String] sub_account_id The ID of the sub-account.
|
266
|
+
# @param [String, nil] api_key The API key.
|
267
|
+
# @param [String, nil] name The display name as shown in the management console.
|
268
|
+
# @param [Object] options Additional options.
|
269
|
+
def self.delete_access_key(sub_account_id, api_key = nil, name = nil, options = {})
|
270
|
+
uri = ['sub_accounts', sub_account_id, 'access_keys']
|
271
|
+
unless api_key.blank?
|
272
|
+
uri.append(api_key)
|
273
|
+
end
|
274
|
+
|
275
|
+
params = {
|
276
|
+
name: name,
|
277
|
+
}
|
278
|
+
call_account_api(:delete, uri, params, options.merge(content_type: :json))
|
279
|
+
end
|
280
|
+
|
263
281
|
def self.call_account_api(method, uri, params, options)
|
264
282
|
account_id = options[:account_id] || Cloudinary.account_config.account_id || raise('Must supply account_id')
|
265
283
|
api_key = options[:provisioning_api_key] || Cloudinary.account_config.provisioning_api_key || raise('Must supply provisioning api_key')
|
data/lib/cloudinary/api.rb
CHANGED
@@ -731,6 +731,21 @@ class Cloudinary::Api
|
|
731
731
|
call_api(:post, "folders/#{folder_name}", {}, options)
|
732
732
|
end
|
733
733
|
|
734
|
+
# Renames existing asset folder.
|
735
|
+
#
|
736
|
+
# @param [String] from_path The full path of an existing asset folder.
|
737
|
+
# @param [String] to_path The full path of the new asset folder.
|
738
|
+
# @param [Hash] options The optional parameters.
|
739
|
+
#
|
740
|
+
# @return [Cloudinary::Api::Response]
|
741
|
+
#
|
742
|
+
# @raise [Cloudinary::Api::Error]
|
743
|
+
#
|
744
|
+
# @see https://cloudinary.com/documentation/admin_api#rename_folder
|
745
|
+
def self.rename_folder(from_path, to_path, options={})
|
746
|
+
call_api(:put, "folders/#{from_path}", {:to_folder => to_path}, options)
|
747
|
+
end
|
748
|
+
|
734
749
|
# Lists upload mappings by folder and its mapped template (URL).
|
735
750
|
#
|
736
751
|
# @param [Hash] options The optional parameters. See the
|
@@ -36,7 +36,7 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
|
|
36
36
|
params[:type]=uploader.class.storage_type
|
37
37
|
|
38
38
|
params[:resource_type] ||= :auto
|
39
|
-
upload_method = uploader.upload_chunked? ? "upload_large" : "upload"
|
39
|
+
upload_method = uploader.respond_to?(:upload_chunked?) && uploader.upload_chunked? ? "upload_large" : "upload"
|
40
40
|
uploader.metadata = Cloudinary::Uploader.send(upload_method, data, params)
|
41
41
|
if uploader.metadata["error"]
|
42
42
|
raise Cloudinary::CarrierWave::UploadError.new(uploader.metadata["error"]["message"], uploader.metadata["error"]["http_code"])
|
data/lib/cloudinary/helper.rb
CHANGED
@@ -179,7 +179,7 @@ module CloudinaryHelper
|
|
179
179
|
version_store = options.delete(:version_store)
|
180
180
|
if options[:version].blank? && (version_store == :file) && defined?(Rails) && defined?(Rails.root)
|
181
181
|
file_name = "#{Rails.root}/tmp/cloudinary/cloudinary_sprite_#{source.sub(/\..*/, '')}.version"
|
182
|
-
if File.
|
182
|
+
if File.exist?(file_name)
|
183
183
|
options[:version] = File.read(file_name).chomp
|
184
184
|
end
|
185
185
|
end
|
data/lib/cloudinary/utils.rb
CHANGED
@@ -153,7 +153,7 @@ class Cloudinary::Utils
|
|
153
153
|
zoom
|
154
154
|
].map(&:to_sym)
|
155
155
|
|
156
|
-
REMOTE_URL_REGEX = %r(^ftp:|^https?:|^s3:|^gs:|^data:([\w-]+\/[\w-]+(\+[\w-]+)?)?(;[\w-]+=[\w-]+)*;base64,([a-zA-Z0-9\/+\n=]+)$)
|
156
|
+
REMOTE_URL_REGEX = %r(^ftp:|^https?:|^s3:|^gs:|^data:([\w-]+\/[\w-]+(\.[\w-]+)*(\+[\w-]+)?)?(;[\w-]+=[\w-]+)*;base64,([a-zA-Z0-9\/+\n=]+)$)
|
157
157
|
|
158
158
|
LONG_URL_SIGNATURE_LENGTH = 32
|
159
159
|
SHORT_URL_SIGNATURE_LENGTH = 8
|
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: 2.0
|
4
|
+
version: 2.1.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: 2024-
|
13
|
+
date: 2024-05-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|