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(operations = nil) ⇒ Object
construct image tag for file.
- #marshal_dump ⇒ Object
- #prepared_operations(operations) ⇒ 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.
- #url(operations = nil) ⇒ Object
Instance Method Details
#as_json(_options = {}) ⇒ Object
32 33 34 |
# File 'lib/uploadcare/rails/objects/file.rb', line 32 def as_json( = {}) marshal_dump end |
#image(operations = nil) ⇒ Object
construct image tag for file
14 15 16 |
# File 'lib/uploadcare/rails/objects/file.rb', line 14 def image(operations = nil) image_tag(url(operations)) end |
#marshal_dump ⇒ Object
36 37 38 |
# File 'lib/uploadcare/rails/objects/file.rb', line 36 def marshal_dump @table.stringify_keys end |
#prepared_operations(operations) ⇒ Object
9 10 11 |
# File 'lib/uploadcare/rails/objects/file.rb', line 9 def prepared_operations(operations) Uploadcare::Rails::Operations.new(operations).to_s end |
#to_builder ⇒ Object
24 25 26 |
# File 'lib/uploadcare/rails/objects/file.rb', line 24 def to_builder marshal_dump end |
#to_json ⇒ Object
28 29 30 |
# File 'lib/uploadcare/rails/objects/file.rb', line 28 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
20 21 22 |
# File 'lib/uploadcare/rails/objects/file.rb', line 20 def to_s cdn_url end |
#url(operations = nil) ⇒ Object
4 5 6 7 |
# File 'lib/uploadcare/rails/objects/file.rb', line 4 def url(operations = nil) cdn_url unless operations cdn_url + prepared_operations(operations) end |