Class: S3Relay::Upload
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- S3Relay::Upload
- 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
Class Method Details
.imported ⇒ Object
19 20 21 |
# File 'app/models/s3_relay/upload.rb', line 19 def self.imported where(state: "imported") end |
.pending ⇒ Object
15 16 17 |
# File 'app/models/s3_relay/upload.rb', line 15 def self.pending where(state: "pending") end |
Instance Method Details
#imported? ⇒ Boolean
27 28 29 |
# File 'app/models/s3_relay/upload.rb', line 27 def imported? state == "imported" end |
#mark_imported! ⇒ Object
31 32 33 |
# File 'app/models/s3_relay/upload.rb', line 31 def mark_imported! update_attributes(state: "imported", imported_at: Time.now) end |
#notify_parent ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/models/s3_relay/upload.rb', line 35 def notify_parent return unless parent.present? if parent.respond_to?(:import_upload) parent.import_upload(id) end end |
#pending? ⇒ Boolean
23 24 25 |
# File 'app/models/s3_relay/upload.rb', line 23 def pending? state == "pending" end |
#private_url ⇒ Object
43 44 45 |
# File 'app/models/s3_relay/upload.rb', line 43 def private_url S3Relay::PrivateUrl.new(uuid, filename).generate end |