Class: KlaviyoRails::DeliveryMethod
- Inherits:
-
Object
- Object
- KlaviyoRails::DeliveryMethod
- Defined in:
- lib/klaviyo-rails/delivery_method.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(options = {}) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
Constructor Details
#initialize(options = {}) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
6 7 8 9 10 11 |
# File 'lib/klaviyo-rails/delivery_method.rb', line 6 def initialize( = {}) self.settings = { secret_key: ENV['KLAVIYO_SECRET_KEY'], token: ENV['KLAVIYO_TOKEN'] }.merge() end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
5 6 7 |
# File 'lib/klaviyo-rails/delivery_method.rb', line 5 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/klaviyo-rails/delivery_method.rb', line 13 def deliver!(mail) response = client.templates.render_and_send((mail)) if settings[:return_response] response else self end end |