Sha256: 8a75ba899b962b8959957923d91c9f4a744c0a2ac0d5bd9d2d2b6ee4a434725e

Contents?: true

Size: 884 Bytes

Versions: 12

Compression:

Stored size: 884 Bytes

Contents

class Mailer < ActionMailer::Base

  helper :application

  layout 'email'

  default from: lambda { Shop.first.from_email }
  default_url_options[:host] = Nimbleshop.config.host_for_email
  default_url_options[:protocol] = 'http'

  def order_notification_to_buyer(order_number)
    subject = "Order confirmation for order ##{order_number}"
    @order = Order.find_by_number!(order_number)

    @shop = Shop.first
    @payment_date = @order.created_at.to_s(:long) || @order.purchased_at.to_s(:long)

    mail_options = {to: @order.email, subject: subject}
    mail(mail_options)
  end

  def shipment_notification_to_buyer(order_number)
    subject = "Items for order ##{order_number} have been shipped"
    @order = Order.find_by_number!(order_number)
    @shipment = @order.shipments.first

    mail_options = {to: @order.email, subject: subject}
    mail(mail_options)
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nimbleshop_core-0.0.4.beta1 app/mailers/mailer.rb
nimbleshop_core-0.0.4 app/mailers/mailer.rb
nimbleshop_core-0.0.3 app/mailers/mailer.rb
nimbleshop_core-0.0.2 app/mailers/mailer.rb
nimbleshop_core-0.0.2.beta1 app/mailers/mailer.rb
nimbleshop_core-0.0.1 app/mailers/mailer.rb
nimbleshop_core-0.0.1.rc6 app/mailers/mailer.rb
nimbleshop_core-0.0.1.rc5 app/mailers/mailer.rb
nimbleshop_core-0.0.1.rc4 app/mailers/mailer.rb
nimbleshop_core-0.0.1.rc3 app/mailers/mailer.rb
nimbleshop_core-0.0.1.rc2 app/mailers/mailer.rb
nimbleshop_core-0.0.1.rc1 app/mailers/mailer.rb