cloudinary 2.0.2 → 2.1.1
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 +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/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: 7c9fd54c62a8ad7408044ceb1be3178c98a250a3d874fc9b8f6f47f4e24b676c
|
4
|
+
data.tar.gz: 5b8b38c41734a1250c23f312e9afff293acddddc2ee86d506b1c0d0a16391520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4d6c84719bb67ab74ce7575374bfcfee1e3364fa86df4734a7a4146777b05b0f233aa8b3962b6ef86222bf2e91ee1b59be16ba8b7c00166c54da16c875669d0
|
7
|
+
data.tar.gz: a3af6962c29d2112425b55170a90b63309b1d11418f380b8151988e96f0a8d895fc44a6d1615f4eb0b3eab1d0dfdd47f5fcf6e3d1e2adcd06f7be261e7634d39
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
2.1.1 / 2024-05-28
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Fix regression in `cloudinary_url` generation
|
5
|
+
|
6
|
+
2.1.0 / 2024-05-27
|
7
|
+
==================
|
8
|
+
|
9
|
+
New functionality and features
|
10
|
+
------------------------------
|
11
|
+
|
12
|
+
* Add support for `rename_folder` Admin API
|
13
|
+
* Add support for `delete_access_key` in Provisioning API
|
14
|
+
|
15
|
+
Other Changes
|
16
|
+
-------------
|
17
|
+
|
18
|
+
* Fix detection of base64 encoded files with complex MIME type
|
19
|
+
* Fix `fetch` url generation with Active Storage `folder` configuration
|
20
|
+
* Fix usage of deprecated `File.exists?` method
|
21
|
+
|
1
22
|
2.0.2 / 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
|
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.
|
4
|
+
version: 2.1.1
|
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-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|