Created
July 1, 2015 13:34
-
-
Save VoronoyAlexandr/de2ed22fb93161b0d55a to your computer and use it in GitHub Desktop.
This file contains 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
def email_notification | |
<<-TEXT | |
Hello, #{email_notification_params[:reader_name]} | |
You should return a book #{email_notification_params[:book_title]} authored by "#{email_notification_params[:book_author]}" in #{email_notification_params[:time_left]} hours. | |
Otherwise you will be charged $#{email_notification_params[:penalty_per_hour]} per hour. | |
TEXT | |
end | |
def email_notification_params | |
{ | |
reader_name: reader_with_book.name, | |
book_title: reader_with_book.book.title, | |
book_author: reader_with_book.book.author.name, | |
time_left: ((issue_datetime.to_i - Time.now.to_i) / 3600), | |
penalty_per_hour: sprintf("%.2f", ((reader_with_book.book.penalty_per_hour) / 100)).to_f | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment