Module: ActionPushNative
- Defined in:
- lib/action_push_native.rb,
lib/action_push_native/engine.rb,
lib/action_push_native/errors.rb,
lib/action_push_native/version.rb,
lib/action_push_native/service/fcm.rb,
lib/action_push_native/notification.rb,
lib/action_push_native/service/apns.rb,
app/models/action_push_native/device.rb,
app/jobs/action_push_native/notification_job.rb,
lib/action_push_native/configured_notification.rb
Defined Under Namespace
Modules: Service
Classes: BadDeviceTopicError, BadRequestError, ConfiguredNotification, ConnectionError, ConnectionPoolTimeoutError, Device, Engine, ForbiddenError, InstallGenerator, InternalServerError, NotFoundError, Notification, NotificationJob, PayloadTooLargeError, ServiceUnavailableError, TimeoutError, TokenError, TooManyRequestsError
Constant Summary
collapse
- VERSION =
"0.3.0"
Class Method Summary
collapse
Class Method Details
.config_for(platform, notification) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/action_push_native.rb', line 29
def self.config_for(platform, notification)
platform_config = Rails.application.config_for(:push)[platform.to_sym]
raise "ActionPushNative: '#{platform}' platform is not configured" unless platform_config.present?
if notification.application.present?
notification_config = platform_config.fetch(notification.application.to_sym, {})
platform_config.fetch(:application, {}).merge(notification_config)
else
platform_config
end
end
|
.deprecator ⇒ Object
41
42
43
|
# File 'lib/action_push_native.rb', line 41
def self.deprecator
@deprecator ||= ActiveSupport::Deprecation.new
end
|
.service_for(platform, notification) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/action_push_native.rb', line 16
def self.service_for(platform, notification)
platform_config = config_for(platform, notification)
case platform.to_sym
when :apple
Service::Apns.new(platform_config)
when :google
Service::Fcm.new(platform_config)
else
raise "ActionPushNative: '#{platform}' platform is unsupported"
end
end
|