Sha256: 8f248cf3f01866d8751fa9abdef98ef07f3d0b99705ef0493b7baa8e5d3576aa
Contents?: true
Size: 1.6 KB
Versions: 34
Compression:
Stored size: 1.6 KB
Contents
module Effective class EventsMailer < EffectiveEvents.parent_mailer_class include EffectiveMailer include EffectiveEmailTemplatesMailer if EffectiveEvents.use_effective_email_templates def event_registrant_purchased(resource, opts = {}) raise('expected an Effective::EventRegistrant') unless resource.kind_of?(Effective::EventRegistrant) @assigns = assigns_for(resource) @event_registrant = resource subject = subject_for(__method__, 'Event Registrant Purchased', resource, opts) headers = headers_for(resource, opts) mail(to: resource.email, subject: subject, **headers) end protected def assigns_for(resource) if resource.kind_of?(EventRegistrant) return event_registrant_assigns(resource).merge(event_assigns(resource.event)).merge(event_ticket_assigns(resource.event_ticket)) end raise('unexpected resource') end def event_assigns(resource) raise('expected an event') unless resource.kind_of?(Event) values = { name: resource.title, date: resource.start_at.strftime('%F %H:%M'), url: effective_events.event_url(resource) } { event: values } end def event_ticket_assigns(resource) raise('expected an event ticket') unless resource.kind_of?(EventTicket) values = { name: resource.title } { ticket: values } end def event_registrant_assigns(resource) raise('expected an event registrant') unless resource.kind_of?(EventRegistrant) values = { name: resource.name, email: resource.email } { registrant: values } end end end
Version data entries
34 entries across 34 versions & 1 rubygems