Class: Mailgems::Message
- Inherits:
-
Object
- Object
- Mailgems::Message
- Defined in:
- lib/mailgems/message.rb
Constant Summary collapse
- ERROR_MSG =
'%s configuration must be given'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
-
#sandbox ⇒ Object
readonly
Returns the value of attribute sandbox.
Instance Method Summary collapse
-
#initialize(mail, settings) ⇒ Message
constructor
A new instance of Message.
- #send ⇒ Object
Constructor Details
#initialize(mail, settings) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 14 |
# File 'lib/mailgems/message.rb', line 8 def initialize(mail, settings) @mail = mail @api_key = settings[:api_key] @sandbox = settings[:sandbox] raise ArgumentError, ERROR_MSG % 'Api key' unless @api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/mailgems/message.rb', line 5 def api_key @api_key end |
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
5 6 7 |
# File 'lib/mailgems/message.rb', line 5 def mail @mail end |
#sandbox ⇒ Object (readonly)
Returns the value of attribute sandbox.
5 6 7 |
# File 'lib/mailgems/message.rb', line 5 def sandbox @sandbox end |
Instance Method Details
#send ⇒ Object
16 17 18 |
# File 'lib/mailgems/message.rb', line 16 def send Mail.new(api_key: api_key).send_mail(params) end |