Class: RssNotifier::Adapter::Email
- Inherits:
-
Object
- Object
- RssNotifier::Adapter::Email
- Defined in:
- lib/rss_notifier/adapter/email.rb
Constant Summary collapse
- HTML_TEMPLATE =
File.('../email.html.erb', __FILE__)
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Instance Method Summary collapse
-
#initialize(email) ⇒ Email
constructor
curl -s –user ‘api:YOUR_API_KEY’ \ api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \ -F from=‘Excited User <mailgun@YOUR_DOMAIN_NAME>’ \ -F to=YOU@YOUR_DOMAIN_NAME \ -F [email protected] \ -F subject=‘Hello’ \ -F text=‘Testing some Mailgun awesomness!’.
- #notify(item) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(email) ⇒ Email
curl -s –user ‘api:YOUR_API_KEY’ \
https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/ \
-F from='Excited User <mailgun@YOUR_DOMAIN_NAME>' \
-F to=YOU@YOUR_DOMAIN_NAME \
-F to=@example.com \
-F subject='Hello' \
-F text='Testing some Mailgun awesomness!'
20 21 22 23 |
# File 'lib/rss_notifier/adapter/email.rb', line 20 def initialize(email) @email = email @template = ERB.new(File.read(HTML_TEMPLATE)) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
8 9 10 |
# File 'lib/rss_notifier/adapter/email.rb', line 8 def email @email end |
Instance Method Details
#notify(item) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rss_notifier/adapter/email.rb', line 25 def notify(item) b = binding b.local_variable_set(:item, item) html = @template.result(b) puts "-------" end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/rss_notifier/adapter/email.rb', line 32 def to_s "<Adapter::Email email=#{email}>" end |