cloudinary 1.0.60 → 1.0.61

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/README.md CHANGED
@@ -11,6 +11,9 @@ Cloudinary provides URL and HTTP based APIs that can be easily integrated with a
11
11
 
12
12
  For Ruby on Rails, Cloudinary provides a GEM for simplifying the integration even further.
13
13
 
14
+ ## Getting started guide
15
+ ![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **Take a look at our [Getting started guide of Ruby on Rails](http://cloudinary.com/documentation/rails_integration#getting_started_guide)**.
16
+
14
17
  ## Setup ######################################################################
15
18
 
16
19
  To install the Cloudinary Ruby GEM, run:
@@ -114,7 +117,8 @@ Same goes for Twitter:
114
117
 
115
118
  twitter_name_profile_image_tag("billclinton.jpg")
116
119
 
117
- See [our documentation](http://cloudinary.com/documentation/rails_integration#display_and_transform) for more information about displaying and transforming images in Rails.
120
+ ![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/rails_image_manipulation) for more information about displaying and transforming images in Rails**.
121
+
118
122
 
119
123
 
120
124
  ### Upload
@@ -138,8 +142,9 @@ You can also specify your own public ID:
138
142
  cl_image_tag("sample_remote.jpg")
139
143
 
140
144
  http://res.cloudinary.com/demo/image/upload/sample_remote.jpg
141
-
142
- See [our documentation](http://cloudinary.com/documentation/rails_integration#direct_upload) for plenty more options of direct uploading to the cloud from your Ruby code.
145
+
146
+
147
+ ![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **See [our documentation](http://cloudinary.com/documentation/rails_image_upload) for plenty more options of uploading to the cloud from your Ruby code or directly from the browser**.
143
148
 
144
149
 
145
150
  ### CarrierWave Integration
@@ -151,7 +156,7 @@ Cloudinary's Ruby GEM includes an optional plugin for [CarrierWave](https://gith
151
156
  ...
152
157
  end
153
158
 
154
- For more details on CarrierWave integration see [our documentation](http://cloudinary.com/documentation/rails_integration#carrierwave_upload).
159
+ ![](http://res.cloudinary.com/cloudinary/image/upload/see_more_bullet.png) **For more details on CarrierWave integration see [our documentation](http://cloudinary.com/documentation/rails_carrierwave)**.
155
160
 
156
161
  We also published an interesting blog post about [Ruby on Rails image uploads with CarrierWave and Cloudinary](http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary).
157
162
 
@@ -167,17 +172,20 @@ Additional resources are available at:
167
172
 
168
173
  * [Website](http://cloudinary.com)
169
174
  * [Documentation](http://cloudinary.com/documentation)
175
+ * [Knowledge Base](http://support.cloudinary.com/forums)
170
176
  * [Documentation for Ruby on Rails integration](http://cloudinary.com/documentation/rails_integration)
177
+ * [Ruby on Rails image upload documentation](http://cloudinary.com/documentation/rails_image_upload)
178
+ * [Ruby on Rails image manipulation documentation](http://cloudinary.com/documentation/rails_image_manipulation)
171
179
  * [Image transformations documentation](http://cloudinary.com/documentation/image_transformations)
172
- * [Upload API documentation](http://cloudinary.com/documentation/upload_images)
173
180
 
174
181
  ## Support
175
182
 
176
183
  You can [open an issue through GitHub](https://github.com/cloudinary/cloudinary_gem/issues).
177
184
 
178
- Contact us at [info@cloudinary.com](mailto:info@cloudinary.com)
185
+ Contact us [http://cloudinary.com/contact](http://cloudinary.com/contact)
186
+
187
+ Stay tuned for updates, tips and tutorials: [Blog](http://cloudinary.com/blog), [Twitter](https://twitter.com/cloudinary), [Facebook](http://www.facebook.com/Cloudinary).
179
188
 
180
- Or via Twitter: [@cloudinary](https://twitter.com/#!/cloudinary)
181
189
 
182
190
  ## License #######################################################################
183
191
 
@@ -18,6 +18,10 @@ class Cloudinary::Api
18
18
  @rate_limit_remaining = response.headers[:x_featureratelimit_remaining].to_i
19
19
  end
20
20
  end
21
+
22
+ def self.ping(options={})
23
+ call_api(:get, "ping", {}, options)
24
+ end
21
25
 
22
26
  def self.usage(options={})
23
27
  call_api(:get, "usage", {}, options)
@@ -20,7 +20,9 @@ module Cloudinary::CarrierWave
20
20
  end
21
21
 
22
22
  def retrieve_from_store!(identifier)
23
- if identifier.blank?
23
+ # Workaround cloudinary-mongoid hack of setting column to _old_ before saving it.
24
+ mongoid_blank = defined?(Mongoid::Extensions::Object) && self.is_a?(Mongoid::Extensions::Object) && identifier == "_old_"
25
+ if identifier.blank? || mongoid_blank
24
26
  @file = @stored_version = @stored_public_id = nil
25
27
  self.original_filename = nil
26
28
  else
@@ -6,30 +6,30 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
6
6
  case file
7
7
  when Cloudinary::CarrierWave::PreloadedCloudinaryFile
8
8
  storage_type = uploader.class.storage_type || "upload"
9
- raise CloudinaryException, "Uploader configured for type #{storage_type} but resource of type #{file.type} given." if storage_type != file.type
9
+ raise CloudinaryException, "Uploader configured for type #{storage_type} but resource of type #{file.type} given." if storage_type != file.type
10
10
  if uploader.public_id && uploader.auto_rename_preloaded?
11
11
  @stored_version = file.version
12
12
  uploader.rename(nil, true)
13
13
  else
14
14
  store_cloudinary_identifier(file.version, file.filename)
15
- end
16
- return
15
+ end
16
+ return
17
17
  when Cloudinary::CarrierWave::CloudinaryFile
18
18
  return nil # Nothing to do
19
19
  when Cloudinary::CarrierWave::RemoteFile
20
20
  data = file.uri.to_s
21
- else
21
+ else
22
22
  data = file.file
23
23
  data.rewind if !file.is_path? && data.respond_to?(:rewind)
24
24
  end
25
-
26
- # This is the toplevel, need to upload the actual file.
25
+
26
+ # This is the toplevel, need to upload the actual file.
27
27
  params = uploader.transformation.dup
28
28
  params[:return_error] = true
29
29
  params[:format] = uploader.format
30
30
  params[:public_id] = uploader.my_public_id
31
31
  uploader.versions.values.each(&:tags) # Validate no tags in versions
32
- params[:tags] = uploader.tags if uploader.tags
32
+ params[:tags] = uploader.tags if uploader.tags
33
33
  eager_versions = uploader.versions.values.select(&:eager)
34
34
  params[:eager] = eager_versions.map{|version| [version.transformation, version.format]} if eager_versions.length > 0
35
35
  params[:type]=uploader.class.storage_type
@@ -40,11 +40,11 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
40
40
  if uploader.metadata["error"]
41
41
  raise Cloudinary::CarrierWave::UploadError.new(uploader.metadata["error"]["message"], uploader.metadata["error"]["http_code"])
42
42
  end
43
-
43
+
44
44
  if uploader.metadata["version"]
45
- filename = [uploader.metadata["public_id"], uploader.metadata["format"]].reject(&:blank?).join(".")
45
+ filename = [uploader.metadata["public_id"], uploader.metadata["format"]].reject(&:blank?).join(".")
46
46
  store_cloudinary_identifier(uploader.metadata["version"], filename)
47
- end
47
+ end
48
48
  # Will throw an exception on error
49
49
  else
50
50
  raise CloudinaryException, "nested versions are not allowed." if (uploader.class.version_names.length > 1)
@@ -52,15 +52,15 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
52
52
  end
53
53
  nil
54
54
  end
55
-
55
+
56
56
  # @deprecated For backward compatibility
57
57
  def store_cloudinary_version(version)
58
58
  if identifier.match(%r(^(v[0-9]+)/(.*)))
59
59
  filename = $2
60
- else
60
+ else
61
61
  filename = identifier
62
62
  end
63
-
63
+
64
64
  store_cloudinary_identifier(version, filename)
65
65
  end
66
66
 
@@ -78,12 +78,16 @@ class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
78
78
  uploader.model.send :write_attribute, column, name
79
79
  elsif defined?(Mongoid::Document) && uploader.model.is_a?(Mongoid::Document)
80
80
  # Mongoid support
81
- uploader.model.set(column, name)
81
+ if Mongoid::VERSION.split(".").first.to_i >= 4
82
+ uploader.model.set(:"#{column}" => name)
83
+ else
84
+ uploader.model.set(column, name)
85
+ end
82
86
  elsif model_class.respond_to?(:update_all) && uploader.model.respond_to?(:_id)
83
87
  model_class.where(:_id=>uploader.model._id).update_all(column=>name)
84
88
  uploader.model.send :write_attribute, column, name
85
89
  else
86
90
  raise CloudinaryException, "Only ActiveRecord and Mongoid are supported at the moment!"
87
91
  end
88
- end
92
+ end
89
93
  end
@@ -228,7 +228,7 @@ if defined? ActionView::Helpers::AssetUrlHelper
228
228
  module ActionView::Helpers::AssetUrlHelper
229
229
  alias :original_path_to_asset :path_to_asset
230
230
 
231
- def path_to_asset(source, options)
231
+ def path_to_asset(source, options={})
232
232
  options ||= {}
233
233
  if Cloudinary.config.enhance_image_tag && options[:type] == :image
234
234
  source = Cloudinary::Utils.cloudinary_url(source, options.merge(:type=>:asset))
@@ -42,7 +42,7 @@ class Cloudinary::Uploader
42
42
  def self.upload(file, options={})
43
43
  call_api("upload", options) do
44
44
  params = build_upload_params(options)
45
- if file.respond_to?(:read) || file =~ /^https?:|^s3:|^data:image\/\w*;base64,([a-zA-Z0-9\/+\n=]+)$/
45
+ if file.respond_to?(:read) || file =~ /^https?:|^s3:|^data:[^;]*;base64,([a-zA-Z0-9\/+\n=]+)$/
46
46
  params[:file] = file
47
47
  else
48
48
  params[:file] = File.open(file, "rb")
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.60"
3
+ VERSION = "1.0.61"
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.60
4
+ version: 1.0.61
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-07-01 00:00:00.000000000 Z
14
+ date: 2013-07-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client