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/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.2.2'
Class Method Summary
collapse
Class Method Details
35
36
37
38
39
|
# File 'lib/resizing.rb', line 35
def self.configure
raise ConfigurationError, 'Resizing.configure is not initialized' unless defined? @configure
@configure.dup
end
|
41
42
43
44
|
# File 'lib/resizing.rb', line 41
def self.configure=(new_value)
new_value = Configuration.new(new_value) unless new_value.is_a? Configuration
@configure = new_value
end
|
.delete(name) ⇒ Object
62
63
64
|
# File 'lib/resizing.rb', line 62
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: ^^^^^^^^
78
79
80
|
# File 'lib/resizing.rb', line 78
def self.generate_identifier
Resizing.configure.generate_identifier
end
|
.get(name) ⇒ Object
46
47
48
|
# File 'lib/resizing.rb', line 46
def self.get(name)
raise NotImplementedError
end
|
66
67
68
|
# File 'lib/resizing.rb', line 66
def self.metadata(name, options)
client.metadata name, options
end
|
.post(file_or_binary, options) ⇒ Object
54
55
56
|
# File 'lib/resizing.rb', line 54
def self.post(file_or_binary, options)
client.post file_or_binary, options
end
|
.put(name, file_or_binary, options) ⇒ Object
58
59
60
|
# File 'lib/resizing.rb', line 58
def self.put(name, file_or_binary, options)
client.put name, file_or_binary, options
end
|
.separate_public_id(public_id) ⇒ Object
82
83
84
|
# File 'lib/resizing.rb', line 82
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
50
51
52
|
# File 'lib/resizing.rb', line 50
def self.url_from_image_id(image_id, version_id = nil, transformations = [])
Resizing.configure.generate_image_url(image_id, version_id, transformations)
end
|