Skip to content

Instantly share code, notes, and snippets.

@smcabrera
Created January 7, 2016 01:05
Show Gist options
  • Select an option

  • Save smcabrera/f4f435d18b777f6c4211 to your computer and use it in GitHub Desktop.

Select an option

Save smcabrera/f4f435d18b777f6c4211 to your computer and use it in GitHub Desktop.
class QuoteExporter
include MailerStyleHelper
include LeadMailerHelper
def initialize(lead)
@lead = lead
end
attr_reader :lead
def export
create_static_html_file(html_string)
end
private
def html_string
email = SentEmail.where(@lead.id).last
email ? email.html : '<span>No Quote Found</span>'
end
def create_static_html_file(html_string)
raise "Don't touch the real method!"
pathname = Rails.root.join('tmp', 'static-html', "quote-#{@lead.id}.html")
cmd = %[ rm #{ pathname} ]
open(pathname, 'w') do |file|
file.puts html_string
end
pathname
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment