Class: ElasticEmail::Deliverer
- Inherits:
-
Object
- Object
- ElasticEmail::Deliverer
- Defined in:
- lib/elastic_email/deliverer.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #api_key ⇒ Object
- #deliver!(rails_message) ⇒ Object
-
#initialize(settings) ⇒ Deliverer
constructor
A new instance of Deliverer.
- #username ⇒ Object
Constructor Details
#initialize(settings) ⇒ Deliverer
Returns a new instance of Deliverer.
6 7 8 |
# File 'lib/elastic_email/deliverer.rb', line 6 def initialize(settings) self.settings = settings end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
4 5 6 |
# File 'lib/elastic_email/deliverer.rb', line 4 def settings @settings end |
Instance Method Details
#api_key ⇒ Object
14 15 16 |
# File 'lib/elastic_email/deliverer.rb', line 14 def api_key self.settings[:api_key] end |
#deliver!(rails_message) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elastic_email/deliverer.rb', line 18 def deliver!() response = elastic_email_client. () response_body = response.body if response.code == '200' and response_body.match('^[0-9|a-f]{8}-[0-9|a-f]{4}-[0-9|a-f]{4}-[0-9|a-f]{4}-[0-9|a-f]{12}$').present? . = response_body else raise Error.new(response_body) end response end |
#username ⇒ Object
10 11 12 |
# File 'lib/elastic_email/deliverer.rb', line 10 def username self.settings[:username] end |