Class: SurenotifyRails::Deliverer
- Inherits:
-
Object
- Object
- SurenotifyRails::Deliverer
- Defined in:
- lib/surenotify_rails/deliverer.rb
Constant Summary collapse
- MAX_RECIPIENTS =
100
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.
- #verify_ssl ⇒ Object
Constructor Details
#initialize(settings) ⇒ Deliverer
Returns a new instance of Deliverer.
7 8 9 |
# File 'lib/surenotify_rails/deliverer.rb', line 7 def initialize(settings) self.settings = settings end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
5 6 7 |
# File 'lib/surenotify_rails/deliverer.rb', line 5 def settings @settings end |
Instance Method Details
#api_key ⇒ Object
11 12 13 |
# File 'lib/surenotify_rails/deliverer.rb', line 11 def api_key settings[:api_key] end |
#deliver!(rails_message) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/surenotify_rails/deliverer.rb', line 20 def deliver!() response = surenotify_client. () unless response.is_a?(Net::HTTPSuccess) raise APIError.new("Surenotify API error: #{response.code}", code: response.code, body: response.body) end . = JSON.parse(response.body)["id"] response end |
#verify_ssl ⇒ Object
15 16 17 18 |
# File 'lib/surenotify_rails/deliverer.rb', line 15 def verify_ssl # default value = true settings[:verify_ssl] != false end |