Class: NotificationWorkers::Partner::VouchersReport
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- NotificationWorkers::Partner::VouchersReport
- Includes:
- MoneyRails::ActionViewExtension, RollbarSynTokenSetterWorker, Sidekiq::Status::Worker
- Defined in:
- app/workers/notification_workers/partner/vouchers_report.rb
Overview
typed: true frozen_string_literal: true
Instance Attribute Summary collapse
-
#attachment ⇒ Object
Returns the value of attribute attachment.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#package_type_code ⇒ Object
Returns the value of attribute package_type_code.
-
#pdf_url ⇒ Object
Returns the value of attribute pdf_url.
-
#restaurant_id ⇒ Object
Returns the value of attribute restaurant_id.
-
#selling_date ⇒ Object
Returns the value of attribute selling_date.
-
#selling_end_date ⇒ Object
Returns the value of attribute selling_end_date.
-
#selling_filter_type ⇒ Object
Returns the value of attribute selling_filter_type.
-
#selling_start_date ⇒ Object
Returns the value of attribute selling_start_date.
-
#type ⇒ Object
Returns the value of attribute type.
-
#valid_date ⇒ Object
Returns the value of attribute valid_date.
-
#valid_date_from ⇒ Object
Returns the value of attribute valid_date_from.
-
#valid_date_to ⇒ Object
Returns the value of attribute valid_date_to.
-
#valid_filter_type ⇒ Object
Returns the value of attribute valid_filter_type.
Instance Method Summary collapse
Methods inherited from ApplicationWorker
Instance Attribute Details
#attachment ⇒ Object
Returns the value of attribute attachment.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def @attachment end |
#emails ⇒ Object
Returns the value of attribute emails.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def emails @emails end |
#package_type_code ⇒ Object
Returns the value of attribute package_type_code.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def package_type_code @package_type_code end |
#pdf_url ⇒ Object
Returns the value of attribute pdf_url.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def pdf_url @pdf_url end |
#restaurant_id ⇒ Object
Returns the value of attribute restaurant_id.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def restaurant_id @restaurant_id end |
#selling_date ⇒ Object
Returns the value of attribute selling_date.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def selling_date @selling_date end |
#selling_end_date ⇒ Object
Returns the value of attribute selling_end_date.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def selling_end_date @selling_end_date end |
#selling_filter_type ⇒ Object
Returns the value of attribute selling_filter_type.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def selling_filter_type @selling_filter_type end |
#selling_start_date ⇒ Object
Returns the value of attribute selling_start_date.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def selling_start_date @selling_start_date end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def type @type end |
#valid_date ⇒ Object
Returns the value of attribute valid_date.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def valid_date @valid_date end |
#valid_date_from ⇒ Object
Returns the value of attribute valid_date_from.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def valid_date_from @valid_date_from end |
#valid_date_to ⇒ Object
Returns the value of attribute valid_date_to.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def valid_date_to @valid_date_to end |
#valid_filter_type ⇒ Object
Returns the value of attribute valid_filter_type.
10 11 12 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 10 def valid_filter_type @valid_filter_type end |
Instance Method Details
#perform(args, attachment_id = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/workers/notification_workers/partner/vouchers_report.rb', line 16 def perform(args, = nil) total 100 store status: Attachment::ON_PROGRESS_STATUS store email_status: Attachment::PENDING_EMAIL_STATUS at 0 self. = Attachment.find_by(id: ) if .present? .update(status: :on_progress) if .present? begin args.to_h.with_indifferent_access.each do |k, v| next if k.to_s == :use_long_process.to_s send("#{k}=".to_sym, v) end I18n.locale = :en vouchers_list = collect_vouchers_list if pdf? report = VouchersListReportPdf.new(vouchers_list) report.generate_pdf(vouchers_list, args) self.pdf_url = report.pdf_url else generate_vouchers_list_report_to_restaurant end at(90) OwnerMailer.vouchers_list_report(email_body, email_subject, emails).deliver_later! store email_status: Attachment::SENT_EMAIL_STATUS rescue Aws::SES::Errors::Throttling => e store email_status: Attachment::FAILED_EMAIL_STATUS store message: "Email sending failed due to AWS SES throttling. Error: #{e.}" raise e rescue StandardError => e store email_status: Attachment::FAILED_EMAIL_STATUS store message: "An error occurred: #{e.}" store status: Attachment::FAILED_STATUS if .blank? || .download_link.blank? APMErrorHandler.report e raise e end end |