Class: Chatterbox::Services::Email
- Inherits:
-
Object
- Object
- Chatterbox::Services::Email
- Defined in:
- lib/chatterbox/services/email.rb,
lib/chatterbox/services/email/mailer.rb
Defined Under Namespace
Classes: Mailer
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.configure(config_options) ⇒ Object
Configure Email service with default options.
-
.default_configuration ⇒ Object
Return default configuration - defaults to empty hash.
-
.deliver(options = {}) ⇒ Object
Deliver the a notification via email.
Instance Method Summary collapse
-
#deliver ⇒ Object
Deliver a notificaiton – normally you should just use the class level method Email::deliver.
-
#initialize(options = {}) ⇒ Email
constructor
Creates a new Email service with provided options.
Constructor Details
#initialize(options = {}) ⇒ Email
Creates a new Email service with provided options. See Email::deliver for the valid options
39 40 41 42 43 44 |
# File 'lib/chatterbox/services/email.rb', line 39 def initialize( = {}) @options = merge_configs end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/chatterbox/services/email.rb', line 6 def @options end |
Class Method Details
.configure(config_options) ⇒ Object
Configure Email service with default options
13 14 15 |
# File 'lib/chatterbox/services/email.rb', line 13 def self.configure() @default_configuration = .with_indifferent_access end |
.default_configuration ⇒ Object
Return default configuration - defaults to empty hash
8 9 10 |
# File 'lib/chatterbox/services/email.rb', line 8 def self.default_configuration @default_configuration ||= {} end |
.deliver(options = {}) ⇒ Object
Deliver the a notification via email
Options
-
:summary - The subject of the message - required.
-
:body - The body of the email - if none provided, you will just send an email with a blank body.
-
:config - A sub-hash of configuration options.
Optional if you have configured a default configuration with #configure. Config can contain any of the following options, all of which are pretty self explanatory:
:to :from :content_type :reply_to :bcc :cc
33 34 35 |
# File 'lib/chatterbox/services/email.rb', line 33 def self.deliver( = {}) new().deliver end |
Instance Method Details
#deliver ⇒ Object
Deliver a notificaiton – normally you should just use the class level method Email::deliver
47 48 49 |
# File 'lib/chatterbox/services/email.rb', line 47 def deliver Mailer.() end |