Class: Ponga::Mailer
- Inherits:
-
Object
- Object
- Ponga::Mailer
- Defined in:
- lib/ponga/mailer.rb
Constant Summary collapse
- API_ENDPOINT =
"https://www.getponga.com/messages".freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#initialize(api_key) ⇒ Mailer
constructor
A new instance of Mailer.
- #send(subject:, body:, to:) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Mailer
Returns a new instance of Mailer.
6 7 8 |
# File 'lib/ponga/mailer.rb', line 6 def initialize(api_key) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/ponga/mailer.rb', line 3 def api_key @api_key end |
Instance Method Details
#send(subject:, body:, to:) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ponga/mailer.rb', line 10 def send(subject:, body:, to:) HTTParty.post(API_ENDPOINT, body: { message: { subject: subject, recipient: to, body: body }, key: api_key }) end |