Advertisement
saasbook

dip_example_3.rb

Aug 15th, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.41 KB | None | 0 0
  1. class AmikoAdapter
  2.   def initialize ; @amiko = Amiko.new(...) ; end
  3.   def send_email
  4.     @amiko.authenticate(...)
  5.     @amiko.send_message(...)
  6.   end
  7. end
  8. # Change the controller method to use the adapter:
  9. def advertise_discount_for_movie
  10.   moviegoers = Moviegoer.interested_in params[:movie_id]
  11.   mailer = if Config.has_amiko? then AmikoAdapter else MailerMonkey end
  12.   EmailList.new(mailer).send_email_to moviegoers
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement