Class: CarrierWave::Storage::IKFile
- Inherits:
-
Object
- Object
- CarrierWave::Storage::IKFile
- Defined in:
- lib/carrierwave/storage/ik_file.rb
Instance Method Summary collapse
-
#content_type ⇒ Object
Duck-type methods for CarrierWave::SanitizedFile.
- #delete ⇒ Object
-
#exists? ⇒ Boolean
binding.pry return nil.
- #fileId ⇒ Object
- #filename(options = {}) ⇒ Object
-
#initialize(identifier) ⇒ IKFile
constructor
Initialize as required.
- #public_url ⇒ Object
- #read ⇒ Object
- #size ⇒ Object
- #url(options = {}) ⇒ Object
Constructor Details
#initialize(identifier) ⇒ IKFile
Initialize as required.
6 7 8 9 10 |
# File 'lib/carrierwave/storage/ik_file.rb', line 6 def initialize(identifier) @identifier=JSON.parse(identifier) ik_config=Rails.application.config.imagekit @imagekit=ImageKit::ImageKitClient.new(ik_config[:private_key],ik_config[:public_key],ik_config[:url_endpoint]) end |
Instance Method Details
#content_type ⇒ Object
Duck-type methods for CarrierWave::SanitizedFile.
13 14 15 |
# File 'lib/carrierwave/storage/ik_file.rb', line 13 def content_type "image/jpg" end |
#delete ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/carrierwave/storage/ik_file.rb', line 33 def delete # file_id=@identifier['fileId'] begin @imagekit.delete_file(fileId) rescue fileId end # binding.pry # return nil end |
#exists? ⇒ Boolean
binding.pry return nil
43 44 |
# File 'lib/carrierwave/storage/ik_file.rb', line 43 def exists? end |
#fileId ⇒ Object
23 24 25 |
# File 'lib/carrierwave/storage/ik_file.rb', line 23 def fileId @identifier['fileId'] end |
#filename(options = {}) ⇒ Object
26 27 28 |
# File 'lib/carrierwave/storage/ik_file.rb', line 26 def filename( = {}) @identifier['name'] end |
#public_url ⇒ Object
16 17 18 |
# File 'lib/carrierwave/storage/ik_file.rb', line 16 def public_url @identifier['url'] end |
#read ⇒ Object
29 30 |
# File 'lib/carrierwave/storage/ik_file.rb', line 29 def read end |
#size ⇒ Object
31 32 |
# File 'lib/carrierwave/storage/ik_file.rb', line 31 def size end |
#url(options = {}) ⇒ Object
19 20 21 |
# File 'lib/carrierwave/storage/ik_file.rb', line 19 def url( = {}) @identifier['url'] end |