Created
January 7, 2016 01:05
-
-
Save smcabrera/f4f435d18b777f6c4211 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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