Class: Nuntius::HoustonPushProvider
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- Nuntius::HoustonPushProvider
- Defined in:
- app/providers/nuntius/houston_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 |
# File 'app/providers/nuntius/houston_push_provider.rb', line 21 def deliver return if .to.size != 64 apn = (environment.to_sym == :development) ? Houston::Client.development : Houston::Client.production apn.certificate = certificate apn.passphrase = passphrase notification = Houston::Notification.new((.payload || {}).merge(device: .to, alert: .text, sound: "default")) apn.push(notification) .status = if notification.sent? "sent" elsif !notification.valid? || notification.error "undelivered" end end |