Module: Resizing
- Defined in:
- lib/resizing.rb,
lib/resizing/client.rb,
lib/resizing/version.rb,
lib/resizing/constants.rb,
lib/resizing/public_id.rb,
lib/resizing/mock_client.rb,
lib/resizing/carrier_wave.rb,
lib/resizing/configurable.rb,
lib/resizing/configuration.rb,
lib/resizing/active_storage.rb,
lib/resizing/http_clientable.rb,
lib/resizing/active_storage/service.rb,
lib/resizing/carrier_wave/storage/file.rb,
lib/resizing/carrier_wave/callback_file.rb,
lib/resizing/carrier_wave/storage/remote.rb,
lib/resizing/active_storage/service/resizing_service.rb
Defined Under Namespace
Modules: ActiveStorage, CarrierWave, Configurable, Constants, HttpClientable
Classes: APIError, Client, Configuration, ConfigurationError, Error, MockClient, PublicId
Constant Summary
collapse
- VERSION =
'1.3.1'
Class Method Summary
collapse
Class Method Details
34
35
36
37
38
|
# File 'lib/resizing.rb', line 34
def self.configure
raise ConfigurationError, 'Resizing.configure is not initialized' unless defined? @configure
@configure.dup
end
|
40
41
42
43
|
# File 'lib/resizing.rb', line 40
def self.configure=(new_value)
new_value = Configuration.new(new_value) unless new_value.is_a? Configuration
@configure = new_value
end
|
.delete(name) ⇒ Object
61
62
63
|
# File 'lib/resizing.rb', line 61
def self.delete(name)
client.delete name
end
|
.generate_identifier ⇒ Object
TODO: refactoring
identifier:
public_id: /projects/<project_id>/upload/images/<image_id>/v
identifier: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project_id: ^^^^^^^^^^^^^
image_id: ^^^^^^^^^^
version: ^^^^^^^^
77
78
79
|
# File 'lib/resizing.rb', line 77
def self.generate_identifier
Resizing.configure.generate_identifier
end
|
.get(name) ⇒ Object
45
46
47
|
# File 'lib/resizing.rb', line 45
def self.get(name)
raise NotImplementedError
end
|
65
66
67
|
# File 'lib/resizing.rb', line 65
def self.metadata(name, options)
client.metadata name, options
end
|
.post(file_or_binary, options) ⇒ Object
53
54
55
|
# File 'lib/resizing.rb', line 53
def self.post(file_or_binary, options)
client.post file_or_binary, options
end
|
.put(name, file_or_binary, options) ⇒ Object
57
58
59
|
# File 'lib/resizing.rb', line 57
def self.put(name, file_or_binary, options)
client.put name, file_or_binary, options
end
|
.separate_public_id(public_id) ⇒ Object
81
82
83
|
# File 'lib/resizing.rb', line 81
def self.separate_public_id(public_id)
public_id.match('/projects/(?<project_id>[0-9a-f-]+)/upload/images/(?<image_id>[^/]+)(/v(?<version>[^/]+))?')
end
|
.url_from_image_id(image_id, version_id = nil, transformations = []) ⇒ Object
49
50
51
|
# File 'lib/resizing.rb', line 49
def self.url_from_image_id(image_id, version_id = nil, transformations = [])
Resizing.configure.generate_image_url(image_id, version_id, transformations)
end
|