Class: MailHatch
- Inherits:
-
Object
- Object
- MailHatch
- Defined in:
- lib/mail_hatch.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#brand_color ⇒ Object
readonly
Returns the value of attribute brand_color.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#google_play_store_url ⇒ Object
readonly
Returns the value of attribute google_play_store_url.
-
#ios_store_url ⇒ Object
readonly
Returns the value of attribute ios_store_url.
-
#sendgrid_api_key ⇒ Object
readonly
Returns the value of attribute sendgrid_api_key.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #async_notification(to:, from:, text:, subject:) ⇒ Object
-
#initialize(api_key:, brand_color:, debug: false, dry_run: false, sendgrid_api_key:, title:, address:, ios_store_url:, google_play_store_url:) ⇒ MailHatch
constructor
A new instance of MailHatch.
- #notification(to:, from:, text:, subject:) ⇒ Object
Constructor Details
#initialize(api_key:, brand_color:, debug: false, dry_run: false, sendgrid_api_key:, title:, address:, ios_store_url:, google_play_store_url:) ⇒ MailHatch
Returns a new instance of MailHatch.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mail_hatch.rb', line 12 def initialize(api_key:,brand_color:,debug: false, dry_run: false, sendgrid_api_key:, title:, address:, ios_store_url:, google_play_store_url:) @api_key = api_key @title = title @address = address @brand_color = brand_color @debug = debug @dry_run = dry_run @ios_store_url = ios_store_url @google_play_store_url = google_play_store_url @sendgrid_api_key = sendgrid_api_key end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def address @address end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def api_key @api_key end |
#brand_color ⇒ Object (readonly)
Returns the value of attribute brand_color.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def brand_color @brand_color end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def debug @debug end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def dry_run @dry_run end |
#google_play_store_url ⇒ Object (readonly)
Returns the value of attribute google_play_store_url.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def google_play_store_url @google_play_store_url end |
#ios_store_url ⇒ Object (readonly)
Returns the value of attribute ios_store_url.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def ios_store_url @ios_store_url end |
#sendgrid_api_key ⇒ Object (readonly)
Returns the value of attribute sendgrid_api_key.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def sendgrid_api_key @sendgrid_api_key end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/mail_hatch.rb', line 2 def title @title end |
Instance Method Details
#async_notification(to:, from:, text:, subject:) ⇒ Object
24 25 26 |
# File 'lib/mail_hatch.rb', line 24 def async_notification(to:, from:, text:, subject:) async(:notification, {to: to, from: from, text: text, subject: subject}) end |
#notification(to:, from:, text:, subject:) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/mail_hatch.rb', line 28 def notification(to:, from:, text:, subject:) body = { api_key: api_key, sendgrid_api_key: sendgrid_api_key, to: to, from: from, text: text, template: "notification", theme: "minimal", subject: subject, data: { ios_store_url: ios_store_url, google_play_store_url: google_play_store_url, message: text, title: title, address: address, }, design: { brand_color: brand_color } } post(body) end |