Sha256: eb3553044ef406d28d0dd0e803ba8a6dda8614489d1e306dcadeeb12b211b316

Contents?: true

Size: 704 Bytes

Versions: 6

Compression:

Stored size: 704 Bytes

Contents

class Dorsale::BillingMachine::Email < Dorsale::Email
  attr_accessor :document

  def initialize(document, attributes = {})
    @document = document
    super(attributes)
  end

  private

  def model
    document.class
  end

  def default_to
    "#{document.customer} <#{document.customer.email}>" if document.customer
  end

  def default_subject
    "#{model.t} #{document.tracking_id} : #{document.label}"
  end

  def default_body
    I18n.t("billing_machine.emails.#{document.document_type}.body",
      :from => current_user.to_s,
      :to   => document.customer.to_s,
    )
  end

  def default_attachments
    {"#{document.t}_#{document.tracking_id}.pdf" => document.pdf_file.read}
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dorsale-3.10.0 app/models/dorsale/billing_machine/email.rb
dorsale-3.9.8 app/models/dorsale/billing_machine/email.rb
dorsale-3.9.7 app/models/dorsale/billing_machine/email.rb
dorsale-3.9.6 app/models/dorsale/billing_machine/email.rb
dorsale-3.9.5 app/models/dorsale/billing_machine/email.rb
dorsale-3.9.4 app/models/dorsale/billing_machine/email.rb