Class: Firebase::Admin::Messaging::APS

Inherits:
Object
  • Object
show all
Defined in:
lib/firebase/admin/messaging/aps.rb

Overview

Aps dictionary to be included in an APNS payload.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alert: nil, badge: nil, sound: nil, content_available: nil, mutable_content: nil, category: nil, thread_id: nil, custom_data: nil) ⇒ APS

Parameters:

  • alert (Firebase::Admin::Messaging::APSAlert, String, nil) (defaults to: nil)

    Alert to be included in the message (optional).

  • badge (Integer, nil) (defaults to: nil)

    Badge to be displayed with the message (optional). Set to 0 to remove the badge. When not specified, the badge will remain unchanged.

  • sound (Firebase::Admin::Messaging::CriticalSound, String, nil) (defaults to: nil)

    Sound to be played with the message (optional).

  • content_available (Boolean, nil) (defaults to: nil)

    Specifies whether to configure a background update notification (optional).

  • mutable_content (Boolean, nil) (defaults to: nil)

    Specifies whether to set the ‘mutable-content` property on the message so the clients can modify the notification via app extensions (optional).

  • category (String, nil) (defaults to: nil)

    Type of the notification (optional).

  • thread_id (String, nil) (defaults to: nil)

    An app-specific identifier for grouping notifications (optional).

  • custom_data (Hash, nil) (defaults to: nil)

    App-specific custom fields (optional).



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/firebase/admin/messaging/aps.rb', line 60

def initialize(
  alert: nil,
  badge: nil,
  sound: nil,
  content_available: nil,
  mutable_content: nil,
  category: nil,
  thread_id: nil,
  custom_data: nil
)
  self.alert = alert
  self.badge = badge
  self.sound = sound
  self.content_available = content_available
  self.mutable_content = mutable_content
  self.category = category
  self.thread_id = thread_id
  self.custom_data = custom_data
end

Instance Attribute Details

#alertFirebase::Admin::Messaging::APSAlert, ...

Returns Alert to be included in the message.

Returns:



8
9
10
# File 'lib/firebase/admin/messaging/aps.rb', line 8

def alert
  @alert
end

#badgeInteger?

Returns Badge to be displayed with the message. Set to 0 to remove the badge. When not specified, the badge will remain unchanged.

Returns:

  • (Integer, nil)

    Badge to be displayed with the message. Set to 0 to remove the badge. When not specified, the badge will remain unchanged.



13
14
15
# File 'lib/firebase/admin/messaging/aps.rb', line 13

def badge
  @badge
end

#categoryString?

Returns Type of the notification.

Returns:

  • (String, nil)

    Type of the notification.



30
31
32
# File 'lib/firebase/admin/messaging/aps.rb', line 30

def category
  @category
end

#content_availableBoolean?

Returns Specifies whether to configure a background update notification.

Returns:

  • (Boolean, nil)

    Specifies whether to configure a background update notification.



21
22
23
# File 'lib/firebase/admin/messaging/aps.rb', line 21

def content_available
  @content_available
end

#custom_dataHash

Returns App-specific custom fields.

Returns:

  • (Hash)

    App-specific custom fields.



38
39
40
# File 'lib/firebase/admin/messaging/aps.rb', line 38

def custom_data
  @custom_data
end

#mutable_contentBoolean?

Returns Specifies whether to set the ‘mutable-content` property on the message so the clients can modify the notification via app extensions.

Returns:

  • (Boolean, nil)

    Specifies whether to set the ‘mutable-content` property on the message so the clients can modify the notification via app extensions.



26
27
28
# File 'lib/firebase/admin/messaging/aps.rb', line 26

def mutable_content
  @mutable_content
end

#soundFirebase::Admin::Messaging::CriticalSound, ...

Returns Sound to be played with the message.

Returns:



17
18
19
# File 'lib/firebase/admin/messaging/aps.rb', line 17

def sound
  @sound
end

#thread_idString?

Returns An app-specific identifier for grouping notifications.

Returns:

  • (String, nil)

    An app-specific identifier for grouping notifications.



34
35
36
# File 'lib/firebase/admin/messaging/aps.rb', line 34

def thread_id
  @thread_id
end