Class: ImageKiIo::ActiveStorage::IKFile
- Inherits:
-
Object
- Object
- ImageKiIo::ActiveStorage::IKFile
- Defined in:
- lib/active_storage/service/ik_file.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
Returns the value of attribute identifier.
Instance Method Summary collapse
- #ai_tags ⇒ Object
- #alpha? ⇒ Boolean
- #created_at ⇒ Object
- #custom_coordinates ⇒ Object
- #custom_metadata ⇒ Object
- #delete ⇒ Object
- #embedded_metadata ⇒ Object
- #exist? ⇒ Boolean
- #extension_status ⇒ Object
- #file_id ⇒ Object
- #file_type ⇒ Object
- #filename ⇒ Object
- #height ⇒ Object
-
#initialize(identifier) ⇒ IKFile
constructor
A new instance of IKFile.
- #is_private? ⇒ Boolean
- #mime ⇒ Object
- #path ⇒ Object
- #size ⇒ Object
- #tags ⇒ Object
- #thumbnail_url ⇒ Object
- #transformation ⇒ Object
- #type ⇒ Object
- #updated_at ⇒ Object
- #url ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(identifier) ⇒ IKFile
Returns a new instance of IKFile.
6 7 8 9 |
# File 'lib/active_storage/service/ik_file.rb', line 6 def initialize(identifier) @identifier = identifier @imagekit = ImageKitIo.client end |
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/active_storage/service/ik_file.rb', line 4 def identifier @identifier end |
Instance Method Details
#ai_tags ⇒ Object
70 71 72 |
# File 'lib/active_storage/service/ik_file.rb', line 70 def identifier['AITags'] end |
#alpha? ⇒ Boolean
86 87 88 |
# File 'lib/active_storage/service/ik_file.rb', line 86 def alpha? identifier['hasAlpha'] end |
#created_at ⇒ Object
98 99 100 |
# File 'lib/active_storage/service/ik_file.rb', line 98 def created_at identifier['createdAt'] end |
#custom_coordinates ⇒ Object
78 79 80 |
# File 'lib/active_storage/service/ik_file.rb', line 78 def custom_coordinates identifier['customCoordinates'] end |
#custom_metadata ⇒ Object
90 91 92 |
# File 'lib/active_storage/service/ik_file.rb', line 90 def identifier['customMetadata'] end |
#delete ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/active_storage/service/ik_file.rb', line 15 def delete begin @imagekit.delete_file(file_id: file_id) rescue file_id end end |
#embedded_metadata ⇒ Object
94 95 96 |
# File 'lib/active_storage/service/ik_file.rb', line 94 def identifier['embeddedMetadata'] end |
#exist? ⇒ Boolean
55 56 57 58 59 60 |
# File 'lib/active_storage/service/ik_file.rb', line 55 def exist? details = @imagekit.get_file_details(file_id: file_id) return false if details[:error].present? true end |
#extension_status ⇒ Object
106 107 108 |
# File 'lib/active_storage/service/ik_file.rb', line 106 def extension_status identifier['extensionStatus'] end |
#file_id ⇒ Object
51 52 53 |
# File 'lib/active_storage/service/ik_file.rb', line 51 def file_id identifier['fileId'] end |
#file_type ⇒ Object
23 24 25 |
# File 'lib/active_storage/service/ik_file.rb', line 23 def file_type identifier['fileType'] end |
#filename ⇒ Object
31 32 33 |
# File 'lib/active_storage/service/ik_file.rb', line 31 def filename identifier['name'] end |
#height ⇒ Object
43 44 45 |
# File 'lib/active_storage/service/ik_file.rb', line 43 def height identifier['height'] end |
#is_private? ⇒ Boolean
74 75 76 |
# File 'lib/active_storage/service/ik_file.rb', line 74 def is_private? identifier['isPrivateFile'] end |
#mime ⇒ Object
82 83 84 |
# File 'lib/active_storage/service/ik_file.rb', line 82 def mime identifier['mime'] end |
#path ⇒ Object
39 40 41 |
# File 'lib/active_storage/service/ik_file.rb', line 39 def path identifier['filePath'] end |
#size ⇒ Object
35 36 37 |
# File 'lib/active_storage/service/ik_file.rb', line 35 def size identifier['size'] end |
#tags ⇒ Object
66 67 68 |
# File 'lib/active_storage/service/ik_file.rb', line 66 def identifier['tags'] end |
#thumbnail_url ⇒ Object
27 28 29 |
# File 'lib/active_storage/service/ik_file.rb', line 27 def thumbnail_url identifier['thumbnail'] end |
#transformation ⇒ Object
110 111 112 |
# File 'lib/active_storage/service/ik_file.rb', line 110 def transformation identifier['transformation'] end |
#type ⇒ Object
62 63 64 |
# File 'lib/active_storage/service/ik_file.rb', line 62 def type identifier['type'] end |
#updated_at ⇒ Object
102 103 104 |
# File 'lib/active_storage/service/ik_file.rb', line 102 def updated_at identifier['updatedAt'] end |
#url ⇒ Object
11 12 13 |
# File 'lib/active_storage/service/ik_file.rb', line 11 def url identifier['url'] end |
#width ⇒ Object
47 48 49 |
# File 'lib/active_storage/service/ik_file.rb', line 47 def width identifier['width'] end |