Class: S3Relay::Upload
- Inherits:
-
Object
- Object
- S3Relay::Upload
- Includes:
- Mongoid::Document
- Defined in:
- app/models/s3_relay/upload.rb
Class Method Summary collapse
Instance Method Summary collapse
- #imported? ⇒ Boolean
- #mark_imported! ⇒ Object
- #notify_parent ⇒ Object
- #pending? ⇒ Boolean
- #private_url ⇒ Object
- #public_url ⇒ Object
Class Method Details
.imported ⇒ Object
33 34 35 |
# File 'app/models/s3_relay/upload.rb', line 33 def self.imported where(state: "imported") end |
.pending ⇒ Object
29 30 31 |
# File 'app/models/s3_relay/upload.rb', line 29 def self.pending where(state: "pending") end |
Instance Method Details
#imported? ⇒ Boolean
41 42 43 |
# File 'app/models/s3_relay/upload.rb', line 41 def imported? state == "imported" end |
#mark_imported! ⇒ Object
45 46 47 |
# File 'app/models/s3_relay/upload.rb', line 45 def mark_imported! update_attributes(state: "imported", imported_at: Time.now) end |
#notify_parent ⇒ Object
49 50 51 52 53 54 55 |
# File 'app/models/s3_relay/upload.rb', line 49 def notify_parent return unless parent.present? if parent.respond_to?(:import_upload) parent.import_upload(id) end end |
#pending? ⇒ Boolean
37 38 39 |
# File 'app/models/s3_relay/upload.rb', line 37 def pending? state == "pending" end |
#private_url ⇒ Object
61 62 63 |
# File 'app/models/s3_relay/upload.rb', line 61 def private_url S3Relay::PrivateUrl.new(uuid, filename).generate end |
#public_url ⇒ Object
57 58 59 |
# File 'app/models/s3_relay/upload.rb', line 57 def public_url S3Relay::PrivateUrl.new(uuid, filename).public_url end |