Class: ActionNativePush::ConfiguredNotification
- Inherits:
-
Object
- Object
- ActionNativePush::ConfiguredNotification
- Defined in:
- lib/action_native_push/configured_notification.rb
Instance Method Summary collapse
-
#initialize(notification_class) ⇒ ConfiguredNotification
constructor
A new instance of ConfiguredNotification.
- #new(**attributes) ⇒ Object
- #silent ⇒ Object
- #with_apple(apple_data) ⇒ Object
- #with_data(data) ⇒ Object
- #with_google(google_data) ⇒ Object
Constructor Details
#initialize(notification_class) ⇒ ConfiguredNotification
Returns a new instance of ConfiguredNotification.
3 4 5 6 |
# File 'lib/action_native_push/configured_notification.rb', line 3 def initialize(notification_class) @notification_class = notification_class @options = {} end |
Instance Method Details
#new(**attributes) ⇒ Object
8 9 10 |
# File 'lib/action_native_push/configured_notification.rb', line 8 def new(**attributes) notification_class.new(**attributes.merge()) end |
#silent ⇒ Object
17 18 19 20 |
# File 'lib/action_native_push/configured_notification.rb', line 17 def silent @options = .merge(high_priority: false) with_apple(content_available: 1) end |
#with_apple(apple_data) ⇒ Object
22 23 24 25 |
# File 'lib/action_native_push/configured_notification.rb', line 22 def with_apple(apple_data) @options[:apple_data] = @options.fetch(:apple_data, {}).merge(apple_data) self end |
#with_data(data) ⇒ Object
12 13 14 15 |
# File 'lib/action_native_push/configured_notification.rb', line 12 def with_data(data) @options[:data] = @options.fetch(:data, {}).merge(data) self end |
#with_google(google_data) ⇒ Object
27 28 29 30 |
# File 'lib/action_native_push/configured_notification.rb', line 27 def with_google(google_data) @options[:google_data] = @options.fetch(:google_data, {}).merge(google_data) self end |