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
46 47 48 |
# File 'lib/uploadcare/rails/objects/file.rb', line 46 def as_json ={} marshal_dump end |
#image(with_operations = true, options = {}) ⇒ Object
construct image tag for file
14 15 16 17 18 19 20 21 22 |
# File 'lib/uploadcare/rails/objects/file.rb', line 14 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
24 25 26 27 28 |
# File 'lib/uploadcare/rails/objects/file.rb', line 24 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!
31 32 33 34 35 |
# File 'lib/uploadcare/rails/objects/file.rb', line 31 def load_data! super ::Rails.cache.write(cdn_url, self.marshal_dump) if UPLOADCARE_SETTINGS.cache_files self end |
#marshal_dump ⇒ Object
50 51 52 |
# File 'lib/uploadcare/rails/objects/file.rb', line 50 def marshal_dump @table.stringify_keys end |
#to_builder ⇒ Object
38 39 40 |
# File 'lib/uploadcare/rails/objects/file.rb', line 38 def to_builder marshal_dump end |
#to_json ⇒ Object
42 43 44 |
# File 'lib/uploadcare/rails/objects/file.rb', line 42 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
9 10 11 |
# File 'lib/uploadcare/rails/objects/file.rb', line 9 def to_s cdn_url end |