cloudinary 1.0.44 → 1.0.45

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.
@@ -124,7 +124,8 @@ module Cloudinary::CarrierWave
124
124
  end
125
125
 
126
126
  def delete
127
- Cloudinary::Uploader.destroy(self.public_id, :type=>self.storage_type, :resource_type=>self.resource_type) if @uploader.delete_remote?
127
+ public_id = @resource_type == "raw" ? self.filename : self.public_id
128
+ Cloudinary::Uploader.destroy(public_id, :type=>self.storage_type, :resource_type=>self.resource_type) if @uploader.delete_remote?
128
129
  end
129
130
 
130
131
  def exists?
@@ -5,6 +5,7 @@ module Cloudinary::CarrierWave
5
5
  else # Backward compatibility with old CarrierWave
6
6
  uri = URI.parse(URI.escape(URI.unescape(uri)))
7
7
  end
8
+ return if uri.to_s.blank?
8
9
  self.original_filename = @cache_id = @filename = File.basename(uri.path).gsub(/[^a-zA-Z0-9\.\-\+_]/, '')
9
10
  @file = RemoteFile.new(uri, @filename)
10
11
  end
@@ -30,6 +30,9 @@ class Cloudinary::Uploader
30
30
  :eager=>build_eager(options[:eager]),
31
31
  :headers=>build_custom_headers(options[:headers]),
32
32
  :use_filename=>options[:use_filename],
33
+ :notification_url=>options[:notification_url],
34
+ :eager_notification_url=>options[:eager_notification_url],
35
+ :eager_async=>options[:eager_async],
33
36
  :tags=>options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(",")}
34
37
  params
35
38
  end
@@ -97,6 +100,8 @@ class Cloudinary::Uploader
97
100
  {
98
101
  :timestamp=>Time.now.to_i,
99
102
  :tag=>tag,
103
+ :async=>options[:async],
104
+ :notification_url=>options[:notification_url],
100
105
  :transformation => Cloudinary::Utils.generate_transformation_string(options.merge(:fetch_format=>options[:format]))
101
106
  }
102
107
  end
@@ -109,7 +114,33 @@ class Cloudinary::Uploader
109
114
  end
110
115
  return result
111
116
  end
117
+
118
+ def self.multi(tag, options={})
119
+ call_api("multi", options) do
120
+ {
121
+ :timestamp=>Time.now.to_i,
122
+ :tag=>tag,
123
+ :format=>options[:format],
124
+ :async=>options[:async],
125
+ :notification_url=>options[:notification_url],
126
+ :transformation => Cloudinary::Utils.generate_transformation_string(options)
127
+ }
128
+ end
129
+ end
112
130
 
131
+ def self.explode(public_id, options={})
132
+ call_api("explode", options) do
133
+ {
134
+ :timestamp=>Time.now.to_i,
135
+ :public_id=>public_id,
136
+ :type=>options[:type],
137
+ :format=>options[:format],
138
+ :notification_url=>options[:notification_url],
139
+ :transformation => Cloudinary::Utils.generate_transformation_string(options)
140
+ }
141
+ end
142
+ end
143
+
113
144
  # options may include 'exclusive' (boolean) which causes clearing this tag from all other resources
114
145
  def self.add_tag(tag, public_ids = [], options = {})
115
146
  exclusive = options.delete(:exclusive)
@@ -103,6 +103,9 @@ class Cloudinary::Utils
103
103
 
104
104
  original_source = source
105
105
  return original_source if source.blank?
106
+ if defined?(CarrierWave::Uploader::Base) && source.is_a?(CarrierWave::Uploader::Base)
107
+ source = format.blank? ? source.filename : source.full_public_id
108
+ end
106
109
  source = source.to_s
107
110
  if !force_remote
108
111
  return original_source if (type.nil? || type == :asset) && source.match(%r(^https?:/)i)
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.44"
3
+ VERSION = "1.0.45"
4
4
  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.44
4
+ version: 1.0.45
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-02-05 00:00:00.000000000 Z
14
+ date: 2013-02-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client