Class: Cloudinary::Api
Defined Under Namespace
Classes: AlreadyExists, AuthorizationRequired, BadRequest, Error, GeneralError, NotAllowed, NotFound, RateLimited, Response
Class Method Summary
collapse
-
.create_transformation(name, definition, options = {}) ⇒ Object
-
.delete_derived_resources(derived_resource_ids, options = {}) ⇒ Object
-
.delete_resources(public_ids, options = {}) ⇒ Object
-
.delete_resources_by_prefix(prefix, options = {}) ⇒ Object
-
.delete_resources_by_tag(tag, options = {}) ⇒ Object
-
.delete_transformation(transformation, options = {}) ⇒ Object
-
.resource(public_id, options = {}) ⇒ Object
-
.resource_types(options = {}) ⇒ Object
-
.resources(options = {}) ⇒ Object
-
.resources_by_tag(tag, options = {}) ⇒ Object
-
.tags(options = {}) ⇒ Object
-
.transformation(transformation, options = {}) ⇒ Object
-
.transformations(options = {}) ⇒ Object
-
.update_transformation(transformation, updates, options = {}) ⇒ Object
updates - supports: “allowed_for_strict” boolean “unsafe_update” transformation params - updates a named transformation parameters without regenerating existing images.
-
.usage(options = {}) ⇒ Object
Class Method Details
103
104
105
|
# File 'lib/cloudinary/api.rb', line 103
def self.create_transformation(name, definition, options={})
call_api(:post, "transformations/#{name}", {:transformation=>transformation_string(definition)}, options)
end
|
.delete_derived_resources(derived_resource_ids, options = {}) ⇒ Object
71
72
73
74
|
# File 'lib/cloudinary/api.rb', line 71
def self.delete_derived_resources(derived_resource_ids, options={})
uri = "derived_resources"
call_api(:delete, uri, {:derived_resource_ids=>derived_resource_ids}, options)
end
|
.delete_resources(public_ids, options = {}) ⇒ Object
51
52
53
54
55
56
|
# File 'lib/cloudinary/api.rb', line 51
def self.delete_resources(public_ids, options={})
resource_type = options[:resource_type] || "image"
type = options[:type] || "upload"
uri = "resources/#{resource_type}/#{type}"
call_api(:delete, uri, {:public_ids=>public_ids}.merge(only(options, :keep_original)), options)
end
|
.delete_resources_by_prefix(prefix, options = {}) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/cloudinary/api.rb', line 58
def self.delete_resources_by_prefix(prefix, options={})
resource_type = options[:resource_type] || "image"
type = options[:type] || "upload"
uri = "resources/#{resource_type}/#{type}"
call_api(:delete, uri, {:prefix=>prefix}.merge(only(options, :keep_original)), options)
end
|
.delete_resources_by_tag(tag, options = {}) ⇒ Object
65
66
67
68
69
|
# File 'lib/cloudinary/api.rb', line 65
def self.delete_resources_by_tag(tag, options={})
resource_type = options[:resource_type] || "image"
uri = "resources/#{resource_type}/tags/#{tag}"
call_api(:delete, uri, only(options, :keep_original), options)
end
|
90
91
92
|
# File 'lib/cloudinary/api.rb', line 90
def self.delete_transformation(transformation, options={})
call_api(:delete, "transformations/#{transformation_string(transformation)}", {}, options)
end
|
.resource(public_id, options = {}) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/cloudinary/api.rb', line 44
def self.resource(public_id, options={})
resource_type = options[:resource_type] || "image"
type = options[:type] || "upload"
uri = "resources/#{resource_type}/#{type}/#{public_id}"
call_api(:get, uri, only(options, :colors, :exif, :faces, :image_metadata, :pages, :max_results), options)
end
|
.resource_types(options = {}) ⇒ Object
26
27
28
|
# File 'lib/cloudinary/api.rb', line 26
def self.resource_types(options={})
call_api(:get, "resources", {}, options)
end
|
.resources(options = {}) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/cloudinary/api.rb', line 30
def self.resources(options={})
resource_type = options[:resource_type] || "image"
type = options[:type]
uri = "resources/#{resource_type}"
uri += "/#{type}" if !type.blank?
call_api(:get, uri, only(options, :next_cursor, :max_results, :prefix, :tags), options)
end
|
.resources_by_tag(tag, options = {}) ⇒ Object
38
39
40
41
42
|
# File 'lib/cloudinary/api.rb', line 38
def self.resources_by_tag(tag, options={})
resource_type = options[:resource_type] || "image"
uri = "resources/#{resource_type}/tags/#{tag}"
call_api(:get, uri, only(options, :next_cursor, :max_results), options)
end
|
76
77
78
79
80
|
# File 'lib/cloudinary/api.rb', line 76
def self.tags(options={})
resource_type = options[:resource_type] || "image"
uri = "tags/#{resource_type}"
call_api(:get, uri, only(options, :next_cursor, :max_results, :prefix), options)
end
|
86
87
88
|
# File 'lib/cloudinary/api.rb', line 86
def self.transformation(transformation, options={})
call_api(:get, "transformations/#{transformation_string(transformation)}", only(options, :max_results), options)
end
|
82
83
84
|
# File 'lib/cloudinary/api.rb', line 82
def self.transformations(options={})
call_api(:get, "transformations", only(options, :next_cursor, :max_results), options)
end
|
updates - supports:
"allowed_for_strict" boolean
"unsafe_update" transformation params - updates a named transformation parameters without regenerating existing images
97
98
99
100
101
|
# File 'lib/cloudinary/api.rb', line 97
def self.update_transformation(transformation, updates, options={})
params = only(updates, :allowed_for_strict)
params[:unsafe_update] = transformation_string(updates[:unsafe_update]) if updates[:unsafe_update]
call_api(:put, "transformations/#{transformation_string(transformation)}", params, options)
end
|
.usage(options = {}) ⇒ Object
22
23
24
|
# File 'lib/cloudinary/api.rb', line 22
def self.usage(options={})
call_api(:get, "usage", {}, options)
end
|