cloudinary 1.0.38 → 1.0.39

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/lib/cloudinary.rb CHANGED
@@ -35,19 +35,7 @@ module Cloudinary
35
35
  "private_cdn" => ENV["CLOUDINARY_PRIVATE_CDN"].to_s == 'true'
36
36
  )
37
37
  elsif first_time && ENV["CLOUDINARY_URL"]
38
- uri = URI.parse(ENV["CLOUDINARY_URL"])
39
- set_config(
40
- "cloud_name" => uri.host,
41
- "api_key" => uri.user,
42
- "api_secret" => uri.password,
43
- "private_cdn" => !uri.path.blank?,
44
- "secure_distribution" => uri.path[1..-1]
45
- )
46
- uri.query.to_s.split("&").each do
47
- |param|
48
- key, value = param.split("=")
49
- set_config(key=>URI.decode(value))
50
- end
38
+ config_from_url(ENV["CLOUDINARY_URL"])
51
39
  end
52
40
 
53
41
  set_config(new_config) if new_config
@@ -56,6 +44,22 @@ module Cloudinary
56
44
  @@config
57
45
  end
58
46
 
47
+ def self.config_from_url(url)
48
+ uri = URI.parse(url)
49
+ set_config(
50
+ "cloud_name" => uri.host,
51
+ "api_key" => uri.user,
52
+ "api_secret" => uri.password,
53
+ "private_cdn" => !uri.path.blank?,
54
+ "secure_distribution" => uri.path[1..-1]
55
+ )
56
+ uri.query.to_s.split("&").each do
57
+ |param|
58
+ key, value = param.split("=")
59
+ set_config(key=>URI.decode(value))
60
+ end
61
+ end
62
+
59
63
  private
60
64
 
61
65
  def self.config_env
@@ -40,7 +40,7 @@ class Cloudinary::Api
40
40
  resource_type = options[:resource_type] || "image"
41
41
  type = options[:type] || "upload"
42
42
  uri = "resources/#{resource_type}/#{type}/#{public_id}"
43
- call_api(:get, uri, only(options, :colors, :exif, :faces), options)
43
+ call_api(:get, uri, only(options, :colors, :exif, :faces, :max_results), options)
44
44
  end
45
45
 
46
46
  def self.delete_resources(public_ids, options={})
@@ -50,8 +50,9 @@ class Cloudinary::Api
50
50
  call_api(:delete, uri, {:public_ids=>public_ids}, options)
51
51
  end
52
52
 
53
- def self.delete_resources_by_prefix(type, prefix, options={})
53
+ def self.delete_resources_by_prefix(prefix, options={})
54
54
  resource_type = options[:resource_type] || "image"
55
+ type = options[:type] || "upload"
55
56
  uri = "resources/#{resource_type}/#{type}"
56
57
  call_api(:delete, uri, {:prefix=>prefix}, options)
57
58
  end
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.38"
3
+ VERSION = "1.0.39"
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.38
4
+ version: 1.0.39
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: 2012-10-02 00:00:00.000000000 Z
14
+ date: 2012-10-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client