Class: Nuntius::ApnoticPushProvider
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- Nuntius::ApnoticPushProvider
- Defined in:
- app/providers/nuntius/apnotic_push_provider.rb
Instance Attribute Summary
Attributes inherited from BaseProvider
Instance Method Summary collapse
Methods inherited from BaseProvider
all_settings, #callback, class_from_name, #initialize, #name, #refresh, setting_reader, states, transport
Constructor Details
This class inherits a constructor from Nuntius::BaseProvider
Instance Method Details
#deliver ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/providers/nuntius/apnotic_push_provider.rb', line 21 def deliver return if .to.size != 64 connection = if environment.to_sym == :development Apnotic::Connection.development(cert_path: StringIO.new(certificate), cert_pass: passphrase) else Apnotic::Connection.new(cert_path: StringIO.new(certificate), cert_pass: passphrase) end notification = Apnotic::Notification.new(.to) notification.alert = .text notification.custom_payload = .payload response = connection.push(notification) .status = if response.ok? "sent" else "undelivered" end end |