cloudinary 1.0.54 → 1.0.55
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.
- data/cloudinary.gemspec +1 -1
- data/lib/cloudinary/carrier_wave/process.rb +2 -0
- data/lib/cloudinary/helper.rb +10 -0
- data/lib/cloudinary/preloaded_file.rb +1 -1
- data/lib/cloudinary/uploader.rb +1 -1
- data/lib/cloudinary/version.rb +1 -1
- data/spec/utils_spec.rb +8 -0
- metadata +2 -2
data/cloudinary.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.rubyforge_project = "cloudinary"
|
17
17
|
|
18
|
-
s.files = `git ls-files`.split("\n") + Dir.glob("vendor/assets/javascripts/*/*") + Dir.glob("vendor/assets/html/*")
|
18
|
+
s.files = (`git ls-files`.split("\n") - `git ls-files samples`.split("\n")) + Dir.glob("vendor/assets/javascripts/*/*") + Dir.glob("vendor/assets/html/*")
|
19
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
@@ -132,6 +132,8 @@ module Cloudinary::CarrierWave
|
|
132
132
|
if format_processor
|
133
133
|
# Explicit format is given
|
134
134
|
format = Array(format_processor[1]).first
|
135
|
+
elsif self.transformation.include?(:format)
|
136
|
+
format = self.transformation[:format]
|
135
137
|
elsif self.version_name.present?
|
136
138
|
# No local format. The reset should be handled by main uploader
|
137
139
|
uploader = self.model.send(self.mounted_as)
|
data/lib/cloudinary/helper.rb
CHANGED
@@ -144,6 +144,16 @@ module CloudinaryHelper
|
|
144
144
|
|
145
145
|
def cloudinary_url(source, options = {})
|
146
146
|
options[:ssl_detected] = request.ssl? if defined?(request) && request && request.respond_to?(:ssl?)
|
147
|
+
if defined?(CarrierWave::Uploader::Base) && source.is_a?(CarrierWave::Uploader::Base)
|
148
|
+
if source.version_name.present?
|
149
|
+
options[:transformation] = Cloudinary::Utils.build_array(source.transformation) + Cloudinary::Utils.build_array(options[:transformation])
|
150
|
+
end
|
151
|
+
options.reverse_merge!(
|
152
|
+
:resource_type => Cloudinary::Utils.resource_type_for_format(source.filename || source.format),
|
153
|
+
:type => source.storage_type,
|
154
|
+
:format => source.format)
|
155
|
+
source = source.full_public_id
|
156
|
+
end
|
147
157
|
Cloudinary::Utils.cloudinary_url(source, options)
|
148
158
|
end
|
149
159
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Cloudinary::PreloadedFile
|
2
|
-
PRELOADED_CLOUDINARY_PATH = /^([^\/]+)\/([^\/]+)\/v(\d+)\/([
|
2
|
+
PRELOADED_CLOUDINARY_PATH = /^([^\/]+)\/([^\/]+)\/v(\d+)\/([^#]+)#([^\/]+)$/
|
3
3
|
|
4
4
|
attr_reader :filename, :version, :public_id, :signature, :resource_type, :type
|
5
5
|
def initialize(file_info)
|
data/lib/cloudinary/uploader.rb
CHANGED
@@ -200,7 +200,7 @@ class Cloudinary::Uploader
|
|
200
200
|
|
201
201
|
RestClient::Request.execute(:method => :post, :url => api_url, :payload => params.reject{|k, v| v.nil? || v==""}, :timeout=>60) do
|
202
202
|
|response, request, tmpresult|
|
203
|
-
raise CloudinaryException, "Server returned unexpected status code - #{response.code} - #{response.body}" if ![200,400,500].include?(response.code)
|
203
|
+
raise CloudinaryException, "Server returned unexpected status code - #{response.code} - #{response.body}" if ![200,400,401,403,404,500].include?(response.code)
|
204
204
|
begin
|
205
205
|
result = Cloudinary::Utils.json_decode(response.body)
|
206
206
|
rescue => e
|
data/lib/cloudinary/version.rb
CHANGED
data/spec/utils_spec.rb
CHANGED
@@ -11,6 +11,8 @@ describe Cloudinary::Utils do
|
|
11
11
|
config.secure = false
|
12
12
|
config.cname = nil
|
13
13
|
config.cdn_subdomains = false
|
14
|
+
config.api_key = "1234"
|
15
|
+
config.api_secret = "1234"
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -414,4 +416,10 @@ describe Cloudinary::Utils do
|
|
414
416
|
result = Cloudinary::Utils.cloudinary_url("test", :shorten=>true)
|
415
417
|
result.should == "http://res.cloudinary.com/test123/iu/test"
|
416
418
|
end
|
419
|
+
|
420
|
+
it "should allow to use folders in PreloadedFile" do
|
421
|
+
signature = Cloudinary::Utils.api_sign_request({:public_id=>"folder/file", :version=>"1234"}, Cloudinary.config.api_secret)
|
422
|
+
preloaded = Cloudinary::PreloadedFile.new("image/upload/v1234/folder/file.jpg#" + signature)
|
423
|
+
preloaded.should be_valid
|
424
|
+
end
|
417
425
|
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.0.
|
4
|
+
version: 1.0.55
|
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-04-
|
14
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|