Created
July 17, 2013 23:50
-
-
Save mattvague/6025606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BulkFileJob | |
@queue = :bulk | |
#----------------------------------------------------------------------------- | |
# Class methods | |
#----------------------------------------------------------------------------- | |
def self.perform(bulk_id) | |
new(bulk_id).perform | |
end | |
#----------------------------------------------------------------------------- | |
# Instance methods | |
#----------------------------------------------------------------------------- | |
def initialize(document_version_id) | |
@bulk_upload = BulkUpload::Base.find(bulk_id) | |
end | |
def perform | |
@bulk_upload.run | |
send_push_notification | |
end | |
# Sends a push notification notifying the the zip file has been processed | |
# | |
# @param id [Integer] id of Document | |
# @param file_url [String] OCR file url | |
def send_push_notification | |
return unless push_enabled? | |
Pusher['bulk-uploads'].trigger('change', { | |
id: @bulk_upload.id, | |
processed_at: @bulk_upload.processed_at, | |
document_ids: @bulk_upload.document_ids | |
}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment