Class: Uploadcare::Rails::File
- Inherits:
-
Api::File
- Object
- Api::File
- Uploadcare::Rails::File
- Defined in:
- lib/uploadcare/rails/objects/file.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#image(with_operations = true, options = {}) ⇒ Object
construct image tag for file.
- #load_data ⇒ Object (also: #load)
- #load_data! ⇒ Object (also: #load!)
- #marshal_dump ⇒ Object
- #to_builder ⇒ Object
- #to_json ⇒ Object
-
#to_s ⇒ Object
override default to string method instead of string representation of object it will return simple cdn url of a file.
Instance Method Details
#as_json(options = {}) ⇒ Object
44 45 46 |
# File 'lib/uploadcare/rails/objects/file.rb', line 44 def as_json ={} marshal_dump end |
#image(with_operations = true, options = {}) ⇒ Object
construct image tag for file
12 13 14 15 16 17 18 19 20 |
# File 'lib/uploadcare/rails/objects/file.rb', line 12 def image with_operations=true, ={} if with_operations url = cdn_url_with_operations else url = cdn_url end image_tag url, end |
#load_data ⇒ Object Also known as: load
22 23 24 25 26 |
# File 'lib/uploadcare/rails/objects/file.rb', line 22 def load_data super ::Rails.cache.write(cdn_url, self.marshal_dump) if UPLOADCARE_SETTINGS.cache_files self end |
#load_data! ⇒ Object Also known as: load!
29 30 31 32 33 |
# File 'lib/uploadcare/rails/objects/file.rb', line 29 def load_data! super ::Rails.cache.write(cdn_url, self.marshal_dump) if UPLOADCARE_SETTINGS.cache_files self end |
#marshal_dump ⇒ Object
48 49 50 |
# File 'lib/uploadcare/rails/objects/file.rb', line 48 def marshal_dump @table.stringify_keys end |
#to_builder ⇒ Object
36 37 38 |
# File 'lib/uploadcare/rails/objects/file.rb', line 36 def to_builder marshal_dump end |
#to_json ⇒ Object
40 41 42 |
# File 'lib/uploadcare/rails/objects/file.rb', line 40 def to_json marshal_dump end |
#to_s ⇒ Object
override default to string method instead of string representation of object it will return simple cdn url of a file
7 8 9 |
# File 'lib/uploadcare/rails/objects/file.rb', line 7 def to_s cdn_url end |